[MDEV-27063] Query Cache Corruption Created: 2021-11-16 Updated: 2021-11-18 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Query Cache |
| Affects Version/s: | 10.5.13 |
| Fix Version/s: | 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Chris Heath | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Rocky Linux 8.4, php 7.3, perl 5.26.3, mariadb 10.5.9 |
||
| Description |
|
When I connect to mariadb with different clients, cached query results are sometimes returned in the wrong format. I have a mariadb 10.5.9 database, with the following clients connecting to it: 1. A php client that connects with an old mysqli driver. It sets client capability flags 0x1AA284 and charset latin1 2. A perl client that connects DBD::Mysql (using libmariadb 3.1.11 under the hood). It sets client capability flags 0xD00BFA20C and charset latin1 3. The mysql command line client that comes with Rocky mariadb package (statically compiled with libmariadb 3.1.12). It sets client capability flags 0xD00BFA20E and charset utf8. If I run the same query in all 3 clients in the above order, php succeeds, perl gets "Unknown Error", and cli succeeds. After I do "FLUSH TABLES", perl client works fine. It appears the query cache needs to key off the MARIADB_CLIENT_EXTENDED_METADATA flag. I believe the command line client succeeds because it connects with a different charset. I have also tested with mariadb 10.5.13 RPM downloaded from mariadb.org. Setting query_cache_size = 0 in my.cnf works around the issue. How to reproduce:
In php:
Then in perl:
Result:
|
| Comments |
| Comment by Sergei Golubchik [ 2021-11-18 ] |
|
Note, there's a newer flag MARIADB_CLIENT_CACHE_METADATA, it might need to be part of the key too. May be it'd be more future proof to add to the key all flag bits, like ~0, and remove those that we know are safe? Then new flags won't break query cache. |