Page MenuHomePhabricator

CentralNotice has a broken database updater
Closed, ResolvedPublic

Description

Spotted on beta:

mwdeploy@deployment-bastion:~$ mwscript update.php --wiki=dewiki --quick --quiet
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'CNDatabasePatcher' not found or invalid function name in /data/project/apache/common-local/php-master/includes/Hooks.php on line 255

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'CNDatabasePatcher' not found or invalid function name in /data/project/apache/common-local/php-master/includes/Hooks.php on line 255
Detected bug in an extension! Hook CNDatabasePatcher failed to return a value; should return true to continue hook processing or false to abort.
Backtrace:
#0 /data/project/apache/common-local/php-master/includes/GlobalFunctions.php(3883): Hooks::run('LoadExtensionSc...', Array)
#1 /data/project/apache/common-local/php-master/includes/installer/DatabaseUpdater.php(111): wfRunHooks('LoadExtensionSc...', Array)
#2 /data/project/apache/common-local/php-master/includes/installer/DatabaseUpdater.php(162): DatabaseUpdater->__construct(Object(DatabaseMysql), false, Object(UpdateMediaWiki))
#3 /data/project/apache/common-local/php-master/maintenance/update.php(149): DatabaseUpdater::newForDB(Object(DatabaseMysql), false, Object(UpdateMediaWiki))
#4 /data/project/apache/common-local/php-master/maintenance/doMaintenance.php(110): UpdateMediaWiki->execute()
#5 /data/project/apache/common-local/php-master/maintenance/update.php(192): require_once('/data/project/a...')
#6 /data/project/apache/common-local/multiversion/MWScript.php(85): require_once('/data/project/a...')
#7 {main}


Aka:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'CNDatabasePatcher' not found or invalid function name in /data/project/apache/common-local/php-master/includes/Hooks.php on line 255
Detected bug in an extension! Hook CNDatabasePatcher failed to return a value; should return true to continue hook processing or false to abort.


Version: master
Severity: normal

Details

Reference
bz46533

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
Resolvedhashar

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:17 AM
bzimport set Reference to bz46533.

Once per hour, Jenkins will run update.php on the 'enwiki' database of the beta cluster. The job dashboard is https://integration.wikimedia.org/ci/job/beta-updatedb-enwiki/

It started breaking on March 21st https://integration.wikimedia.org/ci/job/beta-updatedb-enwiki/42/

-$wgHooks[ 'LoadExtensionSchemaUpdates' ][ ] = array( 'CNDatabasePatcher', 'applyUpdates' );
+$wgHooks[ 'LoadExtensionSchemaUpdates' ][ ] = 'CNDatabasePatcher::applyUpdates';

That fix it on my install.

Bah I did my test on sqlite, not mysql. Reopening.

Did some cleanup on beta and now I got:

Creating cn_controller_mixins table ...A database query syntax error has occurred.
The last attempted database query was:
"ALTER TABLE cn_notices
DROP COLUMN not_language,
DROP COLUMN not_project,
ADD COLUMN not_weight int(11) NOT NULL DEFAULT '100',
ADD COLUMN not_mobile_carrier tinyint(1) NOT NULL DEFAULT '0',
ADD COLUMN not_archived tinyint(1) NOT NULL DEFAULT '0'
"
from within function "DatabaseBase::sourceFile( /data/project/apache/common-local/php-master/extensions/CentralNotice/patches/patch-centralnotice-2_3.sql )".
Database returned error "1091: Can't DROP 'not_language'; check that column/key exists (10.4.0.53)"

When bootstrapping a new wiki CentralNotice.sql does not create:

  • table cn_controller_mixins
  • cn_notices.not_language and cn_notices.not_project

The absence of table cn_controller_mixins triggers the run of patches/patch-centralnotice-2_3.sql which attempt drop the two non existent columns, hence the stack trace.

Next issue:

The last attempted database query was:
"ALTER TABLE cn_notices
DROP COLUMN not_language,
DROP COLUMN not_project,
ADD COLUMN not_weight int(11) NOT NULL DEFAULT '100',
ADD COLUMN not_mobile_carrier tinyint(1) NOT NULL DEFAULT '0',
ADD COLUMN not_archived tinyint(1) NOT NULL DEFAULT '0'
"
from within function "DatabaseBase::sourceFile( /data/project/apache/common-local/php-master/extensions/CentralNotice/patches/patch-centralnotice-2_3.sql )".
Database returned error "1060: Duplicate column name 'not_weight' (10.4.0.53)"

Wich is a similar issue: the patch attempt to add columns which have already been populated by the main patch.

I have reverted the whole patchset with https://gerrit.wikimedia.org/r/#/c/55587/ . Pinging authors by email.

The patch has been reimplemented with https://gerrit.wikimedia.org/r/55695 :-]

I still have to test it out but beta is no more broken so I am lowering the priority for this issue.

This patch should be back-ported to the release branch. A user just logged on IRC to report that this issue broke his/her MediaWiki instance after upgrading to RHEL_1_21.

(In reply to comment #12)

This patch should be back-ported to the release branch.

--> Backport_to_Stable flag set to "?"

(In reply to comment #13)

--> Backport_to_Stable flag set to "?"

hexmode: ping?