From 086e17a37c6f35145bad0b27a6060d89fcfe7b12 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 12 Sep 2014 11:43:34 -0700 Subject: [PATCH] Clear the DBO_TRX flag for sanity in ExternalStore * This avoids an explicit commit of an implicit transaction when the site config for the ES cluster does not clear that flag by mistake. Change-Id: I57d8b04cbf3249849db1643fc82673e9de8ea15b --- includes/externalstore/ExternalStoreDB.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/includes/externalstore/ExternalStoreDB.php b/includes/externalstore/ExternalStoreDB.php index 5774a24c78..952bf63b25 100644 --- a/includes/externalstore/ExternalStoreDB.php +++ b/includes/externalstore/ExternalStoreDB.php @@ -96,9 +96,6 @@ class ExternalStoreDB extends ExternalStoreMedium { if ( !$id ) { throw new MWException( __METHOD__ . ': no insert ID' ); } - if ( $dbw->getFlag( DBO_TRX ) ) { - $dbw->commit( __METHOD__ ); - } return "DB://$cluster/$id"; } @@ -134,7 +131,10 @@ class ExternalStoreDB extends ExternalStoreMedium { wfDebug( "writable external store\n" ); } - return $lb->getConnection( DB_SLAVE, array(), $wiki ); + $db = $lb->getConnection( DB_SLAVE, array(), $wiki ); + $db->clearFlag( DBO_TRX ); // sanity + + return $db; } /** @@ -147,7 +147,10 @@ class ExternalStoreDB extends ExternalStoreMedium { $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false; $lb = $this->getLoadBalancer( $cluster ); - return $lb->getConnection( DB_MASTER, array(), $wiki ); + $db = $lb->getConnection( DB_MASTER, array(), $wiki ); + $db->clearFlag( DBO_TRX ); // sanity + + return $db; } /** @@ -282,6 +285,10 @@ class ExternalStoreDB extends ExternalStoreMedium { } } + /** + * @param string $url + * @return array + */ protected function parseURL( $url ) { $path = explode( '/', $url ); -- 2.20.1