Removed unmatched commits in Job class.
authordaniel <daniel.kinzler@wikimedia.de>
Mon, 27 Aug 2012 12:41:15 +0000 (14:41 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Mon, 27 Aug 2012 12:41:15 +0000 (14:41 +0200)
Job had two calls to commit() that did not correspond to any
call to begin(). This may prematurely about any "outer" transaction,
may cause database corruption, and trigger warnings. There did not
seem to be any good reason for these commits to be there.

Sorting out unmatched begin/commit calls is important to allow the
addition of support for nested transactions, and it also helps
with finding "interesting" database problems.

Change-Id: Iff394f97fbad6e9304d75e6ad69155ada80b9c33

includes/job/Job.php

index d7c9563..45f0570 100644 (file)
@@ -153,7 +153,6 @@ abstract class Job {
                $dbw = wfGetDB( DB_MASTER );
                $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ );
                $affected = $dbw->affectedRows();
-               $dbw->commit( __METHOD__ );
 
                if ( !$affected ) {
                        // Failed, someone else beat us to it
@@ -177,7 +176,6 @@ abstract class Job {
                        // Delete the random row
                        $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ );
                        $affected = $dbw->affectedRows();
-                       $dbw->commit( __METHOD__ );
 
                        if ( !$affected ) {
                                // Random job gone before we exclusively deleted it