Page MenuHomePhabricator

Migrate extensions using begin/commit to startAtomic/endAtomic as needed
Closed, ResolvedPublic

Description

Extensions that blindly call $dbw->begin()/commit() break any pending transactions by pre-maturely committing them. This causes log warnings and breaks atomicity. Such callers should instead use:

  • $dbw->startAtomic()/endAtomic()
  • $dbw->onTranasction*()
  • DeferredUpdates

...to accomplish similar ends.

Note that Job classes and Maintenance scripts are usually exceptions, as they have control of the outermost scope of database transactions, so they can use begin()/commit().

Details

Related Gerrit Patches:
mediawiki/extensions/Survey : REL1_27Remove begin()/commit() calls that can break outer transactions
mediawiki/extensions/LiveTranslate : REL1_27Replace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Reflect : masterRemove begin()/commit() calls that can break outer transactions
mediawiki/extensions/LiveTranslate : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Survey : masterRemove begin()/commit() calls that can break outer transactions
mediawiki/extensions/DeletePagesForGood : REL1_27DB: Replace begin with startAtomic and commit with endAtomic
mediawiki/extensions/DeletePagesForGood : masterDB: Replace begin with startAtomic and commit with endAtomic
mediawiki/extensions/CentralAuth : masterRemove unneeded DB begin/commit calls
mediawiki/extensions/CentralNotice : masterConvert begin/commit calls to (start|end)Atomic
mediawiki/extensions/SecurePoll : masterConvert code to using startAtomic()/endAtomic()
mediawiki/extensions/SecurePoll : masterConvert code to using startAtomic()/endAtomic()
mediawiki/extensions/VoteNY : masterRemove begin()/commit() calls that can break outer transactions
mediawiki/extensions/QuizGame : masterRemove begin()/commit() calls that can break outer transactions
mediawiki/extensions/OnlineStatus : masterConvert code to using startAtomic()/endAtomic()
mediawiki/extensions/EditAccount : masterConvert code to using startAtomic()/endAtomic()
mediawiki/extensions/CloseWikis : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/PollNY : masterRemove begin()/commit() calls that can break outer transactions
mediawiki/extensions/PureWikiDeletion : masterRemove begin()/commit() calls that can break outer transactions
mediawiki/extensions/MathSearch : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Renameuser : masterAssorted transaction logic cleanups
mediawiki/extensions/SemanticWatchlist : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/CentralAuth : masterRemove DB begin()/commit() from adminSetHidden()
mediawiki/extensions/GlobalBlocking : masterRemove DB begin()/commit() from purgeExpired()
mediawiki/extensions/CentralAuth : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/CentralAuth : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/CentralAuth : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/ConfirmAccount : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Wikilog : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Video : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/UIFeedback : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Gather : devReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Contest : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Drafts : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Duplicator : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/IndexFunction : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/MoodBar : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/OpenBadges : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/ReassignEdits : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/CodeReview : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/CodeReview : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/CodeReview : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Annotator : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/AJAXPoll : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed
mediawiki/extensions/Newsletter : masterReplace DB begin()/commit() with startAtomic()/endAtomic() as needed

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 257530 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257532 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257533 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257535 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257540 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257541 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257542 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257543 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257546 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257547 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257543 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257522 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257524 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257526 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257527 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257528 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257547 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257546 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257542 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257541 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257535 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257532 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257533 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257540 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257746 had a related patch set uploaded (by Aaron Schulz):
Assorted transaction logic cleanups

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

Change 257753 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257761 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257764 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257766 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257764 merged by jenkins-bot:
Remove begin()/commit() calls that can break outer transactions

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

Change 257753 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257761 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257766 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257530 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

DeletePagesForGood needs this done too.

Paladox added a comment.EditedDec 10 2015, 11:14 PM

@aaron I keep getting this error

[198811ca] /index.php?title=Special:ConfirmAccounts/authors DBUnexpectedError from line 3448 of /home/paladox1/public_html/includes/db/Database.php: Got explicit BEGIN from DatabaseBase::begin while atomic section(s) AccountConfirmSubmission::acceptRequest are open.

Backtrace:

#0 /home/paladox1/public_html/extensions/CentralAuth/includes/CentralAuthUser.php(2025): DatabaseBase->begin()
#1 /home/paladox1/public_html/extensions/CentralAuth/includes/CentralAuthUser.php(1997): CentralAuthUser->importLocalNames()
#2 /home/paladox1/public_html/extensions/CentralAuth/includes/CentralAuthUser.php(1897): CentralAuthUser->lazyImportLocalNames()
#3 /home/paladox1/public_html/extensions/CentralAuth/includes/CentralAuthPlugin.php(303): CentralAuthUser->listUnattached()
#4 /home/paladox1/public_html/extensions/ConfirmAccount/business/AccountConfirmSubmission.php(249): CentralAuthPlugin->addUser(User, string, string, string)
#5 /home/paladox1/public_html/extensions/ConfirmAccount/business/AccountConfirmSubmission.php(48): AccountConfirmSubmission->acceptRequest(RequestContext)
#6 /home/paladox1/public_html/extensions/ConfirmAccount/frontend/specialpages/actions/ConfirmAccount_body.php(560): AccountConfirmSubmission->submit(RequestContext)
#7 /home/paladox1/public_html/extensions/ConfirmAccount/frontend/specialpages/actions/ConfirmAccount_body.php(93): ConfirmAccountsPage->doAccountConfirmSubmit()
#8 /home/paladox1/public_html/includes/specialpage/SpecialPage.php(384): ConfirmAccountsPage->execute(string)
#9 /home/paladox1/public_html/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(string)
#10 /home/paladox1/public_html/includes/MediaWiki.php(248): SpecialPageFactory::executePath(Title, RequestContext)
#11 /home/paladox1/public_html/includes/MediaWiki.php(699): MediaWiki->performRequest()
#12 /home/paladox1/public_html/includes/MediaWiki.php(474): MediaWiki->main()
#13 /home/paladox1/public_html/index.php(43): MediaWiki->run()
#14 {main}

In confirmaccount when trying to click accept an account to be registered. This problem seems to have happended since switchting to startAtomic

Happends in class AccountConfirmSubmission function acceptRequest

It CentralAuth causing the problem.

CentralAuth also needs converting.

Change 258379 had a related patch set uploaded (by Paladox):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 258389 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 258389 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 258379 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 258443 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 258443 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 260496 had a related patch set uploaded (by Aaron Schulz):
Remove DB begin()/commit() from adminSetHidden()

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

Change 260500 had a related patch set uploaded (by Aaron Schulz):
Remove DB begin()/commit() from purgeExpired()

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

Change 260500 merged by jenkins-bot:
Remove DB begin()/commit() from purgeExpired()

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

Change 261747 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 260496 merged by jenkins-bot:
Remove DB begin()/commit() from adminSetHidden()

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

Change 261747 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 257746 merged by jenkins-bot:
Assorted transaction logic cleanups

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

Change 263851 had a related patch set uploaded (by Aaron Schulz):
Convert code to using startAtomic()/endAtomic()

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

Change 263854 had a related patch set uploaded (by Aaron Schulz):
Convert code to using startAtomic()/endAtomic()

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

Change 263860 had a related patch set uploaded (by Aaron Schulz):
Convert code to using startAtomic()/endAtomic()

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

Change 263862 had a related patch set uploaded (by Aaron Schulz):
Convert code to using startAtomic()/endAtomic()

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

Change 263854 merged by jenkins-bot:
Convert code to using startAtomic()/endAtomic()

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

Change 263860 merged by jenkins-bot:
Convert code to using startAtomic()/endAtomic()

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

Change 265624 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 265625 had a related patch set uploaded (by Aaron Schulz):
Remove begin()/commit() calls that can break outer transactions

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

Change 265627 had a related patch set uploaded (by Aaron Schulz):
Remove begin()/commit() calls that can break outer transactions

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

Change 265838 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 265839 had a related patch set uploaded (by Aaron Schulz):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 265838 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 265841 had a related patch set uploaded (by Aaron Schulz):
Remove begin()/commit() calls that can break outer transactions

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

Change 265842 had a related patch set uploaded (by Aaron Schulz):
Remove begin()/commit() calls that can break outer transactions

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

Change 265846 had a related patch set uploaded (by Aaron Schulz):
Remove begin()/commit() calls that can break outer transactions

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

Change 265624 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 265846 merged by jenkins-bot:
Remove begin()/commit() calls that can break outer transactions

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

Change 265842 merged by jenkins-bot:
Remove begin()/commit() calls that can break outer transactions

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

Change 265841 merged by jenkins-bot:
Remove begin()/commit() calls that can break outer transactions

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

Change 263851 merged by jenkins-bot:
Convert code to using startAtomic()/endAtomic()

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

Change 263862 merged by jenkins-bot:
Convert code to using startAtomic()/endAtomic()

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

aaron lowered the priority of this task from Medium to Low.Mar 24 2016, 7:53 PM

Change 282747 had a related patch set uploaded (by Aaron Schulz):
Convert begin/commit calls to (start|end)Atomic

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

Change 282825 had a related patch set uploaded (by Aaron Schulz):
Remove unneeded DB begin/commit calls

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

aaron closed this task as Resolved.Apr 11 2016, 11:04 PM

Change 282747 merged by jenkins-bot:
Convert begin/commit calls to (start|end)Atomic

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

Change 282825 merged by jenkins-bot:
Remove unneeded DB begin/commit calls

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

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptApr 20 2016, 12:02 AM

Change 265625 merged by Catrope:
Remove begin()/commit() calls that can break outer transactions

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

Change 265839 merged by jenkins-bot:
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 265627 merged by jenkins-bot:
Remove begin()/commit() calls that can break outer transactions

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

Change 312797 had a related patch set uploaded (by Paladox):
DB: Replace begin with startAtomic and commit with endAtomic

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

Change 312797 merged by jenkins-bot:
DB: Replace begin with startAtomic and commit with endAtomic

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

Change 312800 had a related patch set uploaded (by Paladox):
DB: Replace begin with startAtomic and commit with endAtomic

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

Change 312800 merged by jenkins-bot:
DB: Replace begin with startAtomic and commit with endAtomic

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

Change 312801 had a related patch set uploaded (by Paladox):
Remove begin()/commit() calls that can break outer transactions

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

Change 312802 had a related patch set uploaded (by Paladox):
Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 312802 merged by jenkins-bot:
[mediawiki/extensions/LiveTranslate@REL1_27] Replace DB begin()/commit() with startAtomic()/endAtomic() as needed

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

Change 312801 merged by Umherirrender:
[mediawiki/extensions/Survey@REL1_27] Remove begin()/commit() calls that can break outer transactions

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