Fixing synchronisation bug: can't open a transaction before calling MASTER_POS_WAIT...
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 22 Dec 2004 03:58:25 +0000 (03:58 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 22 Dec 2004 03:58:25 +0000 (03:58 +0000)
includes/Database.php

index 6cd4727..68dad73 100644 (file)
@@ -1236,9 +1236,17 @@ class Database {
         * @param integer $timeout the maximum number of seconds to wait for synchronisation
         */
        function masterPosWait( $file, $pos, $timeout ) {
+               $fname = 'Database::masterPosWait';
+               wfProfileIn( $fname );
+               
+               
+               # Commit any open transactions
+               $this->immediateCommit();
+               
+               # Call doQuery() directly, to avoid opening a transaction if DBO_TRX is set
                $encFile = $this->strencode( $file );
                $sql = "SELECT MASTER_POS_WAIT('$encFile', $pos, $timeout)";
-               $res = $this->query( $sql, 'Database::masterPosWait' );
+               $res = $this->doQuery( $sql );
                if ( $res && $row = $this->fetchRow( $res ) ) {
                        $this->freeResult( $res );
                        return $row[0];