Merge "rdbms: add ILBFactory::redefineLocalDomain method"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 26 Nov 2018 16:51:39 +0000 (16:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 26 Nov 2018 16:51:39 +0000 (16:51 +0000)
1  2 
includes/libs/rdbms/loadbalancer/LoadBalancer.php

@@@ -1281,11 -1281,6 +1281,11 @@@ class LoadBalancer implements ILoadBala
        }
  
        public function closeConnection( IDatabase $conn ) {
 +              if ( $conn instanceof DBConnRef ) {
 +                      // Avoid calling close() but still leaving the handle in the pool
 +                      throw new RuntimeException( __METHOD__ . ': got DBConnRef instance.' );
 +              }
 +
                $serverIndex = $conn->getLBInfo( 'serverIndex' );
                foreach ( $this->conns as $type => $connsByServer ) {
                        if ( !isset( $connsByServer[$serverIndex] ) ) {
                } );
        }
  
+       public function redefineLocalDomain( $domain ) {
+               $this->closeAll();
+               $this->setLocalDomain( DatabaseDomain::newFromId( $domain ) );
+       }
        /**
         * @param DatabaseDomain $domain
         */