rdbms: add $flags argument to ILoadBalancer::getAnyOpenConnection
[lhc/web/wiklou.git] / includes / libs / rdbms / loadmonitor / LoadMonitor.php
index 3372839..c7f807a 100644 (file)
@@ -156,13 +156,14 @@ class LoadMonitor implements ILoadMonitor {
                                continue;
                        }
 
-                       $conn = $this->parent->getAnyOpenConnection( $i );
-                       if ( $conn && !$conn->trxLevel() ) {
-                               # Handles with open transactions are avoided since they might be subject
-                               # to REPEATABLE-READ snapshots, which could affect the lag estimate query.
+                       # Handles with open transactions are avoided since they might be subject
+                       # to REPEATABLE-READ snapshots, which could affect the lag estimate query.
+                       $flags = ILoadBalancer::CONN_TRX_AUTOCOMMIT;
+                       $conn = $this->parent->getAnyOpenConnection( $i, $flags );
+                       if ( $conn ) {
                                $close = false; // already open
                        } else {
-                               $conn = $this->parent->openConnection( $i, '' );
+                               $conn = $this->parent->openConnection( $i, ILoadBalancer::DOMAIN_ANY, $flags );
                                $close = true; // new connection
                        }