Revert "objectcache: detect default getWithSetCallback() set options"
[lhc/web/wiklou.git] / includes / libs / rdbms / loadbalancer / LoadBalancer.php
index 61359bc..d42fed9 100644 (file)
@@ -94,11 +94,9 @@ class LoadBalancer implements ILoadBalancer {
        /** @var string Current server name */
        private $host;
        /** @var bool Whether this PHP instance is for a CLI script */
-       private $cliMode;
+       protected $cliMode;
        /** @var string Agent name for query profiling */
-       private $agent;
-       /** @var bool[] Map of (section ID => true) for usage section IDs */
-       private $usageSections = [];
+       protected $agent;
 
        /** @var callable Exception logger */
        private $errorLogger;
@@ -866,10 +864,6 @@ class LoadBalancer implements ILoadBalancer {
                        }
                }
 
-               foreach ( $this->usageSections as $id => $unused ) {
-                       $db->declareUsageSectionStart( $id );
-               }
-
                return $db;
        }
 
@@ -1528,40 +1522,6 @@ class LoadBalancer implements ILoadBalancer {
                } );
        }
 
-       public function declareUsageSectionStart( $id = null ) {
-               static $nextId = 1;
-               if ( $id === null ) {
-                       $id = $nextId;
-                       ++$nextId;
-               }
-               // Handle existing connections
-               $this->forEachOpenConnection( function ( IDatabase $db ) use ( $id ) {
-                       $db->declareUsageSectionStart( $id );
-               } );
-               // Remember to set this for new connections
-               $this->usageSections[$id] = true;
-
-               return $id;
-       }
-
-       public function declareUsageSectionEnd( $id ) {
-               $info = [ 'readQueries' => 0, 'writeQueries' => 0, 'cacheSetOptions' => null ];
-               $this->forEachOpenConnection( function ( IDatabase $db ) use ( $id, &$info ) {
-                       $dbInfo = $db->declareUsageSectionEnd( $id );
-                       $info['readQueries'] += $dbInfo['readQueries'];
-                       $info['writeQueries'] += $dbInfo['writeQueries'];
-                       $dbCacheOpts = $dbInfo['cacheSetOptions'];
-                       if ( $dbCacheOpts ) {
-                               $info['cacheSetOptions'] = $info['cacheSetOptions']
-                                       ? Database::mergeCacheSetOptions( $info['cacheSetOptions'], $dbCacheOpts )
-                                       : $dbCacheOpts;
-                       }
-               } );
-               unset( $this->usageSections[$id] );
-
-               return $info;
-       }
-
        /**
         * Make PHP ignore user aborts/disconnects until the returned
         * value leaves scope. This returns null and does nothing in CLI mode.