database: Move LoadBalancer::getConnection debugmsg to getReaderIndex
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 19 Feb 2015 21:24:26 +0000 (21:24 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 19 Feb 2015 21:24:26 +0000 (21:24 +0000)
Most of the time the early $this->mReadIndex inside getReaderIndex()
should be a hit, in which case this message isn't very useful.

This one message was filling up over 60% of the build logs (496/720 lines).
> LoadBalancer::getConnection: using server  for group ''

Move it to further down in getReaderIndex() where it actually
tries and finds one.

Change-Id: Id572f2bb3a905e095fcc929a9e2c17f40f7b1b6e

includes/db/LoadBalancer.php

index f357880..917d703 100644 (file)
@@ -331,6 +331,8 @@ class LoadBalancer {
                        if ( $this->mReadIndex <= 0 && $this->mLoads[$i] > 0 && $group === false ) {
                                $this->mReadIndex = $i;
                        }
+                       $serverName = $this->getServerName( $i );
+                       wfDebug( __METHOD__ . ": using server $serverName for group '$group'\n" );
                }
 
                return $i;
@@ -476,8 +478,6 @@ class LoadBalancer {
                        foreach ( $groups as $group ) {
                                $groupIndex = $this->getReaderIndex( $group, $wiki );
                                if ( $groupIndex !== false ) {
-                                       $serverName = $this->getServerName( $groupIndex );
-                                       wfDebug( __METHOD__ . ": using server $serverName for group '$group'\n" );
                                        $i = $groupIndex;
                                        break;
                                }