Upgrade premature implicit transaction commits to exceptions
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 21 Jul 2016 07:05:22 +0000 (00:05 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 4 Aug 2016 02:49:12 +0000 (02:49 +0000)
DBO_TRX transactions for the web request are now enforced.
WMF logs for implicit commit warnings are now silent after
the last round of patches.

Change-Id: If91633d192bfd9e137f8f868230d5040dea0ad45

includes/db/Database.php

index 3dc6e92..ba25183 100644 (file)
@@ -2642,13 +2642,13 @@ abstract class DatabaseBase implements IDatabase {
                                        "$fname: Transaction already in progress (from {$this->mTrxFname}), " .
                                                " performing implicit commit!"
                                );
-                       } else {
+                       } elseif ( $this->mTrxDoneWrites ) {
                                // The transaction was automatic and has done write operations
-                               if ( $this->mTrxDoneWrites ) {
-                                       wfLogDBError( "$fname: Automatic transaction with writes in progress" .
+                               throw new DBUnexpectedError(
+                                       $this,
+                                       "$fname: Automatic transaction with writes in progress" .
                                                " (from {$this->mTrxFname}), performing implicit commit!\n"
-                                       );
-                               }
+                               );
                        }
 
                        $this->runOnTransactionPreCommitCallbacks();