Page MenuHomePhabricator

Postgres CI failing for CheckUser
Closed, ResolvedPublicBUG REPORT

Description

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

  • Run postgres experimental CI for checkuser

What happens?:
CI fails with the error:

There were 4 errors:

1) MediaWiki\CheckUser\Tests\Integration\Api\ApiQueryCheckUserLogTest::testReasonFilter with data set "IP target with matching reason and log reason migration set to read new" ('ipusers', 'ip', '127.0.0.1', 'testing', 0, '1653047635', 'testing', true, 768)
Wikimedia\Rdbms\DBQueryError: Error 23502: ERROR:  null value in column "cul_reason" violates not-null constraint
DETAIL:  Failing row contains (1, 2023-01-31 17:15:55+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).

Function: MediaWiki\CheckUser\CheckUserLogService::addLogEntry
Query: INSERT INTO "unittest_cu_log" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:55+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)


/workspace/src/includes/libs/rdbms/database/Database.php:1534
/workspace/src/includes/libs/rdbms/database/Database.php:1518
/workspace/src/includes/libs/rdbms/database/Database.php:1492
/workspace/src/includes/libs/rdbms/database/Database.php:865
/workspace/src/includes/libs/rdbms/database/Database.php:1756
/workspace/src/includes/libs/rdbms/database/DBConnRef.php:119
/workspace/src/includes/libs/rdbms/database/DBConnRef.php:395
/workspace/src/extensions/CheckUser/src/CheckUserLogService.php:109
/workspace/src/includes/deferred/MWCallableUpdate.php:38
/workspace/src/includes/deferred/DeferredUpdates.php:473
/workspace/src/includes/deferred/DeferredUpdates.php:398
/workspace/src/includes/deferred/DeferredUpdates.php:213
/workspace/src/includes/deferred/DeferredUpdatesScope.php:267
/workspace/src/includes/deferred/DeferredUpdatesScope.php:196
/workspace/src/includes/deferred/DeferredUpdates.php:234
/workspace/src/includes/deferred/DeferredUpdates.php:280
/workspace/src/includes/deferred/DeferredUpdates.php:134
/workspace/src/includes/deferred/DeferredUpdates.php:151
/workspace/src/extensions/CheckUser/src/CheckUserLogService.php:117
/workspace/src/extensions/CheckUser/tests/phpunit/integration/Api/ApiQueryCheckUserLogTest.php:163
/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:519
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[MessageCache] [debug] MessageCache using store {class} {"class":"HashBagOStuff"}
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[UserOptionsManager] [debug] Loading options from database {"user_id":1}
[localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one []
[DeferredUpdates] [debug] DeferredUpdates::run: started CdnCacheUpdate #37412 []
[squid] [info] CdnCacheUpdate::purge: http://127.0.0.1:9413/index.php/User:UTSysop http://127.0.0.1:9413/index.php?title=User:UTSysop&action=history {"private":false}
[DeferredUpdates] [debug] DeferredUpdates::run: ended CdnCacheUpdate #37412, processing time: 0.00027704238891602 []
[CentralAuth] [debug] Loading state for global user {user} from DB {"user":"TestUser 85d767.022"}
[CentralAuth] [debug] Loading attached wiki list for global user TestUser 85d767.022 from DB []
[CentralAuth] [debug] Loading groups for global user {user} {"user":"TestUser 85d767.022"}
[objectcache] [debug] fetchOrRegenerate(global:centralauth-user:03ca53e6267131a0ef8eff1d04a8c98d): miss, new value computed []
[CentralAuth] [debug] Loading CentralAuthUser for user {user} from cache object {"user":"TestUser 85d767.022"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[DeferredUpdates] [debug] DeferredUpdates::run: started MWCallableUpdate_MediaWiki\CheckUser\CheckUserLogService->addLogEntry #36814 []
[exception] [error] [{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 23502: ERROR:  null value in column "cul_reason" violates not-null constraint
DETAIL:  Failing row contains (1, 2023-01-31 17:15:55+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).

Function: MediaWiki\CheckUser\CheckUserLogService::addLogEntry
Query: INSERT INTO "unittest_cu_log" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:55+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)
 {"exception":{"error":"ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:55+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).\n","errno":"23502","sql":"INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:55+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)","fname":"MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry","db":{"_originalTablePrefix":"","_hasDataForTestClass":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest"}},"exception_url":"[no req]","reqId":"736066318f3fcb2eba28d079","caught_by":"other"}
[exception-json] [error] {"id":"736066318f3fcb2eba28d079","type":"Wikimedia\\Rdbms\\DBQueryError","file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1534,"message":"Error 23502: ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:55+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).\n\nFunction: MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry\nQuery: INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:55+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)\n","code":0,"url":null,"caught_by":"other","backtrace":[{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1518,"function":"getQueryException","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1492,"function":"getQueryExceptionAndLog","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":865,"function":"reportQueryError","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1756,"function":"query","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/DBConnRef.php","line":119,"function":"insert","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/DBConnRef.php","line":395,"function":"__call","class":"Wikimedia\\Rdbms\\DBConnRef","type":"->"},{"file":"/workspace/src/extensions/CheckUser/src/CheckUserLogService.php","line":109,"function":"insert","class":"Wikimedia\\Rdbms\\DBConnRef","type":"->"},{"file":"/workspace/src/includes/deferred/MWCallableUpdate.php","line":38,"function":"MediaWiki\\CheckUser\\{closure}","class":"MediaWiki\\CheckUser\\CheckUserLogService","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":473,"function":"doUpdate","class":"MWCallableUpdate","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":398,"function":"attemptUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":213,"function":"run","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdatesScope.php","line":267,"function":"{closure}","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdatesScope.php","line":196,"function":"processStageQueue","class":"DeferredUpdatesScope","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":234,"function":"processUpdates","class":"DeferredUpdatesScope","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":280,"function":"doUpdates","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":134,"function":"tryOpportunisticExecute","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":151,"function":"addUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/extensions/CheckUser/src/CheckUserLogService.php","line":117,"function":"addCallableUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/extensions/CheckUser/tests/phpunit/integration/Api/ApiQueryCheckUserLogTest.php","line":163,"function":"addLogEntry","class":"MediaWiki\\CheckUser\\CheckUserLogService","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":1548,"function":"testReasonFilter","class":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":1154,"function":"runTest","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestResult.php","line":728,"function":"runBare","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":904,"function":"run","class":"PHPUnit\\Framework\\TestResult","type":"->"},{"file":"/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php","line":519,"function":"run","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"MediaWikiIntegrationTestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php","line":653,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/TextUI/Command.php","line":144,"function":"run","class":"PHPUnit\\TextUI\\TestRunner","type":"->"},{"file":"/workspace/src/tests/phpunit/phpunit.php","line":101,"function":"run","class":"PHPUnit\\TextUI\\Command","type":"->"},{"file":"/workspace/src/tests/phpunit/phpunit.php","line":153,"function":"execute","class":"PHPUnitMaintClass","type":"->"}]} {"private":true}
[DeferredUpdates] [error] Deferred update '{deferred_type}' failed to run. {"deferred_type":"MWCallableUpdate_MediaWiki\\CheckUser\\CheckUserLogService->addLogEntry","exception":{"error":"ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:55+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).\n","errno":"23502","sql":"INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:55+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)","fname":"MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry","db":{"_originalTablePrefix":"","_hasDataForTestClass":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest"}}}
[DeferredUpdates] [debug] DeferredUpdates::run: ended MWCallableUpdate_MediaWiki\CheckUser\CheckUserLogService->addLogEntry #36814, processing time: 0.0037658214569092 []
===

2) MediaWiki\CheckUser\Tests\Integration\Api\ApiQueryCheckUserLogTest::testReasonFilter with data set "IP target with non-matching reason and log reason migration set to read new" ('ipusers', 'ip', '127.0.0.1', 'testing', 0, '1653047635', 'Nonexisting reason12345', false, 768)
Wikimedia\Rdbms\DBQueryError: Error 23502: ERROR:  null value in column "cul_reason" violates not-null constraint
DETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).

Function: MediaWiki\CheckUser\CheckUserLogService::addLogEntry
Query: INSERT INTO "unittest_cu_log" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)


/workspace/src/includes/libs/rdbms/database/Database.php:1534
/workspace/src/includes/libs/rdbms/database/Database.php:1518
/workspace/src/includes/libs/rdbms/database/Database.php:1492
/workspace/src/includes/libs/rdbms/database/Database.php:865
/workspace/src/includes/libs/rdbms/database/Database.php:1756
/workspace/src/includes/libs/rdbms/database/DBConnRef.php:119
/workspace/src/includes/libs/rdbms/database/DBConnRef.php:395
/workspace/src/extensions/CheckUser/src/CheckUserLogService.php:109
/workspace/src/includes/deferred/MWCallableUpdate.php:38
/workspace/src/includes/deferred/DeferredUpdates.php:473
/workspace/src/includes/deferred/DeferredUpdates.php:398
/workspace/src/includes/deferred/DeferredUpdates.php:213
/workspace/src/includes/deferred/DeferredUpdatesScope.php:267
/workspace/src/includes/deferred/DeferredUpdatesScope.php:196
/workspace/src/includes/deferred/DeferredUpdates.php:234
/workspace/src/includes/deferred/DeferredUpdates.php:280
/workspace/src/includes/deferred/DeferredUpdates.php:134
/workspace/src/includes/deferred/DeferredUpdates.php:151
/workspace/src/extensions/CheckUser/src/CheckUserLogService.php:117
/workspace/src/extensions/CheckUser/tests/phpunit/integration/Api/ApiQueryCheckUserLogTest.php:163
/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:519
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[MessageCache] [debug] MessageCache using store {class} {"class":"HashBagOStuff"}
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[UserOptionsManager] [debug] Loading options from database {"user_id":1}
[localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one []
[DeferredUpdates] [debug] DeferredUpdates::run: started CdnCacheUpdate #31012 []
[squid] [info] CdnCacheUpdate::purge: http://127.0.0.1:9413/index.php/User:UTSysop http://127.0.0.1:9413/index.php?title=User:UTSysop&action=history {"private":false}
[DeferredUpdates] [debug] DeferredUpdates::run: ended CdnCacheUpdate #31012, processing time: 0.00025415420532227 []
[CentralAuth] [debug] Loading state for global user {user} from DB {"user":"TestUser 85d767.029"}
[CentralAuth] [debug] Loading attached wiki list for global user TestUser 85d767.029 from DB []
[CentralAuth] [debug] Loading groups for global user {user} {"user":"TestUser 85d767.029"}
[objectcache] [debug] fetchOrRegenerate(global:centralauth-user:b37c69f601b527951235895c9c072c2f): miss, new value computed []
[CentralAuth] [debug] Loading CentralAuthUser for user {user} from cache object {"user":"TestUser 85d767.029"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[DeferredUpdates] [debug] DeferredUpdates::run: started MWCallableUpdate_MediaWiki\CheckUser\CheckUserLogService->addLogEntry #19100 []
[exception] [error] [{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 23502: ERROR:  null value in column "cul_reason" violates not-null constraint
DETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).

Function: MediaWiki\CheckUser\CheckUserLogService::addLogEntry
Query: INSERT INTO "unittest_cu_log" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)
 {"exception":{"error":"ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).\n","errno":"23502","sql":"INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)","fname":"MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry","db":{"_originalTablePrefix":"","_hasDataForTestClass":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest"}},"exception_url":"[no req]","reqId":"736066318f3fcb2eba28d079","caught_by":"other"}
[exception-json] [error] {"id":"736066318f3fcb2eba28d079","type":"Wikimedia\\Rdbms\\DBQueryError","file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1534,"message":"Error 23502: ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).\n\nFunction: MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry\nQuery: INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)\n","code":0,"url":null,"caught_by":"other","backtrace":[{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1518,"function":"getQueryException","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1492,"function":"getQueryExceptionAndLog","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":865,"function":"reportQueryError","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1756,"function":"query","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/DBConnRef.php","line":119,"function":"insert","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/DBConnRef.php","line":395,"function":"__call","class":"Wikimedia\\Rdbms\\DBConnRef","type":"->"},{"file":"/workspace/src/extensions/CheckUser/src/CheckUserLogService.php","line":109,"function":"insert","class":"Wikimedia\\Rdbms\\DBConnRef","type":"->"},{"file":"/workspace/src/includes/deferred/MWCallableUpdate.php","line":38,"function":"MediaWiki\\CheckUser\\{closure}","class":"MediaWiki\\CheckUser\\CheckUserLogService","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":473,"function":"doUpdate","class":"MWCallableUpdate","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":398,"function":"attemptUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":213,"function":"run","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdatesScope.php","line":267,"function":"{closure}","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdatesScope.php","line":196,"function":"processStageQueue","class":"DeferredUpdatesScope","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":234,"function":"processUpdates","class":"DeferredUpdatesScope","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":280,"function":"doUpdates","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":134,"function":"tryOpportunisticExecute","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":151,"function":"addUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/extensions/CheckUser/src/CheckUserLogService.php","line":117,"function":"addCallableUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/extensions/CheckUser/tests/phpunit/integration/Api/ApiQueryCheckUserLogTest.php","line":163,"function":"addLogEntry","class":"MediaWiki\\CheckUser\\CheckUserLogService","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":1548,"function":"testReasonFilter","class":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":1154,"function":"runTest","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestResult.php","line":728,"function":"runBare","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":904,"function":"run","class":"PHPUnit\\Framework\\TestResult","type":"->"},{"file":"/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php","line":519,"function":"run","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"MediaWikiIntegrationTestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php","line":653,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/TextUI/Command.php","line":144,"function":"run","class":"PHPUnit\\TextUI\\TestRunner","type":"->"},{"file":"/workspace/src/tests/phpunit/phpunit.php","line":101,"function":"run","class":"PHPUnit\\TextUI\\Command","type":"->"},{"file":"/workspace/src/tests/phpunit/phpunit.php","line":153,"function":"execute","class":"PHPUnitMaintClass","type":"->"}]} {"private":true}
[DeferredUpdates] [error] Deferred update '{deferred_type}' failed to run. {"deferred_type":"MWCallableUpdate_MediaWiki\\CheckUser\\CheckUserLogService->addLogEntry","exception":{"error":"ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 2, ipusers, 0, 127.0.0.1, 7F000001, , ).\n","errno":"23502","sql":"INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'ipusers',0,'127.0.0.1','7F000001','','',2,2)","fname":"MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry","db":{"_originalTablePrefix":"","_hasDataForTestClass":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest"}}}
[DeferredUpdates] [debug] DeferredUpdates::run: ended MWCallableUpdate_MediaWiki\CheckUser\CheckUserLogService->addLogEntry #19100, processing time: 0.0051398277282715 []
===

3) MediaWiki\CheckUser\Tests\Integration\Api\ApiQueryCheckUserLogTest::testReasonFilter with data set "User target with matching reason and log reason migration set to read new" ('userips', 'user', 'Testing', '1234 - [[test]]', 0, '1653042345', '1234 - [[test]]', true, 768)
Wikimedia\Rdbms\DBQueryError: Error 23502: ERROR:  null value in column "cul_reason" violates not-null constraint
DETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 3, userips, 0, Testing, , , ).

Function: MediaWiki\CheckUser\CheckUserLogService::addLogEntry
Query: INSERT INTO "unittest_cu_log" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'userips',0,'Testing','','','',2,3)


/workspace/src/includes/libs/rdbms/database/Database.php:1534
/workspace/src/includes/libs/rdbms/database/Database.php:1518
/workspace/src/includes/libs/rdbms/database/Database.php:1492
/workspace/src/includes/libs/rdbms/database/Database.php:865
/workspace/src/includes/libs/rdbms/database/Database.php:1756
/workspace/src/includes/libs/rdbms/database/DBConnRef.php:119
/workspace/src/includes/libs/rdbms/database/DBConnRef.php:395
/workspace/src/extensions/CheckUser/src/CheckUserLogService.php:109
/workspace/src/includes/deferred/MWCallableUpdate.php:38
/workspace/src/includes/deferred/DeferredUpdates.php:473
/workspace/src/includes/deferred/DeferredUpdates.php:398
/workspace/src/includes/deferred/DeferredUpdates.php:213
/workspace/src/includes/deferred/DeferredUpdatesScope.php:267
/workspace/src/includes/deferred/DeferredUpdatesScope.php:196
/workspace/src/includes/deferred/DeferredUpdates.php:234
/workspace/src/includes/deferred/DeferredUpdates.php:280
/workspace/src/includes/deferred/DeferredUpdates.php:134
/workspace/src/includes/deferred/DeferredUpdates.php:151
/workspace/src/extensions/CheckUser/src/CheckUserLogService.php:117
/workspace/src/extensions/CheckUser/tests/phpunit/integration/Api/ApiQueryCheckUserLogTest.php:163
/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php:519
=== Logs generated by test case
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[MessageCache] [debug] MessageCache using store {class} {"class":"HashBagOStuff"}
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[UserOptionsManager] [debug] Loading options from database {"user_id":1}
[localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one []
[DeferredUpdates] [debug] DeferredUpdates::run: started CdnCacheUpdate #37556 []
[squid] [info] CdnCacheUpdate::purge: http://127.0.0.1:9413/index.php/User:UTSysop http://127.0.0.1:9413/index.php?title=User:UTSysop&action=history {"private":false}
[DeferredUpdates] [debug] DeferredUpdates::run: ended CdnCacheUpdate #37556, processing time: 0.00019192695617676 []
[CentralAuth] [debug] Loading state for global user {user} from DB {"user":"TestUser 85d767.030"}
[CentralAuth] [debug] Loading attached wiki list for global user TestUser 85d767.030 from DB []
[CentralAuth] [debug] Loading groups for global user {user} {"user":"TestUser 85d767.030"}
[objectcache] [debug] fetchOrRegenerate(global:centralauth-user:9ea1eeced5ccb6da6d3b5bb060086430): miss, new value computed []
[CentralAuth] [debug] Loading CentralAuthUser for user {user} from cache object {"user":"TestUser 85d767.030"}
[localisation] [debug] LocalisationCache using store LCStoreNull []
[objectcache] [debug] MainWANObjectCache using store {class} {"class":"EmptyBagOStuff"}
[localisation] [debug] LocalisationCache::isExpired(en): cache missing, need to make one []
[MessageCache] [debug] MessageCache using store {class} {"class":"HashBagOStuff"}
[DeferredUpdates] [debug] DeferredUpdates::run: started MWCallableUpdate_MediaWiki\CheckUser\CheckUserLogService->addLogEntry #37601 []
[exception] [error] [{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 23502: ERROR:  null value in column "cul_reason" violates not-null constraint
DETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 3, userips, 0, Testing, , , ).

Function: MediaWiki\CheckUser\CheckUserLogService::addLogEntry
Query: INSERT INTO "unittest_cu_log" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'userips',0,'Testing','','','',2,3)
 {"exception":{"error":"ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 3, userips, 0, Testing, , , ).\n","errno":"23502","sql":"INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'userips',0,'Testing','','','',2,3)","fname":"MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry","db":{"_originalTablePrefix":"","_hasDataForTestClass":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest"}},"exception_url":"[no req]","reqId":"736066318f3fcb2eba28d079","caught_by":"other"}
[exception-json] [error] {"id":"736066318f3fcb2eba28d079","type":"Wikimedia\\Rdbms\\DBQueryError","file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1534,"message":"Error 23502: ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 3, userips, 0, Testing, , , ).\n\nFunction: MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry\nQuery: INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'userips',0,'Testing','','','',2,3)\n","code":0,"url":null,"caught_by":"other","backtrace":[{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1518,"function":"getQueryException","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1492,"function":"getQueryExceptionAndLog","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":865,"function":"reportQueryError","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/Database.php","line":1756,"function":"query","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/DBConnRef.php","line":119,"function":"insert","class":"Wikimedia\\Rdbms\\Database","type":"->"},{"file":"/workspace/src/includes/libs/rdbms/database/DBConnRef.php","line":395,"function":"__call","class":"Wikimedia\\Rdbms\\DBConnRef","type":"->"},{"file":"/workspace/src/extensions/CheckUser/src/CheckUserLogService.php","line":109,"function":"insert","class":"Wikimedia\\Rdbms\\DBConnRef","type":"->"},{"file":"/workspace/src/includes/deferred/MWCallableUpdate.php","line":38,"function":"MediaWiki\\CheckUser\\{closure}","class":"MediaWiki\\CheckUser\\CheckUserLogService","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":473,"function":"doUpdate","class":"MWCallableUpdate","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":398,"function":"attemptUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":213,"function":"run","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdatesScope.php","line":267,"function":"{closure}","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdatesScope.php","line":196,"function":"processStageQueue","class":"DeferredUpdatesScope","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":234,"function":"processUpdates","class":"DeferredUpdatesScope","type":"->"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":280,"function":"doUpdates","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":134,"function":"tryOpportunisticExecute","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/includes/deferred/DeferredUpdates.php","line":151,"function":"addUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/extensions/CheckUser/src/CheckUserLogService.php","line":117,"function":"addCallableUpdate","class":"DeferredUpdates","type":"::"},{"file":"/workspace/src/extensions/CheckUser/tests/phpunit/integration/Api/ApiQueryCheckUserLogTest.php","line":163,"function":"addLogEntry","class":"MediaWiki\\CheckUser\\CheckUserLogService","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":1548,"function":"testReasonFilter","class":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":1154,"function":"runTest","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestResult.php","line":728,"function":"runBare","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestCase.php","line":904,"function":"run","class":"PHPUnit\\Framework\\TestResult","type":"->"},{"file":"/workspace/src/tests/phpunit/MediaWikiIntegrationTestCase.php","line":519,"function":"run","class":"PHPUnit\\Framework\\TestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"MediaWikiIntegrationTestCase","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php","line":675,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php","line":653,"function":"run","class":"PHPUnit\\Framework\\TestSuite","type":"->"},{"file":"/workspace/src/vendor/phpunit/phpunit/src/TextUI/Command.php","line":144,"function":"run","class":"PHPUnit\\TextUI\\TestRunner","type":"->"},{"file":"/workspace/src/tests/phpunit/phpunit.php","line":101,"function":"run","class":"PHPUnit\\TextUI\\Command","type":"->"},{"file":"/workspace/src/tests/phpunit/phpunit.php","line":153,"function":"execute","class":"PHPUnitMaintClass","type":"->"}]} {"private":true}
[DeferredUpdates] [error] Deferred update '{deferred_type}' failed to run. {"deferred_type":"MWCallableUpdate_MediaWiki\\CheckUser\\CheckUserLogService->addLogEntry","exception":{"error":"ERROR:  null value in column \"cul_reason\" violates not-null constraint\nDETAIL:  Failing row contains (1, 2023-01-31 17:15:56+00, 1, null, 2, 3, userips, 0, Testing, , , ).\n","errno":"23502","sql":"INSERT INTO \"unittest_cu_log\" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:56+00',1,'userips',0,'Testing','','','',2,3)","fname":"MediaWiki\\CheckUser\\CheckUserLogService::addLogEntry","db":{"_originalTablePrefix":"","_hasDataForTestClass":"MediaWiki\\CheckUser\\Tests\\Integration\\Api\\ApiQueryCheckUserLogTest"}}}
[DeferredUpdates] [debug] DeferredUpdates::run: ended MWCallableUpdate_MediaWiki\CheckUser\CheckUserLogService->addLogEntry #37601, processing time: 0.0038840770721436 []
===

4) MediaWiki\CheckUser\Tests\Integration\Api\ApiQueryCheckUserLogTest::testReasonFilter with data set "User target with non-matching reason and log reason migration set to read new" ('userips', 'user', 'Testing', '1234 - [[test]]', 0, '1653042345', 'Nonexisting reason12345', false, 768)
Wikimedia\Rdbms\DBQueryError: Error 23502: ERROR:  null value in column "cul_reason" violates not-null constraint
DETAIL:  Failing row contains (1, 2023-01-31 17:15:57+00, 1, null, 2, 3, userips, 0, Testing, , , ).

Function: MediaWiki\CheckUser\CheckUserLogService::addLogEntry
Query: INSERT INTO "unittest_cu_log" (cul_timestamp,cul_actor,cul_type,cul_target_id,cul_target_text,cul_target_hex,cul_range_start,cul_range_end,cul_reason_id,cul_reason_plaintext_id) VALUES ('2023-01-31 17:15:57+00',1,'userips',0,'Testing','','','',2,3)

What should have happened instead?:

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Hmm. Trying to file on mobile doesn't let me copy the right part of the error log.

I've not been able to find the root cause for this. My own postgres testing database did not properly update the default until I ran the SQL manually in the postgres command line. However, even if the update SQL file was wrong the tests run on a wiki instance that is created at the time the tests are run. As such schema changes such as this should already be applied when creating the tables using tables-generated.sql.

I used ALTER TABLE mediawiki.cu_log ALTER cul_reason SET DEFAULT ''; to perform the schema change manually, which is the same query defined in the postgres SQL patch file (minus specifying mediawiki). This fixed the issue, and so there must be an issue with applying the default.

I have found the cause. For postgres databases only the default was removed in 1.39. This conflicts with the re-addition of a default in some way and as such the re-addition of the default fails. Removing the default value removal fixes the issue.

cul_reason will likely be removed before 1.40 is released, so the removal of this database update step will not be a big issue as the field will then be removed after migrating the data.

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

[mediawiki/extensions/CheckUser@master] Remove the database update from 1.39 to remove the cul_reason default

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

Dreamy_Jazz triaged this task as Medium priority.
Dreamy_Jazz added a project: PostgreSQL.

Change 885434 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Remove the database update from 1.39 to remove the cul_reason default

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