Page MenuHomePhabricator

Cargo causes a DBTransactionStateError when attempting to store when a table does not exist.
Open, Needs TriagePublic


Version: Cargo 2.0.1
MediaWiki 1.31.1

When attempting to call the store parser function to a table that is not yet created it will cause an DBTransactionStateError exception. In the Cargo 1.x series this did not occur.

An example of this being broken is available here in Gamepedia's staging environment.

[e2e6cbe98a6849d175cbc70f] /News Wikimedia\Rdbms\DBTransactionStateError from line 1313 of includes/libs/rdbms/database/Database.php: Cannot execute query from Wikimedia\Rdbms\DatabaseMysqlBase::tableExists while transaction status is ERROR.


#0 includes/libs/rdbms/database/Database.php(1096): Wikimedia\Rdbms\Database->assertTransactionStatus(string, string)
#1 includes/libs/rdbms/database/DatabaseMysqlBase.php(622): Wikimedia\Rdbms\Database->query(string, string)
#2 extensions/Cargo/includes/parserfunctions/CargoStore.php(77): Wikimedia\Rdbms\DatabaseMysqlBase->tableExists(string)
#3 includes/parser/Parser.php(3426): CargoStore::run(Parser, string, string, string, string, string, string, string, string, string, string, string, string, string)
#4 includes/parser/Parser.php(3127): Parser->callParserFunction(PPTemplateFrame_DOM, string, array)
#5 includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(array, PPTemplateFrame_DOM)
#6 extensions/ParserFunctions/includes/ExtParserFunctions.php(123): PPFrame_DOM->expand(DOMElement)
#7 includes/parser/Parser.php(3426): ExtParserFunctions::ifeqObj(Parser, PPTemplateFrame_DOM, array)
#8 includes/parser/Parser.php(3127): Parser->callParserFunction(PPTemplateFrame_DOM, string, array)
#9 includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(array, PPTemplateFrame_DOM)
#10 includes/parser/Parser.php(3305): PPFrame_DOM->expand(DOMElement)
#11 includes/parser/Preprocessor_DOM.php(1277): Parser->braceSubstitution(array, PPFrame_DOM)
#12 includes/parser/Parser.php(2942): PPFrame_DOM->expand(DOMElement, integer)
#13 includes/parser/Parser.php(1293): Parser->replaceVariables(string)
#14 includes/parser/Parser.php(443): Parser->internalParse(string)
#15 includes/content/WikitextContent.php(323): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#16 includes/content/AbstractContent.php(516): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#17 includes/poolcounter/PoolWorkArticleView.php(144): AbstractContent->getParserOutput(Title, integer, ParserOptions)
#18 includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#19 includes/page/Article.php(604): PoolCounterWork->execute()
#20 includes/actions/ViewAction.php(68): Article->view()
#21 includes/MediaWiki.php(500): ViewAction->show()
#22 includes/MediaWiki.php(294): MediaWiki->performAction(Article, Title)
#23 includes/MediaWiki.php(861): MediaWiki->performRequest()
#24 includes/MediaWiki.php(524): MediaWiki->main()
#25 index.php(42): MediaWiki->run()

Event Timeline

Alexia created this task.Nov 14 2018, 10:08 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 14 2018, 10:08 PM

What's the problem with this? I mean, why not just create the missing table?

Someone might be adding Cargo to an existing template, and after they've added {{#cargo_store}} but before they've created the table, someone else might try to save a page that uses that template. Is that what results in this error? Might be better to make it not fail, or show an error, or something. Maybe I'm not considering it correctly though.

I sync a lot of code across wikis, and sometimes the newer wiki doesn't have all the tables created yet, having the page completely error can make it pretty hard to figure out what needs to be created. Also with such a large number of wikis & tables, I don't always create everything unless I need it. There's a separate issue which is that (at least in the past) the recreate data api action could only REcreate tables, and not create them in the first place, which contributes to the lag in creating all tables on new wikis, since it's a manual process for each one; regardless, I don't think erroring the entire page is the best behavior when a table doesn't exist.

Pcj awarded a token.Nov 18 2018, 5:08 PM
Pcj added a subscriber: Pcj.