[MXS-1270] MaxScale v2.1.2 Read Cache is not discarded after update/insert Created: 2017-05-19 Updated: 2017-05-23 Resolved: 2017-05-22 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | cache |
| Affects Version/s: | 2.1.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Sven Abels | Assignee: | Johan Wikman |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04 within Docker (Swarm Mode, v17.05) |
||
| Issue Links: |
|
||||||||
| Description |
|
We used the new cache filter of MaxScale with v2.1.2 in combination with thew readwritesplit and 3 servcers (but we also tested it with readconnroute and only 1 server with the same result). We got an old script which updates a value in a mySQL table and afterwards it selects a sum where this value is used in a join. The result is that the sum still delivers the old value from the MaxScale cache. Afterwards, even when reloading the whole webpage with a fresh select, the statement is still outdated until the cache TTL is passed or until we restart MaxScale. Shouldn't the cache data for this stable/query be discarded by MaxScale automatically after an update/insert? Our cache config is:
the script causing this problem is a bit durty but easy to read:
|
| Comments |
| Comment by markus makela [ 2017-05-21 ] | |
|
This is a current limitation in the cache filter: https://mariadb.com/kb/en/mariadb-enterprise/cache/#invalidation | |
| Comment by Johan Wikman [ 2017-05-22 ] | |
|
If invalidation is important then there is a workaround that may or may not work for you. As the cache is shared by all users, but specific users can be exempted from being served cached data, if you, after an insert or an update, fetch the data using a user for whom data is not cached, then the data in the cache will be refreshed for all. | |
| Comment by Johan Wikman [ 2017-05-22 ] | |
|
Closing as this is documented behavior. | |
| Comment by Sven Abels [ 2017-05-22 ] | |
|
Thanks a lot for pointing me to this. | |
| Comment by Johan Wikman [ 2017-05-23 ] | |
|
Btw, have you considered whether you can have
in your configuration? https://mariadb.com/kb/en/mariadb-enterprise/cache/#selects Namely, if you can, it gives a significant performance boost. | |
| Comment by Sven Abels [ 2017-05-23 ] | |
|
@Johan: Thanks for the tip. However, unfortunately, we cannot avoid that the app writes from time to time and exempting a user for all read parts would work but then we would loose the speed of the cache completely. So it looks like we can't really use the cache feature - or only for a very small number of scenarios - until the automatic cache invalidation is available. |