diff --git a/internal/batchskl/iterator.go b/internal/batchskl/iterator.go index dea41c0525..ec55607a66 100644 --- a/internal/batchskl/iterator.go +++ b/internal/batchskl/iterator.go @@ -201,6 +201,8 @@ func (it *Iterator) String() string { func (it *Iterator) SetBounds(lower, upper []byte) { it.lower = lower it.upper = upper + it.lowerNode = 0 + it.upperNode = 0 } func (it *Iterator) seekForBaseSplice(key []byte, abbreviatedKey uint64) (prev, next uint32) { diff --git a/testdata/internal_iter_bounds b/testdata/internal_iter_bounds index 5f580eabb3..6fabaa4b15 100644 --- a/testdata/internal_iter_bounds +++ b/testdata/internal_iter_bounds @@ -30,3 +30,21 @@ b:2 b:1 . b:1 + +# Test changing the bounds. The new bounds should be in effect. + +iter lower=b upper=c +seek-ge d +set-bounds lower=a upper=z +seek-ge d +---- +. +d:2 + +iter lower=b upper=c +seek-lt b +set-bounds lower=a upper=z +seek-lt b +---- +. +a:1