Warn when flushing inside an explicit transaction.
authordaniel <daniel.kinzler@wikimedia.de>
Tue, 16 Oct 2012 11:15:50 +0000 (13:15 +0200)
committerdaniel <daniel.kinzler@wikimedia.de>
Wed, 17 Oct 2012 09:31:12 +0000 (11:31 +0200)
Until now, commit() with the "flush" flag would just commit the
transaction, no questions ask. Flushing however should only apply
to automatic transactions.

Change-Id: I621f145902cfdf201206b42c49c160aeeaf0e4ba

includes/db/Database.php

index a942afe..48aac9d 100644 (file)
@@ -2992,6 +2992,12 @@ abstract class DatabaseBase implements DatabaseType {
                        } elseif( $this->mTrxAutomatic ) {
                                wfWarn( "$fname: Explicit commit of implicit transaction. Something may be out of sync!" );
                        }
+               } else {
+                       if ( !$this->mTrxLevel ) {
+                               return; // nothing to do
+                       } elseif( !$this->mTrxAutomatic ) {
+                               wfWarn( "$fname: Flushing an explicit transaction, getting out of sync!" );
+                       }
                }
 
                $this->doCommit( $fname );