protected function getLagFromPtHeartbeat() {
$masterInfo = $this->getMasterServerInfo();
if ( !$masterInfo ) {
+ wfLogDBError(
+ "Unable to query master of {db_server} for server ID",
+ $this->getLogContext( array(
+ 'method' => __METHOD__
+ ) )
+ );
+
return false; // could not get master server ID
}
return max( $nowUnix - $timeUnix, 0.0 );
}
+ wfLogDBError(
+ "Unable to find pt-heartbeat row for {db_server}",
+ $this->getLogContext( array(
+ 'method' => __METHOD__
+ ) )
+ );
+
return false;
}
$row = $this->fetchObject( $result );
if ( $row->lockstatus == 1 ) {
+ parent::lock( $lockName, $method, $timeout ); // record
return true;
- } else {
- wfDebug( __METHOD__ . " failed to acquire lock\n" );
-
- return false;
}
+
+ wfDebug( __METHOD__ . " failed to acquire lock\n" );
+
+ return false;
}
/**
$result = $this->query( "SELECT RELEASE_LOCK($lockName) as lockstatus", $method );
$row = $this->fetchObject( $result );
- return ( $row->lockstatus == 1 );
+ if ( $row->lockstatus == 1 ) {
+ parent::unlock( $lockName, $method ); // record
+ return true;
+ }
+
+ wfDebug( __METHOD__ . " failed to release lock\n" );
+
+ return false;
}
private function makeLockName( $lockName ) {