From 3407848e8c4daf58bcdebae31e6855c46efe7491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 23 Nov 2023 21:19:16 +0100 Subject: [PATCH] fix: miner info: Show correct sector state counts --- CHANGELOG.md | 1 + storage/pipeline/stats.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 664fa3778..05caea4f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - chore: Auto remove local chain data when importing chain file or snapshot ([filecoin-project/lotus#11277](https://github.com/filecoin-project/lotus/pull/11277)) - feat: metric: export Mpool message count ([filecoin-project/lotus#11361](https://github.com/filecoin-project/lotus/pull/11361)) - feat: sealing: load SectorsSummary from sealing SectorStats instead of calling API each time ([filecoin-project/lotus#11353](https://github.com/filecoin-project/lotus/pull/11353)) +- fix: miner info: Show correct sector state counts ([filecoin-project/lotus#11456](https://github.com/filecoin-project/lotus/pull/11456)) ## Improvements - fix: Add time slicing to splitstore purging step during compaction to reduce lock congestion [filecoin-project/lotus#11269](https://github.com/filecoin-project/lotus/pull/11269) diff --git a/storage/pipeline/stats.go b/storage/pipeline/stats.go index 696cd56a5..a558421ae 100644 --- a/storage/pipeline/stats.go +++ b/storage/pipeline/stats.go @@ -44,6 +44,10 @@ func (ss *SectorStats) updateSector(ctx context.Context, cfg sealiface.Config, i ss.totals[toStatState(oldst, cfg.FinalizeEarly)]-- ss.byState[oldst]-- + if ss.byState[oldst] <= 0 { + delete(ss.byState, oldst) + } + mctx, _ := tag.New(ctx, tag.Upsert(metrics.SectorState, string(oldst))) stats.Record(mctx, metrics.SectorStates.M(ss.byState[oldst])) }