- π¨πSwitzerland berdir Switzerland
The order change makes sense, back to RTBC.
- π¬π§United Kingdom catch
Examples for #59. Let's assume we have one cache item, and one cache invalidation for
node:1
, and our one cache item is tagged withnode:1
If we clear cache bins before tags, then the following can happen:
1. Cache bins are cleared.
2. Cache miss happens, cache item is written with
node:1
having 1 invalidation - because cache tag invalidations haven't been purged yet.3. Cache invalidations are purged.
4. If
node:1
is invalidated before our cache item is requested, then we're back to 1 invalidation again, and the item could be considered valid.But if we purge cache tags before bins:
1. cache tags are purged
2. Any cache tagged cache items immediately become invalid if they assume any invalidations, because tag invalidations were reset.
3. Any new cache items get written as if there are no invalidations. Or with one invalidation if one happens during this (short) window.
4. But then, all the cache bins are emptied anyway, any new items, regardless of how many cache tag invalidations there are, will be valid.
Given that, purging tags first feels like it should be 100% correct as soon as the full cache clear is complete.
Added change record.
Also in converation with @catch on Slack, moved the `cachetags` table truncation before clearing the cache bins, because having entries in the cachetags table doesn't hurt anything, but there could be an issue if the cache bin tables do without corresponding checksums in cachetags. Pushing back to NR for that.