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

fix LocalCache#read_multi_entries #44366

Merged
merged 1 commit into from Feb 12, 2022
Merged

fix LocalCache#read_multi_entries #44366

merged 1 commit into from Feb 12, 2022

Conversation

avalanche123
Copy link
Contributor

In cache stores prepending LocalCache, serialized Entry
instances are stored in LocalCache::LocalStore. This
speeds up hot key lookups without a network roundtrip in a
context of a single given request.

However, with these entries being stored in their serialized
form, #read_multi_entries returns them directly to cache
consumers.

Instead, we will now deserialize these entries first.

Summary

Other Information

@matthewd
Copy link
Member

matthewd commented Feb 9, 2022

The need for explicit serialization handling seems a bit mixed between these methods, which is not great for clarity while reading them, but from a quick read this does sound right. (And tbh, I don't see any simple changes that would flatten out those inconsistencies more generally.)

Can you please add a test to show this does fix things / to prevent a future regression -- especially given the above?

(After adding one specifically for this case, it would probably be worth going through the full set of operations and ensuring they're all tested at least once with a serialization-distinguished value... I assume this is the only issue at the moment, but it seems worth taking it as a reminder to check on the full coverage.)

@avalanche123
Copy link
Contributor Author

@matthewd thanks for taking a look! I've added a test for the multi read/write behavior of LocalCache

@rafaelfranca
Copy link
Member

Can you squash your commits in one please?

@rafaelfranca rafaelfranca added the ready PRs ready to merge label Feb 9, 2022
In cache stores prepending `LocalCache`, serialized `Entry`
instances are stored in `LocalCache::LocalStore`. This
speeds up hot key lookups without a network roundtrip in a
context of a single given request.

However, with these entries being stored in their serialized
form, `#read_multi_entries` returns them directly to cache
consumers.

Instead, we will now deserialize these entries first.
@avalanche123
Copy link
Contributor Author

@rafaelfranca done!

@byroot byroot merged commit d4ef8c2 into rails:main Feb 12, 2022
rafaelfranca pushed a commit that referenced this pull request Apr 14, 2022
Fix deserialization in LocalCache#read_multi_entries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activesupport ready PRs ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants