Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311932

Change subject: Use getConnectionRef() in ExternalStoreDB to avoid connection 
leaks
......................................................................

Use getConnectionRef() in ExternalStoreDB to avoid connection leaks

Change-Id: I3df270241653841a4fb2f65e240aae9d2e0b650f
---
M includes/externalstore/ExternalStoreDB.php
M includes/libs/rdbms/loadbalancer/LoadBalancer.php
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/32/311932/1

diff --git a/includes/externalstore/ExternalStoreDB.php 
b/includes/externalstore/ExternalStoreDB.php
index 2eae279..7e93299 100644
--- a/includes/externalstore/ExternalStoreDB.php
+++ b/includes/externalstore/ExternalStoreDB.php
@@ -130,7 +130,7 @@
                        wfDebug( "writable external store\n" );
                }
 
-               $db = $lb->getConnection( DB_REPLICA, [], $wiki );
+               $db = $lb->getConnectionRef( DB_REPLICA, [], $wiki );
                $db->clearFlag( DBO_TRX ); // sanity
 
                return $db;
@@ -146,7 +146,7 @@
                $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] 
: false;
                $lb = $this->getLoadBalancer( $cluster );
 
-               $db = $lb->getConnection( DB_MASTER, [], $wiki );
+               $db = $lb->getConnectionRef( DB_MASTER, [], $wiki );
                $db->clearFlag( DBO_TRX ); // sanity
 
                return $db;
diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php 
b/includes/libs/rdbms/loadbalancer/LoadBalancer.php
index 7ba21ac..7b3f42b 100644
--- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php
+++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php
@@ -644,6 +644,7 @@
                } else {
                        $server = $this->mServers[$i];
                        $server['serverIndex'] = $i;
+                       var_dump(1);
                        $conn = $this->reallyOpenConnection( $server, false );
                        $serverName = $this->getServerName( $i );
                        if ( $conn->isOpen() ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/311932
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3df270241653841a4fb2f65e240aae9d2e0b650f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to