mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
swarm/storage: Delete gc items direct in loop
This commit is contained in:
parent
7c33de3ebd
commit
cd126c2a58
1 changed files with 1 additions and 13 deletions
|
|
@ -287,7 +287,6 @@ func (s *LDBStore) collectGarbage(ratio float32) {
|
||||||
it := s.db.NewIterator()
|
it := s.db.NewIterator()
|
||||||
defer it.Release()
|
defer it.Release()
|
||||||
|
|
||||||
garbage := []*gcItem{}
|
|
||||||
var gcnt uint64
|
var gcnt uint64
|
||||||
maxGcnt := s.getGCCount()
|
maxGcnt := s.getGCCount()
|
||||||
|
|
||||||
|
|
@ -306,20 +305,9 @@ func (s *LDBStore) collectGarbage(ratio float32) {
|
||||||
|
|
||||||
log.Trace("parse gc", "index", index, "po", po, "hash", hash)
|
log.Trace("parse gc", "index", index, "po", po, "hash", hash)
|
||||||
|
|
||||||
gci := &gcItem{
|
s.delete(index, keyIdx, po)
|
||||||
idxKey: keyIdx,
|
|
||||||
idx: index,
|
|
||||||
value: index.Access, // the smaller, the more likely to be gc'd. see sort comparator below.
|
|
||||||
po: po,
|
|
||||||
}
|
|
||||||
|
|
||||||
garbage = append(garbage, gci)
|
|
||||||
gcnt++
|
gcnt++
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, garbageItem := range garbage {
|
|
||||||
s.delete(garbageItem.idx, garbageItem.idxKey, garbageItem.po)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export writes all chunks from the store to a tar archive, returning the
|
// Export writes all chunks from the store to a tar archive, returning the
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue