Browse Source

mvcc: fix count

Xiang Li 9 years ago
parent
commit
de864d3b58
2 changed files with 4 additions and 1 deletions
  1. 3 0
      mvcc/kv_test.go
  2. 1 1
      mvcc/kvstore.go

+ 3 - 0
mvcc/kv_test.go

@@ -245,6 +245,9 @@ func testKVRangeLimit(t *testing.T, f rangeFunc) {
 		if r.Rev != wrev {
 		if r.Rev != wrev {
 			t.Errorf("#%d: rev = %d, want %d", i, 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))
+		}
 	}
 	}
 }
 }
 
 

+ 1 - 1
mvcc/kvstore.go

@@ -498,7 +498,7 @@ func (s *store) rangeKeys(key, end []byte, limit, rangeRev int64, countOnly bool
 			break
 			break
 		}
 		}
 	}
 	}
-	return kvs, len(kvs), curRev, nil
+	return kvs, len(revpairs), curRev, nil
 }
 }
 
 
 func (s *store) put(key, value []byte, leaseID lease.LeaseID) {
 func (s *store) put(key, value []byte, leaseID lease.LeaseID) {