Page MenuHomePhabricator

Error while enabling event registration: Wikimedia\Rdbms\DBQueryError: Error 1054: Unknown column 'event_type' in 'INSERT INTO' Function: MediaWiki\Extension\CampaignEvents\Event\Store\EventStore::saveRegistration Query: INSERT INTO `campaign_events` (event_name,event
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1054: Unknown column 'event_type' in 'INSERT INTO'
Function: MediaWiki\Extension\CampaignEvents\Event\Store\EventStore::saveRegistration
Query: INSERT INTO `campaign_events` (event_name,event
FrameLocationCall
from/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1232)
#0/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1216)Wikimedia\Rdbms\Database->getQueryException(string, int, string, string)
#1/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1190)Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, int, string, string)
#2/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(647)Wikimedia\Rdbms\Database->reportQueryError(string, int, string, string, bool)
#3/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1498)Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#4/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/DBConnRef.php(127)Wikimedia\Rdbms\Database->insert(string, array, string, array)
#5/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/DBConnRef.php(407)Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/querybuilder/InsertQueryBuilder.php(340)Wikimedia\Rdbms\DBConnRef->insert(string, array, string, array)
#7/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Event/Store/EventStore.php(503)Wikimedia\Rdbms\InsertQueryBuilder->execute()
#8/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Event/EditEventCommand.php(193)MediaWiki\Extension\CampaignEvents\Event\Store\EventStore->saveRegistration(MediaWiki\Extension\CampaignEvents\Event\EventRegistration)
#9/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Event/EditEventCommand.php(97)MediaWiki\Extension\CampaignEvents\Event\EditEventCommand->doEditUnsafe(MediaWiki\Extension\CampaignEvents\Event\EventRegistration, MediaWiki\User\User, array)
#10/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Special/AbstractEventRegistrationSpecialPage.php(719)MediaWiki\Extension\CampaignEvents\Event\EditEventCommand->doEditIfAllowed(MediaWiki\Extension\CampaignEvents\Event\EventRegistration, MediaWiki\User\User, array)
#11/srv/mediawiki/php-1.45.0-wmf.1/includes/htmlform/HTMLForm.php(825)MediaWiki\Extension\CampaignEvents\Special\AbstractEventRegistrationSpecialPage->onSubmit(array, MediaWiki\HTMLForm\OOUIHTMLForm)
#12/srv/mediawiki/php-1.45.0-wmf.1/includes/htmlform/HTMLForm.php(706)MediaWiki\HTMLForm\HTMLForm->trySubmit()
#13/srv/mediawiki/php-1.45.0-wmf.1/includes/htmlform/HTMLForm.php(722)MediaWiki\HTMLForm\HTMLForm->tryAuthorizedSubmit()
#14/srv/mediawiki/php-1.45.0-wmf.1/includes/specialpage/FormSpecialPage.php(211)MediaWiki\HTMLForm\HTMLForm->show()
#15/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Special/AbstractEventRegistrationSpecialPage.php(175)MediaWiki\SpecialPage\FormSpecialPage->execute(null)
#16/srv/mediawiki/php-1.45.0-wmf.1/includes/specialpage/SpecialPage.php(734)MediaWiki\Extension\CampaignEvents\Special\AbstractEventRegistrationSpecialPage->execute(null)
#17/srv/mediawiki/php-1.45.0-wmf.1/includes/specialpage/SpecialPageFactory.php(1738)MediaWiki\SpecialPage\SpecialPage->run(null)
#18/srv/mediawiki/php-1.45.0-wmf.1/includes/actions/ActionEntryPoint.php(499)MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#19/srv/mediawiki/php-1.45.0-wmf.1/includes/actions/ActionEntryPoint.php(143)MediaWiki\Actions\ActionEntryPoint->performRequest()
#20/srv/mediawiki/php-1.45.0-wmf.1/includes/MediaWikiEntryPoint.php(198)MediaWiki\Actions\ActionEntryPoint->execute()
#21/srv/mediawiki/php-1.45.0-wmf.1/index.php(58)MediaWiki\MediaWikiEntryPoint->run()
#22/srv/mediawiki/w/index.php(3)require(string)
#23{main}
Impact
Notes

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

  • Filed the details in the event from
  • Clicked the "Enable registration" button

What happens?:

  • Showing Database error:

[c9500f7e-e756-447d-9c96-14a6780e40f3] 2025-05-20 10:10:12: Fatal exception of type "Wikimedia\Rdbms\DBQueryError"

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

image.png (921×1 px, 73 KB)

Details

Request URL
https://meta.wikimedia.org/wiki/Special:EnableEventRegistration

Event Timeline

taavi changed the subtype of this task from "Bug Report" to "Production Error".May 20 2025, 10:19 AM
taavi added a project: CampaignEvents.
taavi renamed this task from Error while enabling event registration to Error while enabling event registration: Wikimedia\Rdbms\DBQueryError: Error 1054: Unknown column 'event_type' in 'INSERT INTO' Function: MediaWiki\Extension\CampaignEvents\Event\Store\EventStore::saveRegistration Query: INSERT INTO `campaign_events` (event_name,event.May 20 2025, 10:20 AM
taavi set Request URL to https://meta.wikimedia.org/wiki/Special:EnableEventRegistration.
taavi updated the task description. (Show Details)
Krinkle triaged this task as High priority.May 20 2025, 4:40 PM
Krinkle moved this task from Untriaged to Apr-Jun 2025 on the Wikimedia-production-error board.

Same issue, posting it here for indexing:

Error
labels.normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1054: Unknown column 'event_type' in 'SET'
Function: MediaWiki\Extension\CampaignEvents\Event\Store\EventStore::saveRegistration
Query: UPDATE  `campaign_events` SET event_name = 'Africa Wiki
FrameLocationCall
from/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1232)
#0/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1216)Wikimedia\Rdbms\Database->getQueryException(string, int, string, string)
#1/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1190)Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, int, string, string)
#2/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(647)Wikimedia\Rdbms\Database->reportQueryError(string, int, string, string, bool)
#3/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/Database.php(1518)Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#4/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/DBConnRef.php(127)Wikimedia\Rdbms\Database->update(string, array, array, string, array)
#5/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/database/DBConnRef.php(413)Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6/srv/mediawiki/php-1.45.0-wmf.1/includes/libs/rdbms/querybuilder/UpdateQueryBuilder.php(332)Wikimedia\Rdbms\DBConnRef->update(string, array, array, string, array)
#7/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Event/Store/EventStore.php(511)Wikimedia\Rdbms\UpdateQueryBuilder->execute()
#8/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Event/EditEventCommand.php(193)MediaWiki\Extension\CampaignEvents\Event\Store\EventStore->saveRegistration(MediaWiki\Extension\CampaignEvents\Event\EventRegistration)
#9/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Event/EditEventCommand.php(97)MediaWiki\Extension\CampaignEvents\Event\EditEventCommand->doEditUnsafe(MediaWiki\Extension\CampaignEvents\Event\EventRegistration, MediaWiki\User\User, array)
#10/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Special/AbstractEventRegistrationSpecialPage.php(719)MediaWiki\Extension\CampaignEvents\Event\EditEventCommand->doEditIfAllowed(MediaWiki\Extension\CampaignEvents\Event\EventRegistration, MediaWiki\User\User, array)
#11/srv/mediawiki/php-1.45.0-wmf.1/includes/htmlform/HTMLForm.php(825)MediaWiki\Extension\CampaignEvents\Special\AbstractEventRegistrationSpecialPage->onSubmit(array, MediaWiki\HTMLForm\OOUIHTMLForm)
#12/srv/mediawiki/php-1.45.0-wmf.1/includes/htmlform/HTMLForm.php(706)MediaWiki\HTMLForm\HTMLForm->trySubmit()
#13/srv/mediawiki/php-1.45.0-wmf.1/includes/htmlform/HTMLForm.php(740)MediaWiki\HTMLForm\HTMLForm->tryAuthorizedSubmit()
#14/srv/mediawiki/php-1.45.0-wmf.1/includes/specialpage/FormSpecialPage.php(211)MediaWiki\HTMLForm\HTMLForm->showAlways()
#15/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Special/AbstractEventRegistrationSpecialPage.php(175)MediaWiki\SpecialPage\FormSpecialPage->execute(string)
#16/srv/mediawiki/php-1.45.0-wmf.1/extensions/CampaignEvents/src/Special/SpecialEditEventRegistration.php(130)MediaWiki\Extension\CampaignEvents\Special\AbstractEventRegistrationSpecialPage->execute(string)
#17/srv/mediawiki/php-1.45.0-wmf.1/includes/specialpage/SpecialPage.php(734)MediaWiki\Extension\CampaignEvents\Special\SpecialEditEventRegistration->execute(string)
#18/srv/mediawiki/php-1.45.0-wmf.1/includes/specialpage/SpecialPageFactory.php(1738)MediaWiki\SpecialPage\SpecialPage->run(string)
#19/srv/mediawiki/php-1.45.0-wmf.1/includes/actions/ActionEntryPoint.php(499)MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, MediaWiki\Context\RequestContext)
#20/srv/mediawiki/php-1.45.0-wmf.1/includes/actions/ActionEntryPoint.php(143)MediaWiki\Actions\ActionEntryPoint->performRequest()
#21/srv/mediawiki/php-1.45.0-wmf.1/includes/MediaWikiEntryPoint.php(198)MediaWiki\Actions\ActionEntryPoint->execute()
#22/srv/mediawiki/php-1.45.0-wmf.1/index.php(58)MediaWiki\MediaWikiEntryPoint->run()
#23/srv/mediawiki/w/index.php(3)require(string)
#24{main}

I am unable to reproduce this on meta wiki now

Screen Recording 2025-05-23 at 11.05.09 AM.gif (1×2 px, 593 KB)

@vaughnwalters I was having this issue on 20th to 22nd. When I tried on 22nd i was able to create the event without the error.

Daimona subscribed.

The schema change made in T387488 was applied in production (T394509) before the patch that updates the code actually landed. So, the old code was trying to insert event_type whereas the column no longer existed in the schema. This resulted in 78 logged instances where enabling registration failed. The outage started when the schema change was applied (2025-05-19 ~05:00 UTC) and ended with the roll-out of wmf.2 (T392172): 2025-05-21 ~08:03 UTC for group 1, and 2025-05-22 ~08:20 UTC for group2, which matches the timeline above.

These did not show up as observable failure modes, but also worth noting:

  • The code that writes to the new column was added in the same wmf.2 version. So, even performing the schema change after the train roll-out would have resulted in outages due to the new column (event_types) not existing, instead of the old one. Such an outage would've lasted from the roll-out to the schema change, but it would have been much less manageable in case of train rollbacks.
  • Even without writing the new columns, the schema change patch was not compatible, because it stopped writing to the event_type column, which is NOT NULL and has no default. So, there still would've been an outage in that case.

For posterity: there are a few options as to how this could've been done without breaking anything. "Serious" schema changes (involving large tables, lots of data, and where the old data is valuable or a maintenance script is needed to change stuff) would use a config setting and the MIGRATION_* constants. Here, given the size of the tables involved, the fact that the old data can be discarded, and the fact that the new column has a default, we could use a simplified process.

Option 1: two schema changes

  • Make a first schema change that only adds a default to the old column, leaving the code unchanged
  • Wait for the code to reach production (can be backported), apply the change
  • Then make a schema change that drops the old column, adds the new one, and stops writing to the old column (but does not write to the new one).
  • Wait for the code to reach production (can be backported), apply the change. Note, no breakage here because the default value added in the first step is used.
  • Make a final patch to write to the new column

Option 2: feature flag

  • Make a schema change patch that drops the old column and adds the new one. In the code, add a feature flag, and have it control whether the old or the new column is written. By default, write to the old column.
  • Wait for the code to reach production (can be backported)
  • Prepare a config patch that flips the feature flag (write to the new column)
  • Coordinate with a deployer and a DBA so that the schema change is applied, and the config patch is deployed immediately afterwards (does not fully avoid outages, but limits them to a short window with a good chance of no impacted users)
  • Clean up everything feature flag-related

At any rate, the issue has been resolved, so I'm closing this task.