From da7f1649dde18bc3898375b82a561ee8e4472e74 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 22 Dec 2004 03:58:25 +0000 Subject: [PATCH] Fixing synchronisation bug: can't open a transaction before calling MASTER_POS_WAIT(), because you get consistent reads. Instead, we commit any open transaction, then call doQuery() directly, thereby avoiding re-opening it. --- includes/Database.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/Database.php b/includes/Database.php index 6cd4727ebe..68dad7332f 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -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]; -- 2.20.1