コード例 #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
 /**
  * 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;
 }