From: Brad Jorsch Date: Tue, 6 Mar 2018 17:07:55 +0000 (-0500) Subject: Restore index forcing in ContribsPager X-Git-Tag: 1.31.0-rc.0~426^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=bac54c271c45be84bb0f832028413d8d5840c095;p=lhc%2Fweb%2Fwiklou.git Restore index forcing in ContribsPager For now at least this will avoid a filesort for some cases. But it might start misbehaving again when $wgActorTableSchemaMigrationStage is set to WRITE_BOTH or WRITE_NEW. Bug: T189026 Change-Id: Idd987181b17b824fdf1094f5c3b1c689b1792eb0 --- diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index cd0499551d..520e88dfd4 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -218,8 +218,18 @@ class ContribsPager extends RangeChronologicalPager { $queryInfo['conds'][] = $ipRangeConds; } else { // tables and joins are already handled by Revision::getQueryInfo() - $queryInfo['conds'][] = ActorMigration::newMigration() - ->getWhere( $this->mDb, 'rev_user', $user )['conds']; + $conds = ActorMigration::newMigration()->getWhere( $this->mDb, 'rev_user', $user ); + $queryInfo['conds'][] = $conds['conds']; + // Force the appropriate index to avoid bad query plans (T189026) + if ( count( $conds['orconds'] ) === 1 ) { + if ( isset( $conds['orconds']['actor'] ) ) { + // @todo: This will need changing when revision_comment_temp goes away + $queryInfo['options']['USE INDEX']['temp_rev_user'] = 'actor_timestamp'; + } else { + $queryInfo['options']['USE INDEX']['revision'] = + isset( $conds['orconds']['userid'] ) ? 'user_timestamp' : 'usertext_timestamp'; + } + } } }