Hey! While working on a downstream project, I traced a problem that I was experiencing back to what I believe is a corruption bug that manifests when using snapshots. I haven't had time to burrow into it yet, but I came away with this fairly minimal reproduction:
package main
import (
"fmt"
"github.com/luci/gkvlite"
)
func main() {
// To trigger: secondKey < firstKey, secondKey < lookup
firstKey, secondKey, lookup := "c", "a", "b"
s, _ := gkvlite.NewStore(nil)
c := s.SetCollection("", nil)
c.Set([]byte(firstKey), []byte("foo"))
// If these next two lines don't run, everything works great.
snap1 := s.Snapshot()
snap1.Close()
c.Set([]byte(secondKey), []byte("bar"))
v, err := c.Get([]byte(lookup))
fmt.Println(v, err)
}
Prints: [] missing item after item.read() in GetItem()
If the triggering conditions aren't met, if I remove the two snap1 lines, or if I don't close the snapshot, everything works as expected. It looks like there is a corruption of some sort caused by creating and closing snapshots.
I'll take a look deeper tomorrow; just reporting this since now I have a repro.
Hey! While working on a downstream project, I traced a problem that I was experiencing back to what I believe is a corruption bug that manifests when using snapshots. I haven't had time to burrow into it yet, but I came away with this fairly minimal reproduction:
Prints:
[] missing item after item.read() in GetItem()
If the triggering conditions aren't met, if I remove the two
snap1
lines, or if I don't close the snapshot, everything works as expected. It looks like there is a corruption of some sort caused by creating and closing snapshots.I'll take a look deeper tomorrow; just reporting this since now I have a repro.