From 5ae2eb4731260e9035f77d58458f4580061a153f Mon Sep 17 00:00:00 2001 From: Yicheng Qin Date: Thu, 3 Sep 2015 16:35:55 -0700 Subject: [PATCH] storage: avoid one extra round of wait It could exit early if it knows that there is no more keys. --- storage/kvstore_compaction.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/kvstore_compaction.go b/storage/kvstore_compaction.go index d63e25f42..cec9cc435 100644 --- a/storage/kvstore_compaction.go +++ b/storage/kvstore_compaction.go @@ -31,7 +31,7 @@ func (s *store) scheduleCompaction(compactMainRev int64, keep map[revision]struc } } - if len(keys) == 0 { + if len(keys) < int(batchsize) { rbytes := make([]byte, 8+1+8) revToBytes(revision{main: compactMainRev}, rbytes) tx.UnsafePut(metaBucketName, finishedCompactKeyName, rbytes)