Page MenuHomePhabricator

Fatal exception of type "Wikimedia\Rdbms\DBTransactionSizeError" while trying to undelete a page with 1,500 revisions
Closed, DuplicatePublicBUG REPORT

Description

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

What happens?:

You get a database error.

What should have happened instead?:

The page should have been deleted.

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

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

To avoid creating high replication lag, this transaction was aborted because the write duration (5.3239433765411) exceeded the 3 second limit. If you are changing many items at once, try doing multiple smaller operations instead.
[736ed52b-ef89-4e1f-9426-480c6ea90ff9] 2023-01-20 01:56:34: Fatal exception of type "Wikimedia\Rdbms\DBTransactionSizeError"

Event Timeline

ST47 renamed this task from Unable to undelete a page on enwiki to Fatal exception of type "Wikimedia\Rdbms\DBTransactionSizeError" while trying to undelete a page with 1,500 revisions.Jan 20 2023, 2:08 AM

(For what it's worth, even loading https://en.wikipedia.org/wiki/Special:Undelete/Miss_World_2022 is quite slow, at 4-5 seconds. Originally reported at WP:AN.

Zabe subscribed.

Basically this is the undelete version of T198176. So we need an undelete version of https://gerrit.wikimedia.org/r/c/mediawiki/core/+/456035/ to fix this.

@Zabe, were you able to check the log trace associated with the request quoted in the task description? I find it hard to believe that we've been unable to undelete pages with more than a thousand or so revisions since at least June 2018, and instead it seems likely that a recent change made the operation significantly more expensive.

@Zabe, were you able to check the log trace associated with the request quoted in the task description? I find it hard to believe that we've been unable to undelete pages with more than a thousand or so revisions since at least June 2018, and instead it seems likely that a recent change made the operation significantly more expensive.

Here the traces associated with the request in the task.

[736ed52b-ef89-4e1f-9426-480c6ea90ff9] /w/index.php?action=submit&title=Special:Undelete   Wikimedia\Rdbms\DBTransactionSizeError: Transaction spent 5.324s in writes, exceeding the 3s limit

from /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1638)
#0 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/lbfactory/LBFactory.php(391): Wikimedia\Rdbms\LoadBalancer->approvePrimaryChanges(array, string)
#1 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(679): Wikimedia\Rdbms\LBFactory->commitPrimaryChanges(string, array)
#2 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(649): MediaWiki::preOutputCommit(RequestContext)
#3 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(928): MediaWiki->doPreOutputCommit()
#4 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(571): MediaWiki->main()
#5 /srv/mediawiki/php-1.40.0-wmf.19/index.php(50): MediaWiki->run()
#6 /srv/mediawiki/php-1.40.0-wmf.19/index.php(46): wfIndexMain()
#7 /srv/mediawiki/w/index.php(3): require(string)
#8 {main}
Expectation (maxAffected <= 1000) by MediaWiki::main not met (actual: 5225) in trx #03bd0b0bce:
[transaction writes to enwiki at db1118]

from /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/TransactionProfiler.php(541)
#0 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/TransactionProfiler.php(428): Wikimedia\Rdbms\TransactionProfiler->reportExpectationViolated(string, string, integer, string)
#1 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/TransactionManager.php(608): Wikimedia\Rdbms\TransactionProfiler->transactionWritingOut(string, string, string, double, integer)
#2 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/TransactionManager.php(902): Wikimedia\Rdbms\TransactionManager->transactionWritingOut(Wikimedia\Rdbms\DatabaseMysqli, string)
#3 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/Database.php(2752): Wikimedia\Rdbms\TransactionManager->onRollback(Wikimedia\Rdbms\DatabaseMysqli)
#4 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1827): Wikimedia\Rdbms\Database->rollback(string, string)
#5 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/lbfactory/LBFactory.php(417): Wikimedia\Rdbms\LoadBalancer->rollbackPrimaryChanges(string)
#6 /srv/mediawiki/php-1.40.0-wmf.19/includes/exception/MWExceptionHandler.php(167): Wikimedia\Rdbms\LBFactory->rollbackPrimaryChanges(string)
#7 /srv/mediawiki/php-1.40.0-wmf.19/includes/exception/MWExceptionHandler.php(192): MWExceptionHandler::rollbackPrimaryChanges()
#8 /srv/mediawiki/php-1.40.0-wmf.19/includes/exception/MWExceptionHandler.php(248): MWExceptionHandler::rollbackPrimaryChangesAndLog(Wikimedia\Rdbms\DBTransactionSizeError, string)
#9 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(590): MWExceptionHandler::handleException(Wikimedia\Rdbms\DBTransactionSizeError, string)
#10 /srv/mediawiki/php-1.40.0-wmf.19/index.php(50): MediaWiki->run()
#11 /srv/mediawiki/php-1.40.0-wmf.19/index.php(46): wfIndexMain()
#12 /srv/mediawiki/w/index.php(3): require(string)
#13 {main}
Expectation (maxAffected <= 1000) by MediaWiki::main not met (actual: 1512) in trx #03bd0b0bce:
role-primary: DELETE FROM `archive` WHERE ar_namespace = N AND ar_title = 'X'
	
from /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/TransactionProfiler.php(541)
#0 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/TransactionProfiler.php(337): Wikimedia\Rdbms\TransactionProfiler->reportExpectationViolated(string, Wikimedia\Rdbms\GeneralizedSql, integer, string, string)
#1 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/TransactionManager.php(615): Wikimedia\Rdbms\TransactionProfiler->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, double, boolean, integer, string, string)
#2 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/Database.php(1134): Wikimedia\Rdbms\TransactionManager->recordQueryCompletion(Wikimedia\Rdbms\GeneralizedSql, double, boolean, integer, string)
#3 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/Database.php(1007): Wikimedia\Rdbms\Database->attemptQuery(array, array, string, string, boolean, boolean)
#4 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/Database.php(861): Wikimedia\Rdbms\Database->executeQuery(string, string, integer, string)
#5 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/Database.php(2023): Wikimedia\Rdbms\Database->query(string, string, integer)
#6 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->delete(string, array, string)
#7 /srv/mediawiki/php-1.40.0-wmf.19/includes/libs/rdbms/database/DBConnRef.php(559): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#8 /srv/mediawiki/php-1.40.0-wmf.19/includes/page/UndeletePage.php(651): Wikimedia\Rdbms\DBConnRef->delete(string, array, string)
#9 /srv/mediawiki/php-1.40.0-wmf.19/includes/page/UndeletePage.php(323): MediaWiki\Page\UndeletePage->undeleteRevisions(WikiPage, array, string)
#10 /srv/mediawiki/php-1.40.0-wmf.19/includes/page/UndeletePage.php(259): MediaWiki\Page\UndeletePage->undeleteUnsafe(string)
#11 /srv/mediawiki/php-1.40.0-wmf.19/includes/specials/SpecialUndelete.php(1441): MediaWiki\Page\UndeletePage->undeleteIfAllowed(string)
#12 /srv/mediawiki/php-1.40.0-wmf.19/includes/specials/SpecialUndelete.php(355): SpecialUndelete->undelete()
#13 /srv/mediawiki/php-1.40.0-wmf.19/includes/specialpage/SpecialPage.php(700): SpecialUndelete->execute(NULL)
#14 /srv/mediawiki/php-1.40.0-wmf.19/includes/specialpage/SpecialPageFactory.php(1458): SpecialPage->run(NULL)
#15 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(322): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#16 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(915): MediaWiki->performRequest()
#17 /srv/mediawiki/php-1.40.0-wmf.19/includes/MediaWiki.php(571): MediaWiki->main()
#18 /srv/mediawiki/php-1.40.0-wmf.19/index.php(50): MediaWiki->run()
#19 /srv/mediawiki/php-1.40.0-wmf.19/index.php(46): wfIndexMain()
#20 /srv/mediawiki/w/index.php(3): require(string)
#21 {main}

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

[mediawiki/core@master] Use real transaction when undeleting revisions

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

Looks like a duplicate of T239095. See also T257298 and T218712. I'm not performing any merges to avoid stomping on somebody else's work,

Change 882199 abandoned by Zabe:

[mediawiki/core@master] Use real transaction when undeleting revisions

Reason:

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