Fixing things the proper way

I short while ago one of our customers (through SkySQL) notified us of an unexpected problem in MySQL 5.5.25 regarding Query cache on partitioned tables.

Looking at the bug report (opened in 2010) one can see that the bug was marked in March 2012 as 'solved'. What was not made clear was that the solution was to disable the query cache for all partitioned tables.

Reading the bug report comments, I get the impression that the main reason for removing the feature was that the developers looking at the issue didn't really understand how the query cache works in detail and it was just easier to remove the feature than fixing it. (The problem was well understood but not how to fix it).

I talked this over with Sanja Byelkin, the creator of the query cache who now works on MariaDB, who concluded that this was a small issue and could easily be fixed.

'Easily' in this case was a 600 line patch (not including the test case) which added a new interface to the handler to register tables in a partition for the query cache.

One nice thing with his patch was that it allowed us to remove some MERGE table dependent code from the SQL level and move it to the MERGE storage engine code, where it should have been from the start. (In other words, the patch not only fixed a problem but also made the original code nicer and easier to maintain).

That is the proper way to fix a bug...

See also Daniel Bartholomew's blog about this.

The fix is in the MariaDB source repository and will be in MariaDB 5.5.27.