mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
swarm/storage: debug failed tests"
This commit is contained in:
parent
0eeda9fb35
commit
cc6a4ab20e
1 changed files with 2 additions and 0 deletions
|
|
@ -246,6 +246,7 @@ func decodeOldData(data []byte, chunk *Chunk) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *LDBStore) collectGarbage(ratio float32) {
|
func (s *LDBStore) collectGarbage(ratio float32) {
|
||||||
|
log.Info("collect garbage", "ratio", ratio)
|
||||||
it := s.db.NewIterator()
|
it := s.db.NewIterator()
|
||||||
defer it.Release()
|
defer it.Release()
|
||||||
|
|
||||||
|
|
@ -285,6 +286,7 @@ func (s *LDBStore) collectGarbage(ratio float32) {
|
||||||
sort.Slice(garbage[:gcnt], func(i, j int) bool { return garbage[i].value < garbage[j].value })
|
sort.Slice(garbage[:gcnt], func(i, j int) bool { return garbage[i].value < garbage[j].value })
|
||||||
|
|
||||||
cutoff := int(float32(gcnt) * ratio)
|
cutoff := int(float32(gcnt) * ratio)
|
||||||
|
log.Info("cutoff", "cutoff", cutoff, "gcnt", gcnt)
|
||||||
for i := 0; i < cutoff; i++ {
|
for i := 0; i < cutoff; i++ {
|
||||||
s.delete(garbage[i].idx, garbage[i].idxKey, garbage[i].po)
|
s.delete(garbage[i].idx, garbage[i].idxKey, garbage[i].po)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue