swarm/storage: debug failed tests"

This commit is contained in:
Anton Evangelatov 2018-04-16 13:20:51 +03:00
parent 0eeda9fb35
commit cc6a4ab20e

View file

@ -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)
} }