{"shas":[["3354f321e339f53fd38f0d3de8771d3fe323528c","7d829d5dfb5fe1dd7ae60577c4f5662c0bd636e0@dd0e9695-b195-4be7-bd10-2dea1a65a6b6","Epic followup to r94404, r94509: change the ArticleFeedback schema such that locking is no longer necessary. This should fix the counter drift problems, too. Thanks to Tim for pointing me in this direction.\n\n* Change the schema of article_feedback to no longer have a primary key that ensures one rating per user per revision, but to have a primary key on the auto-incremented field aa_id instead\n** This allows multiple ratings per user per revision in the article_feedback table, which makes the counter drift fix possible\n** This schema change is so radical that the patch has to create another table with the new schema, copy the data over, and swap the tables\n* Changed ApiArticleFeedback::insertUserRatings() to insert all the ratings rows at once, using one query. This ensures they get consecutive aa_id values\n* Moved the SELECT in ApiArticleFeedback after the insertUserRatings() call, and added an \"aa_id < $id\" clause so it always looks at the rating set right before the one that was just inserted, even if another thread has already inserted another rating set in the meantime. This ensures that each rating delta is handled by exactly one thread, which should fix counter drift.\n* Removed the useless and broken behavior of decrementing values in article_feedback_revisions. It was implemented inconsistently and never worked properly for that reason. This makes insertRevisionRating() much simpler\n* Due to the insertRevisionRating() change. $lastRevision is no longer needed. To properly update the revision delta, though, we still need to look at whether the previous rating's revid matches this one's, and only take that rating into account if it does. The previous logic was probably broken and, now that I think about it, was probably the cause of all the weird behavior, but it's too late to go back now. I'll patch 1.17wmf1 for just this problem later, see if that helps\n* Take this opportunity to redo the indexes on article_feedback so the queries run on it are actually indexed properly. Also drop useless aa_user_id conditions from queries.\n\n\n\ngit-svn-id: svn+ssh://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions@96722 dd0e9695-b195-4be7-bd10-2dea1a65a6b6","catrope"]],"ref":"refs/heads/master","size":1,"head":"3354f321e339f53fd38f0d3de8771d3fe323528c","push_id":42283635}