Page MenuHomePhabricator

Echo and update.php with --schema option does not work and should
Open, Needs TriagePublic

Description

When running update.php when enabling Echo for the first time while passing --schema I get a bunch of errors and no generated schema

This should be fixable.

These line numbers relate to REL1_33

...Update 'Wikibase\Repo\Maintenance\PopulateTermFullEntityId' already logged as completed.
Removing orphaned echo_event rows...
[error] [DBQuery] BatchRowIterator::next        mediawiki-sql   1146    Table 'wiki.prefix_echo_event' doesn't exist (mediawiki-sql)    SELECT  event_id  FROM `prefix_echo_event` LEFT JOIN `prefix_echo_notification` ON ((notification_event=event_id)) LEFT JOIN `prefix_echo_email_batch` ON ((eeb_event_id=event_id))   WHERE notification_user IS NULL AND eeb_user_id IS NULL  ORDER BY event_id ASC LIMIT 500
#0 /var/www/html/includes/libs/rdbms/database/Database.php(1556): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /var/www/html/includes/libs/rdbms/database/Database.php(1274): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /var/www/html/includes/libs/rdbms/database/Database.php(1784): Wikimedia\Rdbms\Database->query(string, string)
#3 /var/www/html/includes/utils/BatchRowIterator.php(219): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#4 /var/www/html/includes/utils/BatchRowIterator.php(182): BatchRowIterator->next()
#5 /var/www/html/extensions/Echo/maintenance/removeOrphanedEvents.php(56): BatchRowIterator->rewind()
#6 /var/www/html/maintenance/Maintenance.php(1719): RemoveOrphanedEvents->doDBUpdates()
#7 /var/www/html/maintenance/update.php(215): LoggedUpdateMaintenance->execute()
#8 /var/www/html/maintenance/doMaintenance.php(99): UpdateMediaWiki->execute()
#9 /var/www/html/maintenance/update.php(275): require_once(string)
#10 {main}
[error] [exception] [205d80d1987e0ab3a363f135] [no req]   Wikimedia\Rdbms\DBQueryError from line 1587 of /var/www/html/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT  event_id  FROM `prefix_echo_event` LEFT JOIN `prefix_echo_notification` ON ((notification_event=event_id)) LEFT JOIN `prefix_echo_email_batch` ON ((eeb_event_id=event_id))   WHERE notification_user IS NULL AND eeb_user_id IS NULL  ORDER BY event_id ASC LIMIT 500
Function: BatchRowIterator::next
Error: 1146 Table 'wiki.prefix_echo_event' doesn't exist (mediawiki-sql)

#0 /var/www/html/includes/libs/rdbms/database/Database.php(1556): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /var/www/html/includes/libs/rdbms/database/Database.php(1274): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /var/www/html/includes/libs/rdbms/database/Database.php(1784): Wikimedia\Rdbms\Database->query(string, string)
#3 /var/www/html/includes/utils/BatchRowIterator.php(219): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#4 /var/www/html/includes/utils/BatchRowIterator.php(182): BatchRowIterator->next()
#5 /var/www/html/extensions/Echo/maintenance/removeOrphanedEvents.php(56): BatchRowIterator->rewind()
#6 /var/www/html/maintenance/Maintenance.php(1719): RemoveOrphanedEvents->doDBUpdates()
#7 /var/www/html/maintenance/update.php(215): LoggedUpdateMaintenance->execute()
#8 /var/www/html/maintenance/doMaintenance.php(99): UpdateMediaWiki->execute()
#9 /var/www/html/maintenance/update.php(275): require_once(string)
#10 {main}
[error] [exception-json] {"id":"205d80d1987e0ab3a363f135","type":"Wikimedia\\Rdbms\\DBQueryError","file":"/var/www/html/includes/libs/rdbms/database/Database.php","line":1587,"message":"A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? \nQuery: SELECT  event_id  FROM `prefix_echo_event` LEFT JOIN `prefix_echo_notification` ON ((notification_event=event_id)) LEFT JOIN `prefix_echo_email_batch` ON ((eeb_event_id=event_id))   WHERE notification_user IS NULL AND eeb_user_id IS NULL  ORDER BY event_id ASC LIMIT 500  \nFunction: BatchRowIterator::next\nError: 1146 Table 'wiki.prefix_echo_event' doesn't exist (mediawiki-sql)\n","code":0,"url":null,"caught_by":"mwe_handler","backtrace":[{"file":"/var/www/html/includes/libs/rdbms/database/Database.php","line":1556,"function":"getQueryExceptionAndLog","class":"Wikimedia\\Rdbms\\Database","type":"->","args":["string","integer","string","string"]},{"file":"/var/www/html/includes/libs/rdbms/database/Database.php","line":1274,"function":"reportQueryError","class":"Wikimedia\\Rdbms\\Database","type":"->","args":["string","integer","string","string","boolean"]},{"file":"/var/www/html/includes/libs/rdbms/database/Database.php","line":1784,"function":"query","class":"Wikimedia\\Rdbms\\Database","type":"->","args":["string","string"]},{"file":"/var/www/html/includes/utils/BatchRowIterator.php","line":219,"function":"select","class":"Wikimedia\\Rdbms\\Database","type":"->","args":["array","array","array","string","array","array"]},{"file":"/var/www/html/includes/utils/BatchRowIterator.php","line":182,"function":"next","class":"BatchRowIterator","type":"->","args":[]},{"file":"/var/www/html/extensions/Echo/maintenance/removeOrphanedEvents.php","line":56,"function":"rewind","class":"BatchRowIterator","type":"->","args":[]},{"file":"/var/www/html/maintenance/Maintenance.php","line":1719,"function":"doDBUpdates","class":"RemoveOrphanedEvents","type":"->","args":[]},{"file":"/var/www/html/maintenance/update.php","line":215,"function":"execute","class":"LoggedUpdateMaintenance","type":"->","args":[]},{"file":"/var/www/html/maintenance/doMaintenance.php","line":99,"function":"execute","class":"UpdateMediaWiki","type":"->","args":[]},{"file":"/var/www/html/maintenance/update.php","line":275,"args":["string"],"function":"require_once"}]}
[205d80d1987e0ab3a363f135] [no req]   Wikimedia\Rdbms\DBQueryError from line 1587 of /var/www/html/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT  event_id  FROM `prefix_echo_event` LEFT JOIN `prefix_echo_notification` ON ((notification_event=event_id)) LEFT JOIN `prefix_echo_email_batch` ON ((eeb_event_id=event_id))   WHERE notification_user IS NULL AND eeb_user_id IS NULL  ORDER BY event_id ASC LIMIT 500
Function: BatchRowIterator::next
Error: 1146 Table 'wiki.prefix_echo_event' doesn't exist (mediawiki-sql)

Backtrace:
#0 /var/www/html/includes/libs/rdbms/database/Database.php(1556): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#1 /var/www/html/includes/libs/rdbms/database/Database.php(1274): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /var/www/html/includes/libs/rdbms/database/Database.php(1784): Wikimedia\Rdbms\Database->query(string, string)
#3 /var/www/html/includes/utils/BatchRowIterator.php(219): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#4 /var/www/html/includes/utils/BatchRowIterator.php(182): BatchRowIterator->next()
#5 /var/www/html/extensions/Echo/maintenance/removeOrphanedEvents.php(56): BatchRowIterator->rewind()
#6 /var/www/html/maintenance/Maintenance.php(1719): RemoveOrphanedEvents->doDBUpdates()
#7 /var/www/html/maintenance/update.php(215): LoggedUpdateMaintenance->execute()
#8 /var/www/html/maintenance/doMaintenance.php(99): UpdateMediaWiki->execute()
#9 /var/www/html/maintenance/update.php(275): require_once(string)
#10 {main}

Event Timeline

Addshore created this task.Apr 9 2020, 10:26 PM
Restricted Application added a project: Growth-Team. · View Herald TranscriptApr 9 2020, 10:26 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Addshore updated the task description. (Show Details)Apr 9 2020, 10:29 PM

It looks like this was also reported a bunch on the extension talk page but with no fix https://www.mediawiki.org/wiki/Topic:Udak70p95g3jpxam

Perhaps this is a broader mediawiki issue?

I see the updater calls:

		$updater->addPostDatabaseUpdateMaintenance( RemoveOrphanedEvents::class );

Should this actually be run in the case that no schema changes are being made?

If not then core needs fixing, if these should still run according to core then Echo needs a little check to see if the updater is in schema mode.

Perhaps this is a broader mediawiki issue?

@tstarling on Gerrit said --schema and --noschema options have been broken already even before recent Wikidata incident

before recent Wikidata incident

hmm??

I does indeed look like this has been broken for some time, but we should still fix it.