jenkins-bot has submitted this change and it was merged.

Change subject: Remove begin()/commit() calls that can break outer transactions
......................................................................


Remove begin()/commit() calls that can break outer transactions

The single statements are already atomic and will commit at
the end of the request in commitMasterChanges().

Bug: T120791
Change-Id: I4e91354a778eb66918b52567116df500ca2ccb84
---
M includes/Survey.class.php
1 file changed, 4 insertions(+), 9 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Survey.class.php b/includes/Survey.class.php
index 44c1b1f..2be2776 100644
--- a/includes/Survey.class.php
+++ b/includes/Survey.class.php
@@ -199,7 +199,7 @@
                
                $dbw = wfGetDB( DB_MASTER );
                
-               $dbw->begin( __METHOD__ );
+               $dbw->startAtomic( __METHOD__ );
 
                SurveyQuestion::update(
                        array( 'removed' => 1 ),
@@ -214,7 +214,7 @@
                        $success = $question->writeToDB() && $success;
                }
                
-               $dbw->commit( __METHOD__ );
+               $dbw->endAtomic( __METHOD__ );
                
                return $success;
        }
@@ -284,7 +284,7 @@
                
                $dbw = wfGetDB( DB_MASTER );
                
-               $dbw->begin( __METHOD__ );
+               $dbw->startAtomic( __METHOD__ );
                
                $sucecss = parent::removeFromDB();
                
@@ -303,14 +303,9 @@
                                'survey_answers',
                                array( 'answer_submission_id' => 
$submission->id )
                        ) && $sucecss;
-                       
-                       if ( $nr % 500 == 0 ) {
-                               $dbw->commit( __METHOD__ );
-                               $dbw->begin( __METHOD__ );
-                       }
                }
                
-               $dbw->commit( __METHOD__ );
+               $dbw->endAtomic( __METHOD__ );
                
                return $sucecss;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/265627
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e91354a778eb66918b52567116df500ca2ccb84
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Survey
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to