swarm/storage: Batch reset in start of loop plus before coda

This commit is contained in:
lash 2018-11-14 19:57:05 +01:00
parent c4f3af8e01
commit 1f036e1164

View file

@ -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[:])