[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Bypass wfGetDB when LoadBalancer is used in scope
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/405542 ) Change subject: Bypass wfGetDB when LoadBalancer is used in scope .. Bypass wfGetDB when LoadBalancer is used in scope wfGetDB calls LoadBalander::getConnection for $wiki=false, when there is already a LoadBalancer in scope, call it directly Change-Id: I4e29fd4e93a0d1f274e61af99c96021d3d06f8f3 --- M includes/page/WikiPage.php 1 file changed, 6 insertions(+), 4 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 788ae61..d403ab5 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -434,8 +434,9 @@ if ( is_int( $from ) ) { list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from ); - $data = $this->pageDataFromTitle( wfGetDB( $index ), $this->mTitle, $opts ); $loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer(); + $db = $loadBalancer->getConnection( $index ); + $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts ); if ( !$data && $index == DB_REPLICA @@ -444,7 +445,8 @@ ) { $from = self::READ_LATEST; list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from ); - $data = $this->pageDataFromTitle( wfGetDB( $index ), $this->mTitle, $opts ); + $db = $loadBalancer->getConnection( $index ); + $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts ); } } else { // No idea from where the caller got this data, assume replica DB. @@ -1426,7 +1428,7 @@ $baseRevId = null; if ( $edittime && $sectionId !== 'new' ) { $lb = MediaWikiServices::getInstance()->getDBLoadBalancer(); - $dbr = wfGetDB( DB_REPLICA ); + $dbr = $lb->getConnection( DB_REPLICA ); $rev = Revision::loadFromTimestamp( $dbr, $this->mTitle, $edittime ); // Try the master if this thread may have just added it. // This could be abstracted into a Revision method, but we don't want @@ -1435,7 +1437,7 @@ && $lb->getServerCount() > 1 && $lb->hasOrMadeRecentMasterChanges() ) { - $dbw = wfGetDB( DB_MASTER ); + $dbw = $lb->getConnection( DB_MASTER ); $rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime ); } if ( $rev ) { -- To view, visit https://gerrit.wikimedia.org/r/405542 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4e29fd4e93a0d1f274e61af99c96021d3d06f8f3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: UmherirrenderGerrit-Reviewer: Aaron Schulz Gerrit-Reviewer: WMDE-Fisch Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Bypass wfGetDB when LoadBalancer is used in scope
Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405542 ) Change subject: Bypass wfGetDB when LoadBalancer is used in scope .. Bypass wfGetDB when LoadBalancer is used in scope wfGetDB calls LoadBalander::getConnection for $wiki=false, when there is already a LoadBalancer in scope, call it directly Change-Id: I4e29fd4e93a0d1f274e61af99c96021d3d06f8f3 --- M includes/page/WikiPage.php 1 file changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/42/405542/1 diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 788ae61..d403ab5 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -434,8 +434,9 @@ if ( is_int( $from ) ) { list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from ); - $data = $this->pageDataFromTitle( wfGetDB( $index ), $this->mTitle, $opts ); $loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer(); + $db = $loadBalancer->getConnection( $index ); + $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts ); if ( !$data && $index == DB_REPLICA @@ -444,7 +445,8 @@ ) { $from = self::READ_LATEST; list( $index, $opts ) = DBAccessObjectUtils::getDBOptions( $from ); - $data = $this->pageDataFromTitle( wfGetDB( $index ), $this->mTitle, $opts ); + $db = $loadBalancer->getConnection( $index ); + $data = $this->pageDataFromTitle( $db, $this->mTitle, $opts ); } } else { // No idea from where the caller got this data, assume replica DB. @@ -1426,7 +1428,7 @@ $baseRevId = null; if ( $edittime && $sectionId !== 'new' ) { $lb = MediaWikiServices::getInstance()->getDBLoadBalancer(); - $dbr = wfGetDB( DB_REPLICA ); + $dbr = $lb->getConnection( DB_REPLICA ); $rev = Revision::loadFromTimestamp( $dbr, $this->mTitle, $edittime ); // Try the master if this thread may have just added it. // This could be abstracted into a Revision method, but we don't want @@ -1435,7 +1437,7 @@ && $lb->getServerCount() > 1 && $lb->hasOrMadeRecentMasterChanges() ) { - $dbw = wfGetDB( DB_MASTER ); + $dbw = $lb->getConnection( DB_MASTER ); $rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime ); } if ( $rev ) { -- To view, visit https://gerrit.wikimedia.org/r/405542 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4e29fd4e93a0d1f274e61af99c96021d3d06f8f3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits