From 1f036e11645b3fc2b689a9f7ec7958bcb94892b2 Mon Sep 17 00:00:00 2001 From: lash Date: Wed, 14 Nov 2018 19:57:05 +0100 Subject: [PATCH] swarm/storage: Batch reset in start of loop plus before coda --- swarm/storage/ldbstore.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swarm/storage/ldbstore.go b/swarm/storage/ldbstore.go index 2e1fe5316c..6182b50221 100644 --- a/swarm/storage/ldbstore.go +++ b/swarm/storage/ldbstore.go @@ -615,6 +615,8 @@ func (s *LDBStore) CleanGCIndex() error { var chunkHashes [][]byte var pos []uint8 it := s.db.NewIterator() + + batch.Reset() it.Seek(lastIdxKey) var i int @@ -672,13 +674,14 @@ func (s *LDBStore) CleanGCIndex() error { if err != nil { return err } - batch.Reset() log.Debug("clean gc index pass", "batch", cleanBatchCount, "checked", i, "kept", len(idxs)) } log.Debug("gc cleanup entries", "ok", okEntryCount, "total", totalEntryCount, "batchlen", batch.Len()) + batch.Reset() + var entryCount [8]byte binary.BigEndian.PutUint64(entryCount[:], okEntryCount) batch.Put(keyEntryCnt, entryCount[:])