Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: miner info: Show correct sector state counts #11456

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 26 additions & 0 deletions itests/sector_pledge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,29 @@ func TestPledgeSynth(t *testing.T) {
runTest(t, 3)
})
}

func TestSectorsSummary(t *testing.T) {
kit.QuietMiningLogs()

blockTime := 50 * time.Millisecond

ctx, cancel := context.WithCancel(context.Background())
defer cancel()

nPreseal := 2

_, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.PresealSectors(nPreseal))
ens.InterconnectAll().BeginMining(blockTime)

miner.PledgeSectors(ctx, 1, 0, nil)

ms, err := miner.SectorsSummary(ctx)
require.NoError(t, err)

require.Len(t, ms, 1) // all proving

for st, n := range ms {
require.Equal(t, api.SectorState(sealing.Proving), st)
require.Equal(t, 1+nPreseal, n)
}
}
4 changes: 4 additions & 0 deletions storage/pipeline/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
}
Expand Down