Fix up replica/pos logging
authorChad Horohoe <chadh@wikimedia.org>
Wed, 1 Nov 2017 18:06:23 +0000 (11:06 -0700)
committerChad Horohoe <chadh@wikimedia.org>
Wed, 1 Nov 2017 18:06:41 +0000 (11:06 -0700)
Change-Id: I8670aef4a684c1c7f9bb510e7f2cc1530bdcfed0

includes/libs/rdbms/loadbalancer/LoadBalancer.php

index 1be8926..6bb8945 100644 (file)
@@ -603,8 +603,8 @@ class LoadBalancer implements ILoadBalancer {
                if ( $result == -1 || is_null( $result ) ) {
                        // Timed out waiting for replica DB, use master instead
                        $this->replLogger->warning(
-                               __METHOD__ . ": Timed out waiting on {host} pos {$this->mWaitForPos}",
-                               [ 'host' => $server ]
+                               __METHOD__ . ': Timed out waiting on {host} pos {pos}',
+                               [ 'host' => $server, 'pos' => $this->mWaitForPos ]
                        );
                        $ok = false;
                } else {
@@ -1640,16 +1640,18 @@ class LoadBalancer implements ILoadBalancer {
                if ( $pos instanceof DBMasterPos ) {
                        $result = $conn->masterPosWait( $pos, $timeout );
                        if ( $result == -1 || is_null( $result ) ) {
-                               $msg = __METHOD__ . ": Timed out waiting on {$conn->getServer()} pos {$pos}";
-                               $this->replLogger->warning( "$msg" );
+                               $msg = __METHOD__ . ': Timed out waiting on {host} pos {pos}';
+                               $this->replLogger->warning( $msg,
+                                       [ 'host' => $conn->getServer(), 'pos' => $pos ] );
                                $ok = false;
                        } else {
-                               $this->replLogger->info( __METHOD__ . ": Done" );
+                               $this->replLogger->info( __METHOD__ . ': Done' );
                                $ok = true;
                        }
                } else {
                        $ok = false; // something is misconfigured
-                       $this->replLogger->error( "Could not get master pos for {$conn->getServer()}." );
+                       $this->replLogger->error( 'Could not get master pos for {host}',
+                               [ 'host' => $conn->getServer() ] );
                }
 
                return $ok;