filebackend: avoid use of IDatabase::clearFlags() in DBLockManager
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 30 Jul 2019 15:37:34 +0000 (11:37 -0400)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 30 Jul 2019 15:37:34 +0000 (11:37 -0400)
Change-Id: I143533790363d8bb9b9038cf320b251131602d4a

includes/libs/lockmanager/DBLockManager.php

index 5e8c22b..37d53e2 100644 (file)
@@ -150,12 +150,12 @@ abstract class DBLockManager extends QuorumLockManager {
                        } elseif ( is_array( $this->dbServers[$lockDb] ) ) {
                                // Parameters to construct a new database connection
                                $config = $this->dbServers[$lockDb];
+                               $config['flags'] = ( $config['flags'] ?? 0 );
+                               $config['flags'] &= ~( IDatabase::DBO_TRX | IDatabase::DBO_DEFAULT );
                                $db = Database::factory( $config['type'], $config );
                        } else {
                                throw new UnexpectedValueException( "No server called '$lockDb'." );
                        }
-
-                       $db->clearFlag( DBO_TRX );
                        # If the connection drops, try to avoid letting the DB rollback
                        # and release the locks before the file operations are finished.
                        # This won't handle the case of DB server restarts however.