-
Notifications
You must be signed in to change notification settings - Fork 646
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
Cursor.Delete followed by Next skips the next k/v pair #146
Comments
Actually, even |
Is there an update on this? This seems to be working for me on both 1.3.3 and 1.3.4 In my testing, the combination of a cursor.Seek(key) then either a bucket.Delete(key) or a cursor.Delete() followed by a cursor.Next() does seem to correct advance to the next key right after the deleted item. Perhaps I'm not reproducing the bug correctly. The original boltdb (not bbolt) issue linked above has a link to a test for this. Maybe it has already been fixed in bbolt and this issue should be closed? |
Still a bug.
|
OK, perfect. Thanks, @jrick. Wondering why mine was working, I modified your test below. This may help narrow down the bug. The test below does not produce the error. Based on this one test (not conclusive) it looks like the error does not occur if the key/doc being deleted is not also created in the same transaction. This is definitely bad behavior.
|
I can confirm this is still broken on |
Okay, so hacking around a bit, there is a workaround if you rewrite the range query from the example as such: for k, _ := cursor.Seek(min); k != nil && bytes.Compare(k, max) <= 0; {
if shouldDelete(k) && cursor.Delete() == nil {
k, _ = cursor.Seek(k)
} else {
k, _ = cursor.Next()
}
} |
Added a known issue for this behaviour, please refer to #614 |
The bug is described in detail here: boltdb/bolt#620.
The text was updated successfully, but these errors were encountered: