Merge pull request #12587 from mlmhl/buffer-search
backend: fix buffer range bug
This commit is contained in:
@ -141,7 +141,7 @@ func newBucketBuffer() *bucketBuffer {
|
|||||||
func (bb *bucketBuffer) Range(key, endKey []byte, limit int64) (keys [][]byte, vals [][]byte) {
|
func (bb *bucketBuffer) Range(key, endKey []byte, limit int64) (keys [][]byte, vals [][]byte) {
|
||||||
f := func(i int) bool { return bytes.Compare(bb.buf[i].key, key) >= 0 }
|
f := func(i int) bool { return bytes.Compare(bb.buf[i].key, key) >= 0 }
|
||||||
idx := sort.Search(bb.used, f)
|
idx := sort.Search(bb.used, f)
|
||||||
if idx < 0 {
|
if idx < 0 || idx >= bb.used {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if len(endKey) == 0 {
|
if len(endKey) == 0 {
|
||||||
|
Reference in New Issue
Block a user