Make newExternalLB() public to match newMainLB()
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Sep 2016 05:24:08 +0000 (22:24 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Sep 2016 05:51:05 +0000 (22:51 -0700)
Change-Id: I7e46c947882c5de6e4d25a7110c2a2558df7ad76

includes/libs/rdbms/lbfactory/LBFactory.php
includes/libs/rdbms/lbfactory/LBFactoryMulti.php
includes/libs/rdbms/lbfactory/LBFactorySimple.php
includes/libs/rdbms/lbfactory/LBFactorySingle.php

index aa932aa..fd89f33 100644 (file)
@@ -157,6 +157,11 @@ abstract class LBFactory {
         * Create a new load balancer object. The resulting object will be untracked,
         * not chronology-protected, and the caller is responsible for cleaning it up.
         *
+        * This method is for only advanced usage and callers should almost always use
+        * getMainLB() instead. This method can be useful when a table is used as a key/value
+        * store. In that cases, one might want to query it in autocommit mode (DBO_TRX off)
+        * but still use DBO_TRX transaction rounds on other tables.
+        *
         * @param bool|string $domain Domain ID, or false for the current domain
         * @return ILoadBalancer
         */
@@ -175,11 +180,16 @@ abstract class LBFactory {
         * untracked, not chronology-protected, and the caller is responsible for
         * cleaning it up.
         *
+        * This method is for only advanced usage and callers should almost always use
+        * getExternalLB() instead. This method can be useful when a table is used as a
+        * key/value store. In that cases, one might want to query it in autocommit mode
+        * (DBO_TRX off) but still use DBO_TRX transaction rounds on other tables.
+        *
         * @param string $cluster External storage cluster, or false for core
         * @param bool|string $domain Domain ID, or false for the current domain
         * @return ILoadBalancer
         */
-       abstract protected function newExternalLB( $cluster, $domain = false );
+       abstract public function newExternalLB( $cluster, $domain = false );
 
        /**
         * Get a cached (tracked) load balancer for external storage
index 25e1fe0..6993dac 100644 (file)
@@ -261,7 +261,7 @@ class LBFactoryMulti extends LBFactory {
         * @throws InvalidArgumentException
         * @return LoadBalancer
         */
-       protected function newExternalLB( $cluster, $domain = false ) {
+       public function newExternalLB( $cluster, $domain = false ) {
                if ( !isset( $this->externalLoads[$cluster] ) ) {
                        throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"" );
                }
index 4ed4347..610052f 100644 (file)
@@ -97,7 +97,7 @@ class LBFactorySimple extends LBFactory {
         * @return LoadBalancer
         * @throws InvalidArgumentException
         */
-       protected function newExternalLB( $cluster, $domain = false ) {
+       public function newExternalLB( $cluster, $domain = false ) {
                if ( !isset( $this->externalClusters[$cluster] ) ) {
                        throw new InvalidArgumentException( __METHOD__ . ": Unknown cluster \"$cluster\"." );
                }
index 4beb5d8..af4a350 100644 (file)
@@ -73,7 +73,7 @@ class LBFactorySingle extends LBFactory {
         * @param bool|string $wiki Wiki ID, or false for the current wiki
         * @return LoadBalancerSingle
         */
-       protected function newExternalLB( $cluster, $wiki = false ) {
+       public function newExternalLB( $cluster, $wiki = false ) {
                return $this->lb;
        }