-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Key-values that should be deleted are not deleted from disk, even when Close() is called #72
Comments
Run twice fmt.Println("testBadger called")
opts := badger.DefaultOptions
dir := "/Users/stef/tmp"
opts.Dir = dir
opts.ValueDir = dir
b, err := badger.NewKV(&opts)
if err != nil {
fmt.Println("error")
return
}
key := []byte("key")
item := badger.KVItem{}
b.Get(key, &item)
if item.Value() == nil {
fmt.Println("non existent key")
val := []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789FOOBARZOGZOG")
b.Set(key, val)
fmt.Println("key value has been inserted")
b.Get(key, &item)
fmt.Println("getting the value")
fmt.Println(string(item.Value()))
b.Delete(key)
fmt.Println("key value has been deleted")
fmt.Println("getting the value again")
b.Get(key, &item)
fmt.Println(item.Value())
} else {
fmt.Println("key exists")
fmt.Println(string(item.Value()))
}
b.Close() |
Hi @stephane-martin, thanks for the bug report. I have submitted a fix and this shouldn't be a problem anymore. |
The fix works, thanks! |
I'm actually not sure why this is the case. If you close cleanly, then Badger should not have to replay the value log, which means the delete markers in value log won't be required. There's something else going on here, which is causing value log to be replayed even when Badger is closed properly. We should look into why that is happening. |
We update valuePointer even if Fid and Offset are 0 and it has length and we replay from end of last entry instead of start so we don't need to have delete markers anymore. |
Hello,
OS: MacOSX
Badger version: 20170624
First process:
Second process:
Thank you
The text was updated successfully, but these errors were encountered: