/**
  * Notify the ChronologyProtector that the LoadBalancer is about to shut
  * down. Saves replication positions.
  *
  * @param LoadBalancer $lb
  * @return void
  */
 public function shutdownLB(LoadBalancer $lb)
 {
     if (!$this->enabled || $lb->getServerCount() <= 1) {
         return;
         // non-replicated setup or disabled
     }
     $info = $lb->parentInfo();
     $masterName = $lb->getServerName($lb->getWriterIndex());
     // Only save the position if writes have been done on the connection
     $db = $lb->getAnyOpenConnection($lb->getWriterIndex());
     if (!$db || !$db->doneWrites()) {
         wfDebugLog('replication', __METHOD__ . ": LB {$info['id']}, no writes done\n");
         return;
         // nothing to do
     }
     $pos = $db->getMasterPos();
     wfDebugLog('replication', __METHOD__ . ": LB {$info['id']} has master pos {$pos}\n");
     $this->shutdownPositions[$masterName] = $pos;
 }
 private function getLagTimeCacheKey()
 {
     $writerIndex = $this->parent->getWriterIndex();
     // Lag is per-server, not per-DB, so key on the master DB name
     return $this->srvCache->makeGlobalKey('lag-times', $this->parent->getServerName($writerIndex));
 }