From: Aaron Schulz Date: Wed, 15 Jan 2014 04:14:17 +0000 (-0800) Subject: Use regular slaves for user contribs parent revision queries X-Git-Tag: 1.31.0-rc.0~17075^2 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=f7d9a8b74c1e4e59eab68084183c2fd216bf8646;p=lhc%2Fweb%2Fwiklou.git Use regular slaves for user contribs parent revision queries Follows-up I65d8eb14c7ea1, I790f5b303fa2. Bug: 59987 Change-Id: I2265dc81835ccef5d74a043cb85400140b4160c2 --- diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 6b56c2fa2a..1e79a11ebb 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -601,6 +601,9 @@ class ContribsPager extends ReverseChronologicalPager { public $mDb; public $preventClickjacking = false; + /** @var DatabaseBase */ + public $mDbSecondary; + /** * @var array */ @@ -637,6 +640,10 @@ class ContribsPager extends ReverseChronologicalPager { $month = isset( $options['month'] ) ? $options['month'] : false; $this->getDateCond( $year, $month ); + // Most of this code will use the 'contributions' group DB, which can map to slaves + // with extra user based indexes or partioning by user. The additional metadata + // queries should use a regular slave since the lookup pattern is not all by user. + $this->mDbSecondary = wfGetDB( DB_SLAVE ); // any random slave $this->mDb = wfGetDB( DB_SLAVE, 'contributions' ); } @@ -856,7 +863,7 @@ class ContribsPager extends ReverseChronologicalPager { $batch->add( $row->page_namespace, $row->page_title ); } } - $this->mParentLens = Revision::getParentLengths( $this->getDatabase(), $revIds ); + $this->mParentLens = Revision::getParentLengths( $this->mDbSecondary, $revIds ); $batch->execute(); $this->mResult->seek( 0 ); }