decred / politeia

ISC License
110 stars 75 forks source link

mysql/mariadb select statement bug on mac #1664

Closed lukebp closed 2 years ago

lukebp commented 2 years ago

tiago encountered a very tricky bug when working with the legacy git backend proposal data (#1632). It caused us quite a bit of headaches, so I'm documenting it here for future reference. It appears to only impact mac users. This is not a politeia bug.

When running mariadb on a mac, the results returned from a select query were dependant on the size of the select statement. These are the results that were returned for the exact same keys, but using different sized select statements. The query that was run was to retrieve the key-value store entries for 14,440 proposal votes.

b7f8a71d4 set a limit on the maximum number of placeholders that a select statement can contain based on the maximum allowed by MySQL. A workaround for this bug was to update this variable only allow 10 placeholders per select statement.

This bug was not encountered until recently because mainnet proposals with thousands of votes are the only time where these large select statements are going to be used and this issue appears to only be present on macs.