コード例 #1
0
ファイル: LoadMonitor.php プロジェクト: paladox/mediawiki
 private function getCacheKey(array $serverIndexes)
 {
     sort($serverIndexes);
     // Lag is per-server, not per-DB, so key on the master DB name
     return $this->srvCache->makeGlobalKey('lag-times', self::VERSION, $this->parent->getServerName($this->parent->getWriterIndex()), implode('-', $serverIndexes));
 }
コード例 #2
0
ファイル: DBConnRef.php プロジェクト: paladox/mediawiki
 /**
  * Clean up the connection when out of scope
  */
 function __destruct()
 {
     if ($this->conn !== null) {
         $this->lb->reuseConnection($this->conn);
     }
 }
コード例 #3
0
 /**
  * Notify the ChronologyProtector that the ILoadBalancer is about to shut
  * down. Saves replication positions.
  *
  * @param ILoadBalancer $lb
  * @return void
  */
 public function shutdownLB(ILoadBalancer $lb)
 {
     if (!$this->enabled) {
         return;
         // not enabled
     } elseif (!$lb->hasOrMadeRecentMasterChanges(INF)) {
         // Only save the position if writes have been done on the connection
         return;
     }
     $masterName = $lb->getServerName($lb->getWriterIndex());
     if ($lb->getServerCount() > 1) {
         $pos = $lb->getMasterPos();
         $this->logger->info(__METHOD__ . ": LB for '{$masterName}' has pos {$pos}\n");
         $this->shutdownPositions[$masterName] = $pos;
     } else {
         $this->logger->info(__METHOD__ . ": DB '{$masterName}' touched\n");
     }
     $this->shutdownTouchDBs[$masterName] = 1;
 }
コード例 #4
0
ファイル: LBFactory.php プロジェクト: paladox/mediawiki
 /**
  * @param ILoadBalancer $lb
  */
 protected function initLoadBalancer(ILoadBalancer $lb)
 {
     if ($this->trxRoundId !== false) {
         $lb->beginMasterChanges($this->trxRoundId);
         // set DBO_TRX
     }
 }