-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: sealing: Sector upgrade queue #8330
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, keep me posted when this gets out of draft
@@ -106,6 +106,8 @@ type Sealing struct { | |||
assignedPieces map[abi.SectorID][]cid.Cid | |||
creating *abi.SectorNumber // used to prevent a race where we could create a new sector more than once | |||
|
|||
available map[abi.SectorID]struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will become stale if the miner restarts. Are there existing patterns for traversing sector infos to repopulate this for all infos in Available state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Available
state handler gets called on restart, so this will get repopulated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woah cool, is this the same for all state handlers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure about a few things but looks ready for minerX testing.
# | ||
# type: bool | ||
# env var: LOTUS_SEALING_MAKECCSECTORSAVAILABLE | ||
#MakeCCSectorsAvailable = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
@@ -136,6 +137,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto | |||
|
|||
FinalizeSector: planOne( | |||
on(SectorFinalized{}, Proving), | |||
on(SectorFinalizedAvailable{}, Available), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of FinalizedAvailable? Why not instead go to Available from proving if the MakeCCSectorsAvailable config is set? That way we can avoid coupling with CommitFinalize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't really distinguish CC sectors already in the proving state from CC sectors entering the proving state (that's because on restart we run all state handlers for current states of all sectors). If we were to do that without tracking existing CC sectors, all CC sectors would get converted to Available
, which I'm quite sure is not what SPs will want.
Other things we could do instead of this event:
- Additional state deciding this
- Now we need 2 events, and an additional state
- Add a boolean to
SectorInfo
to track which CC sectors are Proving already, and shouldn't be auto-converted to Available- Pretty sure this still requires an additional event to update this variable. Also adds more bits of private per-sector state, which ideally wouldn't exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks makes sense. That run all state handlers on restart fact is pretty important.
extern/storage-sealing/input.go
Outdated
|
||
log.Infow("Upgrading sector", "number", candidate.Number, "type", "deal", "proofType", sp, "expiration", bestExpiration, "pledge", types.FIL(bestPledge)) | ||
delete(m.available, candidate) | ||
m.creating = &candidate.Number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why set creating
I thought this was only needed when making a new sector, not dealing with an existing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This var is used to synchronize sector event processing - basically we want to make sure that we don't re-enter tryGetDealSector
before the sector we've just asked to enter WaitDeals*
adds itself to m.openSectors
.
Renamed the var to something which makes more sense given that we now also use it for snapdeals
@@ -63,7 +64,7 @@ type SealingAPI interface { | |||
StateMinerInfo(context.Context, address.Address, TipSetToken) (miner.MinerInfo, error) | |||
StateMinerAvailableBalance(context.Context, address.Address, TipSetToken) (big.Int, error) | |||
StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, TipSetToken) (bool, error) | |||
StateMinerActiveSectors(context.Context, address.Address, TipSetToken) ([]*miner.SectorOnChainInfo, error) | |||
StateMinerActiveSectors(context.Context, address.Address, TipSetToken) (bitfield.BitField, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
way better
@@ -106,6 +106,8 @@ type Sealing struct { | |||
assignedPieces map[abi.SectorID][]cid.Cid | |||
creating *abi.SectorNumber // used to prevent a race where we could create a new sector more than once | |||
|
|||
available map[abi.SectorID]struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woah cool, is this the same for all state handlers?
Codecov Report
@@ Coverage Diff @@
## master #8330 +/- ##
==========================================
- Coverage 40.38% 40.33% -0.05%
==========================================
Files 679 679
Lines 73898 73985 +87
==========================================
Hits 29842 29842
- Misses 38845 38903 +58
- Partials 5211 5240 +29
|
COOOOOOOOOLLLL |
oh yess this is cool we should have it in v1.15.1 |
Related Issues
Closes #8231
Proposed Changes
Available
sector state for CC sectors available for upgrading ('available storage')Available
state instead ofSnapDealsWaitDeals
Available
sectors can accept it - we'll select a candidate with lowest initial pledge (most rational to upgrade?)Additional Info
TODO:
Available
(maybe a separate PR)Active
sectors run all snapdeal checksAvailable
toProving
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, testarea
: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps