Page MenuHomePhabricator

Removal of columns causes sqlite updates that have temporary tables to fail
Closed, ResolvedPublicBUG REPORT


Steps to replicate the issue (include links if applicable):

  • Run sqlite CI

What happens?:
Install fails with error:

Wikimedia\Rdbms\DBQueryError from line 1534 of /workspace/src/includes/libs/rdbms/database/Database.php: Error 1: no such column: cul_reason
21:35:13 Function: Wikimedia\Rdbms\Database::sourceFile( /workspace/src/extensions/CheckUser/src/../schema/sqlite/patch-cu_log-drop-actor_default.sql )
21:35:13 Query: CREATE TEMPORARY TABLE "__temp__cu_log" AS
21:35:13  SELECT  cul_id,  cul_timestamp,  cul_actor,  cul_reason,  cul_reason_id,  cul_reason_plaintext_id,  cul_type,  cul_target_id,  cul_target_text,  cul_target_hex,  cul_range_start,  cul_range_end
21:35:13  FROM  "cu_log"
21:35:13 #0 /workspace/src/includes/libs/rdbms/database/Database.php(1518): Wikimedia\Rdbms\Database->getQueryException()
21:35:13 #1 /workspace/src/includes/libs/rdbms/database/Database.php(1492): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()
21:35:13 #2 /workspace/src/includes/libs/rdbms/database/Database.php(865): Wikimedia\Rdbms\Database->reportQueryError()
21:35:13 #3 /workspace/src/includes/libs/rdbms/database/Database.php(3087): Wikimedia\Rdbms\Database->query()
21:35:13 #4 /workspace/src/includes/libs/rdbms/database/Database.php(3026): Wikimedia\Rdbms\Database->sourceStream()
21:35:13 #5 /workspace/src/includes/installer/DatabaseUpdater.php(716): Wikimedia\Rdbms\Database->sourceFile()
21:35:13 #6 /workspace/src/includes/installer/DatabaseUpdater.php(998): DatabaseUpdater->applyPatch()
21:35:13 #7 /workspace/src/includes/installer/DatabaseUpdater.php(547): DatabaseUpdater->modifyField()
21:35:13 #8 /workspace/src/includes/installer/DatabaseUpdater.php(515): DatabaseUpdater->runUpdates()
21:35:13 #9 /workspace/src/includes/installer/DatabaseInstaller.php(349): DatabaseUpdater->doUpdates()
21:35:13 #10 /workspace/src/includes/installer/Installer.php(1670): DatabaseInstaller->createExtensionTables()
21:35:13 #11 /workspace/src/includes/installer/CliInstaller.php(211): Installer->performInstallation()
21:35:13 #12 /workspace/src/maintenance/install.php(142): CliInstaller->execute()
21:35:13 #13 /workspace/src/maintenance/includes/MaintenanceRunner.php(585): CommandLineInstaller->execute()
21:35:13 #14 /workspace/src/maintenance/doMaintenance.php(99): MediaWiki\Maintenance\MaintenanceRunner->run()
21:35:13 #15 /workspace/src/maintenance/install.php(201): require_once('/workspace/src/...')
21:35:13 #16 {main}

For new installs the updatelog won't contain that these patches have been run. For sqlite some updates use a temporary table, which means that there cannot be any new or removed fields (as the temporary table change would remove the newly added ones and fail with an error when it's missing). This can be fixed by ensuring any schema changes that are only needed for installs that are not new are only run on second runs of update.php after installing CheckUser.

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

Change 886458 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/CheckUser@master] Move drop of cul_reason behind drop of cul_actor default

Change 886458 abandoned by Zabe:

[mediawiki/extensions/CheckUser@master] Move drop of cul_reason behind drop of cul_actor default


done in

Change 886461 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Don't drop cul_actor default if cul_reason is missing for SQLite

Dreamy_Jazz triaged this task as Medium priority.
Dreamy_Jazz moved this task from General / Unsorted to Patches for review on the CheckUser board.
Dreamy_Jazz added a project: SQLite.

Change 886461 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Don't drop cul_actor default if cul_reason is missing for SQLite

Thanks for the quick merge. To prevent this happening again I will be making a commitment to myself to always run check experimental on any change.