-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 bug in backup KeyToList function. #3832
Conversation
Previously, the KeyToList function used during backup assumed that ReadPostingList takes you to the next key so calling iterator.Next manually is not needed. This is not the case. The fix is either to make ReadPostingList call iterator.Next before returning or doing it in the KeyToList function. The latter has been chosen in this PR to preserve the existing behavior of ReadPostingList. It's still not clear why only the bulk loader triggered this issue.
Backups succeed now
|
@martinmr Can you please fix the failed tests? |
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.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @martinmr)
ee/backup/backup.go, line 272 at r1 (raw file):
} itr.Next()
Can this be moved up into the for loop line?
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.
Fixed the tests. Turns out that it.Next should be called inside of ReadPostingList. Otherwise, it will be called twice when reading a delta posting list and some data will be excluded from the backup.
I'll update the description accordingly.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @gitlw and @manishrjain)
ee/backup/backup.go, line 272 at r1 (raw file):
Previously, gitlw (Lucas Wang) wrote…
Can this be moved up into the for loop line?
Not relevant anymore.
Running the tests again. Hopefully this change does not break anything since ReadPostingList has been changed. |
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.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @gitlw, @manishrjain, and @martinmr)
posting/mvcc.go, line 170 at r3 (raw file):
} l.minTs = item.Version() it.Next()
This Next shouldn't be here. Otherwise, we'll have to do Next for every return call here (BitEmptyPosting, DiscardEarlierVersions, etc.). The caller is supposed to run Next as needed.
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.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @gitlw and @martinmr)
ee/backup/backup.go, line 272 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
Not relevant anymore.
I'm looking at this code. toBackupList should not be in a for loop. ReadPostingList takes care of advancing the iterator to generate the posting list.
Previously, the KeyToList function used during backup assumed that
ReadPostingList takes you to the next key so calling iterator.Next
manually is not needed. This is not the case during backups.
The fix is either to make ReadPostingList call iterator.Next after reading a
complete posting list.
The bug was being triggered by the bulk loader because inserting data via
mutations creates delta posting lists but the bulk loader creates complete
posting lists.
Fixes #3831
This change is