Don't use query groups for master connections
authorTim Starling <tstarling@users.mediawiki.org>
Tue, 8 Apr 2008 11:54:34 +0000 (11:54 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Tue, 8 Apr 2008 11:54:34 +0000 (11:54 +0000)
includes/LoadBalancer.php

index 891f301..52fe9c1 100644 (file)
@@ -364,7 +364,9 @@ class LoadBalancer {
                }
 
                # Query groups
-               if ( !is_array( $groups ) ) {
+               if ( $i == DB_MASTER ) { 
+                       $i = $this->getWriterIndex();
+               } elseif ( !is_array( $groups ) ) {
                        $groupIndex = $this->getReaderIndex( $groups, $wiki );
                        if ( $groupIndex !== false ) {
                                $serverName = $this->getServerName( $groupIndex );
@@ -386,8 +388,6 @@ class LoadBalancer {
                # Operation-based index
                if ( $i == DB_SLAVE ) {
                        $i = $this->getReaderIndex( false, $wiki );
-               } elseif ( $i == DB_MASTER ) {
-                       $i = $this->getWriterIndex();
                } elseif ( $i == DB_LAST ) {
                        # Just use $this->mLastIndex, which should already be set
                        $i = $this->mLastIndex;