From c85f73652240ffecd9678656ad0076b5c82214b2 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Mon, 8 May 2017 21:45:43 -0700 Subject: [PATCH] mvcc: time restore in restore benchmark This never worked. --- mvcc/kvstore_bench_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mvcc/kvstore_bench_test.go b/mvcc/kvstore_bench_test.go index 821fb6755..33fdc17fc 100644 --- a/mvcc/kvstore_bench_test.go +++ b/mvcc/kvstore_bench_test.go @@ -89,7 +89,8 @@ func benchmarkStoreRestore(revsPerKey int, b *testing.B) { var i fakeConsistentIndex be, tmpPath := backend.NewDefaultTmpBackend() s := NewStore(be, &lease.FakeLessor{}, &i) - defer cleanup(s, be, tmpPath) + // use closure to capture 's' to pick up the reassignment + defer func() { cleanup(s, be, tmpPath) }() // arbitrary number of bytes bytesN := 64 @@ -103,7 +104,11 @@ func benchmarkStoreRestore(revsPerKey int, b *testing.B) { txn.End() } } + s.Close() + + b.ReportAllocs() b.ResetTimer() + s = NewStore(be, &lease.FakeLessor{}, &i) } func BenchmarkStoreRestoreRevs1(b *testing.B) {