-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Dynamic trailing computation #714
Conversation
This PR lacks testing for now. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #714 +/- ##
=======================================
Coverage 74.02% 74.02%
=======================================
Files 192 192
Lines 27827 27899 +72
Branches 2797 2802 +5
=======================================
+ Hits 20598 20653 +55
- Misses 4906 4914 +8
- Partials 2323 2332 +9 ☔ View full report in Codecov by Sentry. |
Thanks Marco for this PR, it looks very good to me, no comments so far. For the testing part of the story, we have the snapshot tests at We should also add a new test for the dynamic strategy asserting that the entries in the snapshot match the calculation for the expected size. Actually I was going to suggest changing existing tests to use both strategies by abstracting it away but I see that most of them use a threshold of 1 so it will probably require changing all of them, so adding a new one seems easier. I would suggest adding the tests in the unit tests for replication and in the integration tests, either in the replication_test or in snapshot_test. Lastly, do not look at the tests under |
After the conversation I had with @just-now, I changed slightly the strategy so that the computed trailing always sits in the range I also added some tests which hopefully cover the functionality now. I'm marking this as ready. |
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.
Looks very good. Just minor nit-picks.
38d61c5
to
83de83e
Compare
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.
Looks good. Merge it (preferably on Monday).
This commit fixes the logic so that the computed trailing does not remove too many entries in the log which would make the previous snapshot unusable.
37bff78
to
3b87142
Compare
This PR adds a non-default strategy to dynamically compute the amount of entries to keep in memory based on the size of the snapshot.
The problem with using a fixed number is that each entry has a different size (depending on the number of pages written for each transaction). As such, the memory used (and then streamed to a lagging follower) might be way bigger than the size of the snapshot itself (even by order of magnitude).