-
Notifications
You must be signed in to change notification settings - Fork 414
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 duplicates on update call #398
Conversation
@dispanser If you're available, I think it would be helpful for you to chime in on this thread 😄 |
I think the optimization that @dispanser introduced is valid, the bug is caused by incorrect use of |
@rtyler : just coming back from vacation today, I'll take a closer look tomorrow. |
Indeed, calling However, I believe the fix proposed in this PR only solves this as a side effect of not doing the proper thing in the first place: What the condition basically says is "if the previously loaded latest checkpoint is the same as the currently seen checkpoint, reload from the checkpoint", which leads to the checkpoints being only used if it was current anyway, so doesn't contain anything not already loaded. If the version has advanced past the next checkpoint, we don't use it, which is not what we want because these checkpoints are supposed to allow you skipping all those jsons. Hence the rationale for #124. As @hougp already mentioned, the root cause for the duplication is calling Ok(last_check_point) => {
if self.last_check_point != Some(last_check_point) {
self.last_check_point = Some(last_check_point);
self.restore_checkpoint(last_check_point).await?;
self.version = last_check_point.version + 1;
} else {
self.version += 1;
}
} Of course, now we basically do a
|
Yep, i think it would be cleaner to use |
@dispanser @houqp I got rid of
It also lead to rework the |
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.
nice clean up @mosyp !
Description
Every time the
update
is called, theAdd
action from the latest checkpoints are being applied once more, leading into duplicates.As it turned out, it's a regression from #124 changes.
First commit shows the repro steps, second revers mention changes and resolves the issue