From: Aaron Schulz Date: Fri, 12 Sep 2014 18:43:34 +0000 (-0700) Subject: Clear the DBO_TRX flag for sanity in ExternalStore X-Git-Tag: 1.31.0-rc.0~14057^2 X-Git-Url: https://git.cyclocoop.org/%20%27.%28%24debut%20%20%20%24par_page%29.%27?a=commitdiff_plain;h=086e17a37c6f35145bad0b27a6060d89fcfe7b12;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );