-
Notifications
You must be signed in to change notification settings - Fork 4
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: move cache invalidation to after transaction commit #77
Conversation
3e946ab
to
47ad5a3
Compare
47ad5a3
to
8c56ce5
Compare
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
==========================================
+ Coverage 94.48% 94.61% +0.12%
==========================================
Files 59 60 +1
Lines 1506 1522 +16
Branches 171 181 +10
==========================================
+ Hits 1423 1440 +17
+ Misses 81 80 -1
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
895db7d
to
f7d2297
Compare
One thing to figure out is if we want these invalidations to occur right before or right after the transaction commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like the regression test.
Why
Implementation of second idea from #76.
How
EntityCacheInconsistency-test
). This test runs an update in a long-running transaction and does a single targeted load between when the cache is invalidated (in the old implementation) and when the transaction completes. With the old implementation, the cache would have been cleared before the change was visible to other machines. With the new implementation, the cache is cleared at commit time (right after commit). Technically there still could be a race if the loads of a single entity are super frequent and an update occurs but that problem can't be solved without a distributed reader-writer lock which at this point is probably overkill.Test Plan
Run new test.