storage: addres review around nonces in sector states
This commit is contained in:
parent
1766987be5
commit
ef0d45e406
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -204,7 +203,7 @@ func (sm *StorageMinerAPI) SectorsRefs(context.Context) (map[string][]api.Sealed
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) SectorsUpdate(ctx context.Context, id uint64, state api.SectorState) error {
|
func (sm *StorageMinerAPI) SectorsUpdate(ctx context.Context, id uint64, state api.SectorState) error {
|
||||||
return sm.Miner.UpdateSectorState(ctx, id, math.MaxUint64, state)
|
return sm.Miner.UpdateSectorState(ctx, id, storage.NonceIncrement, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) WorkerQueue(ctx context.Context, cfg sectorbuilder.WorkerCfg) (<-chan sectorbuilder.WorkerTask, error) {
|
func (sm *StorageMinerAPI) WorkerQueue(ctx context.Context, cfg sectorbuilder.WorkerCfg) (<-chan sectorbuilder.WorkerTask, error) {
|
||||||
|
@ -13,6 +13,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const NonceIncrement = math.MaxUint64
|
||||||
|
|
||||||
type sectorUpdate struct {
|
type sectorUpdate struct {
|
||||||
newState api.SectorState
|
newState api.SectorState
|
||||||
id uint64
|
id uint64
|
||||||
@ -164,7 +166,7 @@ func (m *Miner) onSectorUpdated(ctx context.Context, update sectorUpdate) {
|
|||||||
return xerrors.Errorf("update nonce too low, ignoring (%d < %d)", update.nonce, s.Nonce)
|
return xerrors.Errorf("update nonce too low, ignoring (%d < %d)", update.nonce, s.Nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
if update.nonce != math.MaxUint64 {
|
if update.nonce != NonceIncrement {
|
||||||
s.Nonce = update.nonce
|
s.Nonce = update.nonce
|
||||||
} else {
|
} else {
|
||||||
s.Nonce++ // forced update
|
s.Nonce++ // forced update
|
||||||
@ -193,35 +195,35 @@ func (m *Miner) onSectorUpdated(ctx context.Context, update sectorUpdate) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
* Empty
|
* Empty
|
||||||
| |
|
| |
|
||||||
| v
|
| v
|
||||||
*<- Packing <- incoming
|
*<- Packing <- incoming
|
||||||
| |
|
| |
|
||||||
| v
|
| v
|
||||||
*<- Unsealed <--> SealFailed
|
*<- Unsealed <--> SealFailed
|
||||||
| |
|
| |
|
||||||
| v
|
| v
|
||||||
* PreCommitting <--> PreCommitFailed
|
* PreCommitting <--> PreCommitFailed
|
||||||
| | ^
|
| | ^
|
||||||
| v |
|
| v |
|
||||||
*<- PreCommitted ------/
|
*<- PreCommitted ------/
|
||||||
| |||
|
| |||
|
||||||
| vvv v--> SealCommitFailed
|
| vvv v--> SealCommitFailed
|
||||||
*<- Committing
|
*<- Committing
|
||||||
| | ^--> CommitFailed
|
| | ^--> CommitFailed
|
||||||
| v ^
|
| v ^
|
||||||
*<- CommitWait ---/
|
*<- CommitWait ---/
|
||||||
| |
|
| |
|
||||||
| v
|
| v
|
||||||
*<- Proving
|
*<- Proving
|
||||||
|
|
|
|
||||||
v
|
v
|
||||||
FailedUnrecoverable
|
FailedUnrecoverable
|
||||||
|
|
||||||
UndefinedSectorState <- ¯\_(ツ)_/¯
|
UndefinedSectorState <- ¯\_(ツ)_/¯
|
||||||
| ^
|
| ^
|
||||||
*---------------------/
|
*---------------------/
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user