Page MenuHomePhabricator

CentralAuth should work with postgres
Closed, ResolvedPublic

Description

00:00:55.733 Creating globaluser table ...Wikimedia\Rdbms\DBQueryError from line 1626 of /workspace/src/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? 
00:00:55.737 Query: CREATE TABLE "globalnames" (
00:00:55.737  gn_name varchar(255) binary not null,
00:00:55.737  primary key (gn_name)
00:00:55.737  ) /*$wgDBTableOptions*/
00:00:55.737 
00:00:55.737 Function: Wikimedia\Rdbms\Database::sourceFile( /workspace/src/extensions/CentralAuth/includes/../central-auth.sql )
00:00:55.737 Error: 42601 ERROR:  syntax error at or near "binary"
00:00:55.737 LINE 2:  gn_name varchar(255) binary not null,
00:00:55.737                               ^
00:00:55.737 
00:00:55.737 
00:00:55.737 #0 /workspace/src/includes/libs/rdbms/database/Database.php(1610): Wikimedia\Rdbms\Database->getQueryException('ERROR:  syntax ...', '42601', 'CREATE TABLE "g...', 'Wikimedia\\Rdbms...')
00:00:55.737 #1 /workspace/src/includes/libs/rdbms/database/Database.php(1587): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('ERROR:  syntax ...', '42601', 'CREATE TABLE "g...', 'Wikimedia\\Rdbms...')
00:00:55.737 #2 /workspace/src/includes/libs/rdbms/database/Database.php(1166): Wikimedia\Rdbms\Database->reportQueryError('ERROR:  syntax ...', '42601', 'CREATE TABLE "g...', 'Wikimedia\\Rdbms...', false)
00:00:55.737 #3 /workspace/src/includes/libs/rdbms/database/Database.php(4601): Wikimedia\Rdbms\Database->query('CREATE TABLE "g...', 'Wikimedia\\Rdbms...')
00:00:55.737 #4 /workspace/src/includes/libs/rdbms/database/Database.php(4536): Wikimedia\Rdbms\Database->sourceStream(Resource id #2339, NULL, NULL, 'Wikimedia\\Rdbms...', NULL)
00:00:55.737 #5 /workspace/src/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->sourceFile('/workspace/src/...')
00:00:55.737 #6 /workspace/src/includes/libs/rdbms/database/MaintainableDBConnRef.php(35): Wikimedia\Rdbms\DBConnRef->__call('sourceFile', Array)
00:00:55.737 #7 /workspace/src/includes/installer/DatabaseUpdater.php(691): Wikimedia\Rdbms\MaintainableDBConnRef->sourceFile('/workspace/src/...')
00:00:55.737 #8 /workspace/src/includes/installer/DatabaseUpdater.php(734): DatabaseUpdater->applyPatch('/workspace/src/...', true, 'Creating global...')
00:00:55.737 #9 /workspace/src/includes/installer/DatabaseUpdater.php(490): DatabaseUpdater->addTable('globaluser', '/workspace/src/...', true)
00:00:55.737 #10 /workspace/src/includes/installer/DatabaseUpdater.php(458): DatabaseUpdater->runUpdates(Array, true)
00:00:55.737 #11 /workspace/src/maintenance/update.php(197): DatabaseUpdater->doUpdates(Array)
00:00:55.737 #12 /workspace/src/maintenance/doMaintenance.php(99): UpdateMediaWiki->execute()
00:00:55.737 #13 /workspace/src/maintenance/update.php(270): require_once('/workspace/src/...')
00:00:55.737 #14 {main}
00:00:55.744 INFO:quibble.cmd:<<< Finish: Install MediaWiki, db=postgres db_dir=/workspace/db vendor=True, in 5.979 s
00:00:55.832 Traceback (most recent call last):
00:00:55.832   File "/usr/local/bin/quibble", line 11, in <module>
00:00:55.832     load_entry_point('quibble==0.0.40', 'console_scripts', 'quibble')()
00:00:55.832   File "/usr/local/lib/python3.5/dist-packages/quibble/cmd.py", line 467, in main
00:00:55.832     cmd.execute(plan)
00:00:55.832   File "/usr/local/lib/python3.5/dist-packages/quibble/cmd.py", line 289, in execute
00:00:55.832     command.execute()
00:00:55.832   File "/usr/local/lib/python3.5/dist-packages/quibble/commands.py", line 502, in execute
00:00:55.832     mwdir=self.mw_install_path
00:00:55.832   File "/usr/local/lib/python3.5/dist-packages/quibble/mediawiki/maintenance.py", line 37, in update
00:00:55.832     'Update failed with exit code: %s' % p.returncode)
00:00:55.832 Exception: Update failed with exit code: 1
00:00:55.854 INFO:backend.Postgres:Terminating Postgres
00:00:55.855 /usr/bin/pg_virtualenv: line 221:   629 User defined signal 1   "$@"
00:00:55.855 Dropping cluster 9.6/regress ...
00:00:57.003 *** /tmp/pg_virtualenv.Z3PEpj/log/*.log (last 100 lines) ***
00:00:57.004 tail: cannot open '/tmp/pg_virtualenv.Z3PEpj/log/*.log' for reading: No such file or directory
00:00:57.004 BUG: Cluster 9.6/regress was not created by me (PGSYSCONFDIR=/tmp/pg_virtualenv.Z3PEpj/postgresql-common, PG_CLUSTER_CONF_ROOT=/tmp/pg_virtualenv.Z3PEpj/postgresql)

Event Timeline

Change 573014 had a related patch set uploaded (by Jack Phoenix; owner: Jack Phoenix):
[mediawiki/extensions/CentralAuth@master] Quick & dirty PostgreSQL port

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

Reedy changed the task status from Open to Stalled.Jul 31 2020, 5:19 PM

Marking stalled due to subtask needing solving first (I don't know if the attached patch will be merged... Maybe it will be)

Change 573014 abandoned by Jack Phoenix:

[mediawiki/extensions/CentralAuth@master] Quick & dirty PostgreSQL port

Reason:

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

Change 758566 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/CentralAuth@master] Call IDatabase::timestamp before inserting rows

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

Change 758566 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Call IDatabase::timestamp before inserting rows

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

Change 766221 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/CentralAuth@master] tests: Call IDatabase::timestamp before inserting rows

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

Change 766221 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] tests: Call IDatabase::timestamp before inserting rows

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

Umherirrender changed the task status from Stalled to Open.Mar 15 2022, 5:20 PM
Umherirrender subscribed.

A postgres schema now exists. It seems some tests still failing under postgres

It seems some tests still failing under postgres

The tests are fixed after T304759

Jdforrester-WMF removed taavi as the assignee of this task.
Jdforrester-WMF added a subscriber: taavi.
17:00:03 There were 2 errors:
17:00:03 
17:00:03 1) GlobalGroupIntegrationTest::testReadGroupsFromDatabase
17:00:03 Wikimedia\Rdbms\DBQueryError: Error 42P01: ERROR:  relation "unittest_user" does not exist
17:00:03 LINE 1: ...AuthUser::addLocalEdits  */  user_editcount  FROM "unittest_...
17:00:03                                                              ^
17:00:03 
17:00:03 Function: MediaWiki\Extension\CentralAuth\User\CentralAuthUser::addLocalEdits
17:00:03 Query: SELECT  user_editcount  FROM "unittest_user"    WHERE user_name = 'TestUser MediaWikiIntegrationTestCase 72aac3.006'  LIMIT 1

It works when using a non-default $wgDBmwschema, so this could be a problem with cores rdbms support (Need new task?). Or just using false for the local wiki, but CentralAuth can have many places with this

Change 812422 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/CentralAuth@master] Change wikiID to false for local database connection

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

Change 812422 merged by jenkins-bot:

[mediawiki/extensions/CentralAuth@master] Change wikiID to false for local database connection

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