Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
FileStorage: fix rare data corruption when using restore after multiple undos #395
FileStorage: fix rare data corruption when using restore after multiple undos #395
Changes from 1 commit
44d36b0
37db547
ae6bdd0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why are we sure that the "backpointer" found at the highest position is the right one? I.e. why have older undo records a higher position?
With your change, the code no longer matches the introductory source comment. The source comment should get updated.
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.
Hello everyone. I had the same concern and actually this issue is not only about undo, but also how FileStorage handles and/or should handle a situation when one transaction contains two data records with the same oid. What loadBefore should return for such case - data from the first data record or from the second? Current behaviour is to return the data from the second data record - the one that was last to be
.store()
' ed. Proof:create database with multiple data entries in the same transaction for oid=1
---- 8< ---- (
1.txn
)try to read that oid=1
---- 8< ---- (
catobj.py
)I'm not sure 100% but probably this is kind of expected behaviour.
So taking this into account for consistency it should be also the latest undo record that is taking the effect.
And for generality we should also consider cases like:
because here it should be data3 to be returned by loadBefore, not data from T1.
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.
(undo record can be, and probably should be, perceived as regular store with instruction to copy data from particular previous data record)
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.
With the above point of view I suggest to amend the patch with the following:
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.
Thank you, I like this patch better, it's more logical. I have integrated this in the pull request.
When I wrote that patch, the reason to take the latest data record was to match the behavior of
_txn_undo_write
, it iterateswhile pos < tend:
and updates the index.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.
Thanks, Jérome.
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.
And I see about your original observations.