Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Multilevel adapter apply deletes in reverse order #174

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

martosaur
Copy link
Contributor

This PR changes the order of delete operations in the Multilevel adapter. Consider the following scenario:

  1. Multilevel cache has a stale value
  2. Caller A issues a delete request for the key.
  3. Multilevel deletes the key from L1
  4. At the same time Client B tries to get the key from cache. It finds it in L2 and replicates value to L1.
  5. Multilevel delete the key from L2.

So we end up with stale key in L1 after delete.

In order to fix this it would make sense to perform deletes in reverse order, i.e. from L2 to L1. I figured out there are 3 callbacks affected: delete, take and delete_all.

Please let me know what you think!

@cabol
Copy link
Owner

cabol commented Nov 4, 2022

Yeah, that makes sense, the PR LGTM!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 6ec27ea on martosaur:reverse_multilevel_deletes into d0ff450 on cabol:master.

@cabol cabol merged commit 809fe9f into cabol:master Nov 4, 2022
@martosaur martosaur deleted the reverse_multilevel_deletes branch November 4, 2022 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants