From 660fd5e3e167c939014c7888dff1f7e38f101c95 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Thu, 14 May 2015 17:55:54 -0700 Subject: [PATCH] storage: add comment around compact --- storage/index.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/index.go b/storage/index.go index 41f263ca7..4dc8058c9 100644 --- a/storage/index.go +++ b/storage/index.go @@ -73,6 +73,8 @@ func (ti *treeIndex) Compact(index uint64) map[uint64]struct{} { available := make(map[uint64]struct{}) emptyki := make([]*keyIndex, 0) log.Printf("store.index: compact %d", index) + // TODO: do not hold the lock for long time? + // This is probably OK. Compacting 10M keys takes O(10ms). ti.Lock() defer ti.Unlock() ti.tree.Ascend(compactIndex(index, available, &emptyki))