ContibsPager: Fix slow query with actor migration read-new mode
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 15 Apr 2019 14:41:03 +0000 (10:41 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Mon, 15 Apr 2019 17:02:19 +0000 (13:02 -0400)
The change in I1678f7ec broke the workaround in I992aa50f by adding
the rev_id column to the ORDER BY clause. We need to extend the aliasing
to rev_id => revactor_rev to re-fix it.

Bug: T220991
Change-Id: I62dc3803621da982e526d7402ab8e7b08f8336bc

includes/specials/pagers/ContribsPager.php

index 10fcfc6..44ecb6f 100644 (file)
@@ -301,11 +301,12 @@ class ContribsPager extends RangeChronologicalPager {
                                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';
-                                       // Alias 'rev_timestamp' => 'revactor_timestamp' so "ORDER BY rev_timestamp" is interpreted to
-                                       // use revactor_timestamp instead.
+                                       // Alias 'rev_timestamp' => 'revactor_timestamp' and 'rev_id' => 'revactor_rev' so
+                                       // "ORDER BY rev_timestamp, rev_id" is interpreted to use denormalized revision_actor_temp
+                                       // fields instead.
                                        $queryInfo['fields'] = array_merge(
-                                               array_diff( $queryInfo['fields'], [ 'rev_timestamp' ] ),
-                                               [ 'rev_timestamp' => 'revactor_timestamp' ]
+                                               array_diff( $queryInfo['fields'], [ 'rev_timestamp', 'rev_id' ] ),
+                                               [ 'rev_timestamp' => 'revactor_timestamp', 'rev_id' => 'revactor_rev' ]
                                        );
                                } else {
                                        $queryInfo['options']['USE INDEX']['revision'] =