From de864d3b58657a74c7ba7382a7a2bff672571286 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 10 Aug 2016 10:50:53 -0700 Subject: [PATCH] mvcc: fix count --- mvcc/kv_test.go | 3 +++ mvcc/kvstore.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mvcc/kv_test.go b/mvcc/kv_test.go index b5dbc2f8f34..721d70a57f9 100644 --- a/mvcc/kv_test.go +++ b/mvcc/kv_test.go @@ -245,6 +245,9 @@ func testKVRangeLimit(t *testing.T, f rangeFunc) { if r.Rev != wrev { t.Errorf("#%d: rev = %d, want %d", i, r.Rev, wrev) } + if r.Count != len(kvs) { + t.Errorf("#%d: count = %d, want %d", i, r.Count, len(kvs)) + } } } diff --git a/mvcc/kvstore.go b/mvcc/kvstore.go index 249224221dc..adc1fb7661e 100644 --- a/mvcc/kvstore.go +++ b/mvcc/kvstore.go @@ -498,7 +498,7 @@ func (s *store) rangeKeys(key, end []byte, limit, rangeRev int64, countOnly bool break } } - return kvs, len(kvs), curRev, nil + return kvs, len(revpairs), curRev, nil } func (s *store) put(key, value []byte, leaseID lease.LeaseID) {