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

Fix deletion of non-existing keys #23

Merged
merged 2 commits into from
Aug 11, 2017

Conversation

heyitsanthony
Copy link
Contributor

via boltdb/bolt#660; looks important

Change Bucket.Delete to do what its doc comment says in a case of non-existing keys, e.g. nothing.
This pull request fixes boltdb#349

As of now the test fails and tries to delete the next key returned by
the cursor, which happens to be a nested bucket. That's why Delete is
fails.

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Doc for Bucket.Delete says that a Delete() on non-existing key is a
no-op. Right now it tries to delete the next key returned by the
cursor. Fix this by checking for key equivalence before deletion.

 Fixes boltdb#349

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

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

lgtm. thanks.

@heyitsanthony heyitsanthony merged commit 9fc2cf1 into etcd-io:master Aug 11, 2017
@heyitsanthony heyitsanthony deleted the del-nonexisting branch August 22, 2017 17:29
AskAlexSharov added a commit to ledgerwatch/bolt that referenced this pull request Apr 1, 2020
AskAlexSharov added a commit to ledgerwatch/bolt that referenced this pull request Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Deleting a non-existing key throws ErrIncompatibleValue
3 participants