diff options
author | Elad <theman@elad.im> | 2019-02-15 14:41:42 +0800 |
---|---|---|
committer | Rafael Matias <rafael@skyle.net> | 2019-02-19 20:11:52 +0800 |
commit | 3d2bedf8d086507825b6689962c6c84741ad2820 (patch) | |
tree | c0d3e04535f2cb1141b6a67a4e1ee3c11cb63418 /swarm/storage | |
parent | 8ea3d8ad90f90e7233e829ad141acfd9d911658c (diff) | |
download | go-tangerine-3d2bedf8d086507825b6689962c6c84741ad2820.tar.gz go-tangerine-3d2bedf8d086507825b6689962c6c84741ad2820.tar.zst go-tangerine-3d2bedf8d086507825b6689962c6c84741ad2820.zip |
swarm/storage: fix influxdb gc metrics report (#19102)
(cherry picked from commit 5b8ae7885eaa033aaf1fb1d5959b7f1c86761d6d)
Diffstat (limited to 'swarm/storage')
-rw-r--r-- | swarm/storage/ldbstore.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/swarm/storage/ldbstore.go b/swarm/storage/ldbstore.go index f98809fc6..9e4d63841 100644 --- a/swarm/storage/ldbstore.go +++ b/swarm/storage/ldbstore.go @@ -317,7 +317,6 @@ func decodeData(addr Address, data []byte) (*chunk, error) { } func (s *LDBStore) collectGarbage() error { - // prevent duplicate gc from starting when one is already running select { case <-s.gc.runC: @@ -335,7 +334,6 @@ func (s *LDBStore) collectGarbage() error { s.startGC(int(entryCnt)) log.Debug("collectGarbage", "target", s.gc.target, "entryCnt", entryCnt) - var totalDeleted int for s.gc.count < s.gc.target { it := s.db.NewIterator() ok := it.Seek([]byte{keyGCIdx}) @@ -371,15 +369,15 @@ func (s *LDBStore) collectGarbage() error { } s.writeBatch(s.gc.batch, wEntryCnt) + log.Trace("garbage collect batch done", "batch", singleIterationCount, "total", s.gc.count) s.lock.Unlock() it.Release() - log.Trace("garbage collect batch done", "batch", singleIterationCount, "total", s.gc.count) } - s.gc.runC <- struct{}{} + metrics.GetOrRegisterCounter("ldbstore.collectgarbage.delete", nil).Inc(int64(s.gc.count)) log.Debug("garbage collect done", "c", s.gc.count) + s.gc.runC <- struct{}{} - metrics.GetOrRegisterCounter("ldbstore.collectgarbage.delete", nil).Inc(int64(totalDeleted)) return nil } |