Merge "Revert "Show a "(blocked)" hint on Special:ListUsers/ActiveUsers""
[lhc/web/wiklou.git] / includes / db / LoadBalancer.php
index 195d4ec..46d24fc 100644 (file)
@@ -41,6 +41,7 @@ class LoadBalancer {
         *    servers           Required. Array of server info structures.
         *    masterWaitTimeout Replication lag wait timeout
         *    loadMonitor       Name of a class used to fetch server lag and load.
+        * @throws MWException
         */
        function __construct( $params ) {
                if ( !isset( $params['servers'] ) ) {
@@ -197,6 +198,7 @@ class LoadBalancer {
         * Side effect: opens connections to databases
         * @param $group bool
         * @param $wiki bool
+        * @throws MWException
         * @return bool|int|string
         */
        function getReaderIndex( $group = false, $wiki = false ) {
@@ -452,8 +454,9 @@ class LoadBalancer {
         *
         * @param $i Integer: server index
         * @param $groups Array: query groups
-        * @param $wiki String: wiki ID
+        * @param bool|string $wiki Wiki ID
         *
+        * @throws MWException
         * @return DatabaseBase
         */
        public function &getConnection( $i, $groups = array(), $wiki = false ) {
@@ -520,6 +523,7 @@ class LoadBalancer {
         * the same number of times as getConnection() to work.
         *
         * @param DatabaseBase $conn
+        * @throws MWException
         */
        public function reuseConnection( $conn ) {
                $serverIndex = $conn->getLBInfo('serverIndex');
@@ -692,6 +696,7 @@ class LoadBalancer {
         *
         * @param $server
         * @param $dbNameOverride bool
+        * @throws MWException
         * @return DatabaseBase
         */
        function reallyOpenConnection( $server, $dbNameOverride = false ) {
@@ -902,7 +907,9 @@ class LoadBalancer {
                foreach ( $this->mConns as $conns2 ) {
                        foreach ( $conns2 as $conns3 ) {
                                foreach ( $conns3 as $conn ) {
-                                       $conn->commit( __METHOD__ );
+                                       if ( $conn->trxLevel() ) {
+                                               $conn->commit( __METHOD__, 'flush' );
+                                       }
                                }
                        }
                }
@@ -920,7 +927,7 @@ class LoadBalancer {
                        }
                        foreach ( $conns2[$masterIndex] as $conn ) {
                                if ( $conn->trxLevel() && $conn->doneWrites() ) {
-                                       $conn->commit( __METHOD__ );
+                                       $conn->commit( __METHOD__, 'flush' );
                                }
                        }
                }