@@ -317,7 +317,6 @@ func decodeData(addr Address, data []byte) (*chunk, error) {
317
317
}
318
318
319
319
func (s * LDBStore ) collectGarbage () error {
320
-
321
320
// prevent duplicate gc from starting when one is already running
322
321
select {
323
322
case <- s .gc .runC :
@@ -335,7 +334,6 @@ func (s *LDBStore) collectGarbage() error {
335
334
s .startGC (int (entryCnt ))
336
335
log .Debug ("collectGarbage" , "target" , s .gc .target , "entryCnt" , entryCnt )
337
336
338
- var totalDeleted int
339
337
for s .gc .count < s .gc .target {
340
338
it := s .db .NewIterator ()
341
339
ok := it .Seek ([]byte {keyGCIdx })
@@ -371,15 +369,15 @@ func (s *LDBStore) collectGarbage() error {
371
369
}
372
370
373
371
s .writeBatch (s .gc .batch , wEntryCnt )
372
+ log .Trace ("garbage collect batch done" , "batch" , singleIterationCount , "total" , s .gc .count )
374
373
s .lock .Unlock ()
375
374
it .Release ()
376
- log .Trace ("garbage collect batch done" , "batch" , singleIterationCount , "total" , s .gc .count )
377
375
}
378
376
379
- s .gc .runC <- struct {}{}
377
+ metrics . GetOrRegisterCounter ( "ldbstore.collectgarbage.delete" , nil ). Inc ( int64 ( s .gc .count ))
380
378
log .Debug ("garbage collect done" , "c" , s .gc .count )
379
+ s .gc .runC <- struct {}{}
381
380
382
- metrics .GetOrRegisterCounter ("ldbstore.collectgarbage.delete" , nil ).Inc (int64 (totalDeleted ))
383
381
return nil
384
382
}
385
383
0 commit comments