Page MenuHomePhabricator

mysql 5.5 / ansi sql incompatibility
Closed, DeclinedPublic

Description

Author: afeldman

Description:
This issue is a blocker on upgrading mysql on the cluster.

MySQL >= 5.5 does not allow:

SET "unsigned int col that = 0" + (-1) - it results in the following error:

Error 'BIGINT UNSIGNED value is out of range in '(enwiki.article_feedback_revisions.afr_total + -(1))'' on query. Default database: 'enwiki'. Query: 'UPDATE /* ApiArticleFeedback::insertRevisionRating */ article_feedback_revisions SET afr_total = afr_total + -1,afr_count = afr_count + 0 WHERE afr_page_id = '28184' AND afr_rating_id = '2' AND afr_revision = '531863378''

The row value at the time was:

mysql:root@localhost [enwiki]> select * from article_feedback_revisions WHERE afr_page_id = '28184' AND afr_rating_id = '2' AND afr_revision = '531863378';
+-------------+--------------+---------------+-----------+-----------+

afr_page_idafr_revisionafr_rating_idafr_totalafr_count

+-------------+--------------+---------------+-----------+-----------+

28184531863378201

+-------------+--------------+---------------+-----------+-----------+

If SQL_MODE is set to 'NO_UNSIGNED_SUBTRACTION' the behavior is more compatible with prior versions of mysql, however:

SET "unsigned int col that = 0" + (-1)

is still illegal, though:

SET "unsigned int col that = 0" - 1

becomes legal.


Version: master
Severity: major
Whiteboard: wikimedia[unmaintained]

Details

Reference
bz43847

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:35 AM
bzimport added a project: ArticleFeedback.
bzimport set Reference to bz43847.

preilly wrote:

logmsgbot: !log preilly synchronized php-1.21wmf9/extensions/ArticleFeedback 'fix mysql 5.5 / ansi sql incompatibility'
[2:11pm] morebots: Logged the message, Master
[2:11pm] Krenair_ joined the chat room.
[2:11pm] AaronSchulz: preilly: \o/

py wrote:

hi,

there is another issues that popped up on this today. specifically, afr_count decrimented instead of incrementing. see below error. could you please take a look at this? it's breaking replication on mariadb slaves still, including db1047 which is used for research purposes.

thanks!

Error 'BIGINT UNSIGNED value is out of range in '(enwiki.article_feedback_revisions.afr_total + -(5))'' on query. Default database: 'enwiki'. Query: 'UPDATE /* ApiArticleFeedback::insertRevisionRating 199.254.110.29 */ article_feedback_revisions SET afr_total = GREATEST( afr_total + -5, 0 ),afr_count = afr_count + -1 WHERE afr_page_id = '321080' AND afr_rating_id = '1' AND afr_revision = '540378393''

New patch at: https://gerrit.wikimedia.org/r/#/c/51356/

Even though the GREATEST will make sure no negative value was going to be inserted in the unsigned columns, it is not even possible to subtract a value resulting in a negative value from a signed value.
Another patch will now cast the column's value to signed, to ensure the subtraction does not fail, then the greatest will make sure no negative value is stored.

The extension homepage at [[mw:Extension:ArticleFeedback]] says
"This extension has been archived. This extension has not been maintained in some time, and no longer supports recent releases of MediaWiki.
The following other choices are still available: [[mw:Extension:ArticleFeedbackv5]]"

Furthermore, ArticleFeedback (version 4 or earlier) was removed from all Wikimedia wikis in https://gerrit.wikimedia.org/r/#/c/98074/

It is currently unlikely that there will be any further active development of ArticleFeedback (version 4 or earlier).
Closing this report as WONTFIX to reflect reality.
Please feel free to reopen this report in the future if anyone takes the responsibility for active development of ArticleFeedback (version 4 or earlier) again.

Thank you for reporting this bug and we are sorry it could not be fixed.

Change 51356 abandoned by Matthias Mullie:
Bug 43847 - mysql 5.5 / ansi sql incompatibility

Reason:
AFT is unmaintained, these patches are not going to get reviewed

https://gerrit.wikimedia.org/r/51356