From f7d9a8b74c1e4e59eab68084183c2fd216bf8646 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 14 Jan 2014 20:14:17 -0800 Subject: [PATCH] Use regular slaves for user contribs parent revision queries Follows-up I65d8eb14c7ea1, I790f5b303fa2. Bug: 59987 Change-Id: I2265dc81835ccef5d74a043cb85400140b4160c2 --- includes/specials/SpecialContributions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 ); } -- 2.20.1