Merge "filebackend: update code comments and break some long lines"
[lhc/web/wiklou.git] / includes / externalstore / ExternalStoreDB.php
index feb0614..4db351b 100644 (file)
@@ -154,19 +154,13 @@ class ExternalStoreDB extends ExternalStoreMedium {
         */
        public function getSlave( $cluster ) {
                $lb = $this->getLoadBalancer( $cluster );
-               $domainId = $this->getDomainId( $lb->getServerInfo( $lb->getWriterIndex() ) );
-
-               if ( !in_array( $cluster, $this->writableLocations, true ) ) {
-                       $this->logger->debug( "read only external store\n" );
-                       $lb->allowLagged( true );
-               } else {
-                       $this->logger->debug( "writable external store\n" );
-               }
-
-               $db = $lb->getConnectionRef( DB_REPLICA, [], $domainId );
-               $db->clearFlag( DBO_TRX ); // sanity
 
-               return $db;
+               return $lb->getConnectionRef(
+                       DB_REPLICA,
+                       [],
+                       $this->getDomainId( $lb->getServerInfo( $lb->getWriterIndex() ) ),
+                       $lb::CONN_TRX_AUTOCOMMIT
+               );
        }
 
        /**
@@ -177,12 +171,13 @@ class ExternalStoreDB extends ExternalStoreMedium {
         */
        public function getMaster( $cluster ) {
                $lb = $this->getLoadBalancer( $cluster );
-               $domainId = $this->getDomainId( $lb->getServerInfo( $lb->getWriterIndex() ) );
 
-               $db = $lb->getMaintenanceConnectionRef( DB_MASTER, [], $domainId );
-               $db->clearFlag( DBO_TRX ); // sanity
-
-               return $db;
+               return $lb->getMaintenanceConnectionRef(
+                       DB_MASTER,
+                       [],
+                       $this->getDomainId( $lb->getServerInfo( $lb->getWriterIndex() ) ),
+                       $lb::CONN_TRX_AUTOCOMMIT
+               );
        }
 
        /**