mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
backend: fix buffer range bug
This commit is contained in:
parent
a4570a60e7
commit
ebf461a7de
@ -120,7 +120,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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user