We're ordering by img_timestamp, so we have to make sure MariaDB
queries `image` first. It sometimes decides to query `recentchanges`
first and filesort the result set later to get the right ordering.
This is probably <https://mariadb.atlassian.net/browse/MDEV-8880>.
Also added missing 'rc_namespace' condition.
Bug: T124205
Change-Id: Iad7c96ed452907db3b425a1a53ea098528b4dc23
function getQueryInfo() {
$conds = $jconds = [];
$tables = [ 'image' ];
function getQueryInfo() {
$conds = $jconds = [];
$tables = [ 'image' ];
if ( !$this->showBots ) {
$groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );
if ( !$this->showBots ) {
$groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );
$conds['rc_type'] = RC_LOG;
$conds['rc_log_type'] = 'upload';
$conds['rc_patrolled'] = 0;
$conds['rc_type'] = RC_LOG;
$conds['rc_log_type'] = 'upload';
$conds['rc_patrolled'] = 0;
+ $conds['rc_namespace'] = NS_FILE;
$jconds['recentchanges'] = [
'INNER JOIN',
[
$jconds['recentchanges'] = [
'INNER JOIN',
[
'rc_timestamp = img_timestamp'
]
];
'rc_timestamp = img_timestamp'
]
];
+ // We're ordering by img_timestamp, so we have to make sure MariaDB queries `image` first.
+ // It sometimes decides to query `recentchanges` first and filesort the result set later
+ // to get the right ordering. T124205 / https://mariadb.atlassian.net/browse/MDEV-8880
+ $options[] = 'STRAIGHT_JOIN';
}
if ( !$this->getConfig()->get( 'MiserMode' ) && $this->like !== null ) {
}
if ( !$this->getConfig()->get( 'MiserMode' ) && $this->like !== null ) {
'tables' => $tables,
'fields' => '*',
'join_conds' => $jconds,
'tables' => $tables,
'fields' => '*',
'join_conds' => $jconds,
+ 'conds' => $conds,
+ 'options' => $options,