From: Tim Starling Date: Wed, 22 Dec 2004 03:58:25 +0000 (+0000) Subject: Fixing synchronisation bug: can't open a transaction before calling MASTER_POS_WAIT... X-Git-Tag: 1.5.0alpha1~1056 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=da7f1649dde18bc3898375b82a561ee8e4472e74;p=lhc%2Fweb%2Fwiklou.git 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. --- 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];