-
Notifications
You must be signed in to change notification settings - Fork 556
db: batch iterators do not read back concurrent range key writes #1638
Copy link
Copy link
Closed
Labels
C-bugSomething isn't workingSomething isn't working
Description
A batch iterator does not read range key writes that happened after the iterator was created. This differs from the point key behavior, and breaks iterator reuse in CRDB.
func TestPebbleIterRangeKeys(t *testing.T) {
eng := NewDefaultInMemForTesting()
defer eng.Close()
batch := eng.(*Pebble).db.NewIndexedBatch()
defer batch.Close()
iter := batch.NewIter(&pebble.IterOptions{
KeyTypes: pebble.IterKeyTypePointsAndRanges,
})
// A range key written after the iterator is created is not visible
// to the iterator. A point key, however, is visible.
require.NoError(t, batch.Experimental().RangeKeySet([]byte("a"), []byte("b"), nil, []byte{1}, nil))
//require.NoError(t, batch.Set([]byte("a"), []byte{1}, nil))
require.True(t, iter.SeekGE(nil))
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugSomething isn't workingSomething isn't working