Exemple #1
0
 $dc = $sphinxLog->getDc();
 $executedServerId = $sphinxLog->getExecutedServerId();
 $sphinxLogId = $sphinxLog->getId();
 $serverLastLog = null;
 if (isset($lastLogs[$dc])) {
     $serverLastLog = $lastLogs[$dc];
 } else {
     $serverLastLog = new SphinxLogServer();
     $serverLastLog->setServer($sphinxServer);
     $serverLastLog->setDc($dc);
     $lastLogs[$dc] = $serverLastLog;
 }
 $handledRecords[$dc][] = $sphinxLogId;
 KalturaLog::log("Sphinx log id {$sphinxLogId} dc [{$dc}] executed server id [{$executedServerId}] Memory: [" . memory_get_usage() . "]");
 try {
     if ($skipExecutedUpdates && $executedServerId == $serverLastLog->getId()) {
         KalturaLog::log("Sphinx server is initiated and the command already ran synchronously on this machine. Skipping");
     } else {
         $sql = $sphinxLog->getSql();
         $affected = $sphinxCon->exec($sql);
         if (!$affected) {
             $errorInfo = $sphinxCon->errorInfo();
         }
     }
     // If the record is an historical record, don't take back the last log id
     if ($serverLastLog->getLastLogId() < $sphinxLogId) {
         $serverLastLog->setLastLogId($sphinxLogId);
         // Clear $handledRecords from before last - gap.
         foreach ($serverLastLogs as $serverLastLog) {
             $dc = $serverLastLog->getDc();
             $threshold = $serverLastLog->getLastLogId() - $gap;
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      SphinxLogServer $value A SphinxLogServer object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(SphinxLogServer $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      SphinxLogServer $value A SphinxLogServer object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(SphinxLogServer $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('SphinxLogServerPeer');
         }
     }
 }