Page MenuHomePhabricator

cleanupUsersWithNoId.php should not depend on ar_user column
Closed, ResolvedPublic

Description

Previously reported in T224949:

Ran an import of enwikivoyage in REL1_32:

$ mysqladmin -f drop wiki_demo
$ php maintenance/install.php ...
$ php maintenance/update.php --quick
$ pv ~/enwikivoyage-20190801-pages-meta-current.xml.bz2 | bzcat | php maintenance/importDump.php
$ pv ~/enwikivoyage-20190801-pages-meta-current.xml.bz2 | bzcat | php maintenance/importDump.php --skip-to=30000
$ pv ~/enwikivoyage-20190801-pages-meta-current.xml.bz2 | bzcat | php maintenance/importDump.php --skip-to=60000
$ pv ~/enwikivoyage-20190801-pages-meta-current.xml.bz2 | bzcat | php maintenance/importDump.php --skip-to=90000
$ pv ~/enwikivoyage-20190801-pages-meta-current.xml.bz2 | bzcat | php maintenance/importDump.php --skip-to=120000
$ php maintenance/rebuildrecentchanges.php
$ php maintenance/initSiteStats.php --update

(it kept running out of memory after ~30,000 pages)

At this point, I switched to the REL1_34 branch and ran update.php. The only oddity I noticed was this warning:

Creating actor entries for all registered users
... 1 - 1
Completed actor creation, added 1 new actor(s)
Beginning migration of revision.rev_user and revision.rev_user_text to revision_actor_temp.revactor_actor
... rev_id=101
... rev_id=201
... rev_id=301
...
... rev_id=14301
... rev_id=14401
User name "Გამაგ" is usable, cannot create an anonymous actor for it. Run maintenance/cleanupUsersWithNoId.php to fix this situation.

... rev_id=14501
... rev_id=14601
...

So I ran the cleanup script:

$ php maintenance/cleanupUsersWithNoId.php --force -p earthwiki
Beginning cleanup of revision
... rev_timestamp=20031216231532 rev_id=63421
... rev_timestamp=20040314215216 rev_id=22731
...
... rev_timestamp=20190801020655 rev_id=64815
... rev_timestamp=20191112022707 rev_id=1
Completed cleanup, assigned 0 and prefixed 1 row(s)
Beginning cleanup of archive
Wikimedia\Rdbms\DBQueryError from line 1603 of /opt/htdocs/mediawiki/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  ar_id,ar_user,ar_user_text,ar_id  FROM `archive`    WHERE (1=1)  ORDER BY ar_id LIMIT 100  
Function: CleanupUsersWithNoId::cleanup
Error: 1054 Unknown column 'ar_user' in 'field list' (localhost)

#0 /opt/htdocs/mediawiki/includes/libs/rdbms/database/Database.php(1574): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Unknown column ...', 1054, 'SELECT  ar_id,a...', 'CleanupUsersWit...')
#1 /opt/htdocs/mediawiki/includes/libs/rdbms/database/Database.php(1152): Wikimedia\Rdbms\Database->reportQueryError('Unknown column ...', 1054, 'SELECT  ar_id,a...', 'CleanupUsersWit...', false)
#2 /opt/htdocs/mediawiki/includes/libs/rdbms/database/Database.php(1807): Wikimedia\Rdbms\Database->query('SELECT  ar_id,a...', 'CleanupUsersWit...')
#3 /opt/htdocs/mediawiki/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select('archive', Array, Array, 'CleanupUsersWit...', Array)
#4 /opt/htdocs/mediawiki/includes/libs/rdbms/database/DBConnRef.php(315): Wikimedia\Rdbms\DBConnRef->__call('select', Array)
#5 /opt/htdocs/mediawiki/maintenance/cleanupUsersWithNoId.php(153): Wikimedia\Rdbms\DBConnRef->select('archive', Array, Array, 'CleanupUsersWit...', Array)
#6 /opt/htdocs/mediawiki/maintenance/cleanupUsersWithNoId.php(63): CleanupUsersWithNoId->cleanup('archive', Array, 'ar_user', 'ar_user_text', Array, Array)
#7 /opt/htdocs/mediawiki/maintenance/Maintenance.php(1746): CleanupUsersWithNoId->doDBUpdates()
#8 /opt/htdocs/mediawiki/maintenance/doMaintenance.php(99): LoggedUpdateMaintenance->execute()
#9 /opt/htdocs/mediawiki/maintenance/cleanupUsersWithNoId.php(212): require_once('/opt/htdocs/med...')
#10 {main}
$

It looks like c29909e59fd missed something?

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 12 2019, 6:23 AM
MarkAHershberger renamed this task from cleanupUsersWithNoId.php reveals that ar_user column is not created in upgrade from 1.32 to cleanupUsersWithNoId.php should not depend on ar_user column.Nov 12 2019, 3:00 PM

Change 550482 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] cleanupUsersWithNoId.php: Handle missing fields

https://gerrit.wikimedia.org/r/550482

Not MCR Schema Migration, it's the Actor Migration.

MarkAHershberger added a comment.EditedNov 12 2019, 9:01 PM

Testing now. Ran before with --no-local-users and got T238149

Change 550482 merged by jenkins-bot:
[mediawiki/core@master] cleanupUsersWithNoId.php: Handle missing fields

https://gerrit.wikimedia.org/r/550482

Anomie closed this task as Resolved.Nov 13 2019, 5:15 PM

Feel free to create any backports you feel are necessary.

Change 569246 had a related patch set uploaded (by Paladox; owner: Anomie):
[mediawiki/core@REL1_34] cleanupUsersWithNoId.php: Handle missing fields

https://gerrit.wikimedia.org/r/569246