Updated mediawiki/extensions
Project: mediawiki/extensions/ArticleFeedbackv5  6de8e4d4c70c9a405ae5c8661a1a9057f41e3a82

Add index for mycontribs hook

Lack of this index resulted in "most apache children were tied
up waiting on queries to the slave in that shard"

"I checked explains for a few of the queries and those that I
picked weren't covered by any index (i.e. searching for feedback
by ip address on aft_user_text which is unindexed) and all
included an ORDER BY + LIMIT.  Not bad if that's covered by an
index, not good if the query can't use one."

Query this index is meant for:

public function getContributionsData( $pager, $offset, $limit, $descending, $userIds = array() ) {
	$tables[] = 'aft_feedback';

	$fields[] = 'aft_id';
	$fields[] = 'aft_page';
	$fields[] = '"AFT" AS aft_contribution';
	$fields[] = 'aft_timestamp AS ' . $pager->getIndexField(); // used for navbar

	if ( $pager->contribs == 'newbie' ) {
		$conds['aft_user'] = $userIds;
	} else {
		$uid = User::idFromName( $pager->target );
		if ( $uid ) {
			$conds['aft_user'] = $uid;
		} else {
			$conds['aft_user'] = 0;
			$conds['aft_user_text'] = $pager->target;
		}
	}

	if ( $offset ) {
		$operator = $descending ? '>' : '<';
		$conds[] = "aft_timestamp $operator " . $pager->getDatabase()->addQuotes( $offset );
	}

	$order = $descending ? 'ASC' : 'DESC'; // something's wrong with $descending - see logic applied in includes/Pager.php
	$options['ORDER BY'] = array( $pager->getIndexField() . " $order" );
	$options['LIMIT'] = $limit;

	return $this->getDB( DB_SLAVE )->select( $tables, $fields, $conds, __METHOD__, $options, array() );
}

Change-Id: I330be208dc1e752a71339a97cd810dd6eaa4c4c6