/**
  * 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 (session_id() == '' || $lb->getServerCount() <= 1) {
         return;
         // don't start a session; don't bother with non-replicated setups
     }
     $masterName = $lb->getServerName(0);
     if (isset($this->shutdownPositions[$masterName])) {
         return;
         // already done
     }
     // Only save the position if writes have been done on the connection
     $db = $lb->getAnyOpenConnection(0);
     $info = $lb->parentInfo();
     if (!$db || !$db->doneWrites()) {
         wfDebug(__METHOD__ . ": LB {$info['id']}, no writes done\n");
         return;
     }
     $pos = $db->getMasterPos();
     wfDebug(__METHOD__ . ": LB {$info['id']} has master pos {$pos}\n");
     $this->shutdownPositions[$masterName] = $pos;
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /**
  * Notify the ChronologyProtector that the LoadBalancer is about to shut
  * down. Saves replication positions.
  *
  * @param LoadBalancer $lb
  */
 function shutdownLB($lb)
 {
     if (session_id() != '' && $lb->getServerCount() > 1) {
         $masterName = $lb->getServerName(0);
         if (!isset($this->shutdownPos[$masterName])) {
             $pos = $lb->getMasterPos();
             $info = $lb->parentInfo();
             wfDebug(__METHOD__ . ": LB " . $info['id'] . " has master pos {$pos}\n");
             $this->shutdownPos[$masterName] = $pos;
         }
     }
 }