Skip to content

Commit

Permalink
config: Storage.DisallowRemoteFinalize
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed May 23, 2022
1 parent 8c6cba7 commit 7612860
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 14 deletions.
7 changes: 7 additions & 0 deletions documentation/en/default-lotus-miner-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,13 @@
# env var: LOTUS_STORAGE_ASSIGNER
#Assigner = "utilization"

# If you see stuck Finalize tasks after enabling this setting, check
# 'lotus-miner sealing sched-diag' and 'lotus-miner storage find [sector num]'
#
# type: bool
# env var: LOTUS_STORAGE_DISALLOWREMOTEFINALIZE
#DisallowRemoteFinalize = false

# ResourceFiltering instructs the system which resource filtering strategy
# to use when evaluating tasks against this worker. An empty value defaults
# to "hardware".
Expand Down
12 changes: 8 additions & 4 deletions extern/sector-storage/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ type Manager struct {
workLk sync.Mutex
work *statestore.StateStore

parallelCheckLimit int
parallelCheckLimit int
disallowRemoteFinalize bool

callToWork map[storiface.CallID]WorkID
// used when we get an early return and there's no callToWork mapping
Expand Down Expand Up @@ -123,6 +124,8 @@ type Config struct {
// PoSt config
ParallelCheckLimit int

DisallowRemoteFinalize bool

Assigner string
}

Expand Down Expand Up @@ -155,7 +158,8 @@ func New(ctx context.Context, lstor *stores.Local, stor stores.Store, ls stores.

localProver: prover,

parallelCheckLimit: sc.ParallelCheckLimit,
parallelCheckLimit: sc.ParallelCheckLimit,
disallowRemoteFinalize: sc.DisallowRemoteFinalize,

work: mss,
callToWork: map[storiface.CallID]WorkID{},
Expand Down Expand Up @@ -634,7 +638,7 @@ func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef,
}

// get a selector for moving stuff into long-term storage
fetchSel := newMoveSelector(m.index, sector.ID, storiface.FTCache|storiface.FTSealed, storiface.PathStorage)
fetchSel := newMoveSelector(m.index, sector.ID, storiface.FTCache|storiface.FTSealed, storiface.PathStorage, !m.disallowRemoteFinalize)

// only move the unsealed file if it still exists and needs moving
moveUnsealed := unsealed
Expand Down Expand Up @@ -712,7 +716,7 @@ func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storage.Sect

move := func(types storiface.SectorFileType) error {
// get a selector for moving stuff into long-term storage
fetchSel := newMoveSelector(m.index, sector.ID, types, storiface.PathStorage)
fetchSel := newMoveSelector(m.index, sector.ID, types, storiface.PathStorage, !m.disallowRemoteFinalize)
{
if len(keepUnsealed) == 0 {
moveUnsealed = storiface.FTNone
Expand Down
22 changes: 12 additions & 10 deletions extern/sector-storage/selector_move.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ import (
)

type moveSelector struct {
index stores.SectorIndex
sector abi.SectorID
alloc storiface.SectorFileType
destPtype storiface.PathType
index stores.SectorIndex
sector abi.SectorID
alloc storiface.SectorFileType
destPtype storiface.PathType
allowRemote bool
}

func newMoveSelector(index stores.SectorIndex, sector abi.SectorID, alloc storiface.SectorFileType, destPtype storiface.PathType) *moveSelector {
func newMoveSelector(index stores.SectorIndex, sector abi.SectorID, alloc storiface.SectorFileType, destPtype storiface.PathType, allowRemote bool) *moveSelector {
return &moveSelector{
index: index,
sector: sector,
alloc: alloc,
destPtype: destPtype,
index: index,
sector: sector,
alloc: alloc,
destPtype: destPtype,
allowRemote: allowRemote,
}
}

Expand Down Expand Up @@ -86,7 +88,7 @@ func (s *moveSelector) Ok(ctx context.Context, task sealtasks.TaskType, spt abi.
}
}

return ok, false, nil
return ok && s.allowRemote, false, nil
}

func (s *moveSelector) Cmp(ctx context.Context, task sealtasks.TaskType, a, b *WorkerHandle) (bool, error) {
Expand Down
7 changes: 7 additions & 0 deletions node/config/doc_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node/config/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (c *StorageMiner) StorageManager() sectorstorage.Config {
AllowProveReplicaUpdate2: c.Storage.AllowProveReplicaUpdate2,
AllowRegenSectorKey: c.Storage.AllowRegenSectorKey,
ResourceFiltering: c.Storage.ResourceFiltering,
DisallowRemoteFinalize: c.Storage.DisallowRemoteFinalize,

Assigner: c.Storage.Assigner,

Expand Down
13 changes: 13 additions & 0 deletions node/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,19 @@ type SealerConfig struct {
// "spread" - assign tasks to as many distinct workers as possible.
Assigner string

// DisallowRemoteFinalize when set to true will force all Finalize tasks to
// run on workers with local access to both long-term storage and the sealing
// path containing the sector.
//
// WARNING: Only set this if all workers have access to long-term storage
// paths. If this flag is enabled, and there are workers without long-term
// storage access, sectors will not be moved from them, and Finalize tasks
// will appear to be stuck.
//
// If you see stuck Finalize tasks after enabling this setting, check
// 'lotus-miner sealing sched-diag' and 'lotus-miner storage find [sector num]'
DisallowRemoteFinalize bool

// ResourceFiltering instructs the system which resource filtering strategy
// to use when evaluating tasks against this worker. An empty value defaults
// to "hardware".
Expand Down

0 comments on commit 7612860

Please sign in to comment.