Skip to content
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

check version<0 in deleteVersion #348

Merged
merged 2 commits into from
Dec 14, 2020
Merged

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Dec 14, 2020

Fixes #345. This would cause an error in any case, since the version does not exist, but it's better to catch it here.

@erikgrinaker erikgrinaker added the T:bug Type: Bug (Confirmed) label Dec 14, 2020
@erikgrinaker erikgrinaker self-assigned this Dec 14, 2020
@@ -516,7 +516,7 @@ func (tree *MutableTree) SaveVersion() ([]byte, int64, error) {
}

func (tree *MutableTree) deleteVersion(version int64) error {
if version == 0 {
if version <= 0 {
Copy link
Member

@tac0turtle tac0turtle Dec 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a tradeoff between this and migrating to uin64? Out of scope for this PR but curious.

Copy link
Contributor Author

@erikgrinaker erikgrinaker Dec 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uint64 is a breaking change, since we use int64 in the public APIs. I believe this is also persisted to disk. Otherwise, yeah, it should really be uint64.

@erikgrinaker erikgrinaker merged commit b3b6e2a into master Dec 14, 2020
@erikgrinaker erikgrinaker deleted the erik/deleteversion-lt-0 branch December 14, 2020 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:bug Type: Bug (Confirmed)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MutableTree.deleteVersion should use version <= 0 instead of version == 0 to catch values <= 0
2 participants