fix: sealer: allow enable/disabling ReplicaUpdate tasks

This commit is contained in:
Aayush 2022-02-14 13:28:49 -05:00
parent 095d5d2e31
commit 75b8e4c981
7 changed files with 36 additions and 13 deletions

View File

@ -467,12 +467,15 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode
stor := stores.NewRemote(lstor, si, http.Header(sa), 10, &stores.DefaultPartialFileHandler{}) stor := stores.NewRemote(lstor, si, http.Header(sa), 10, &stores.DefaultPartialFileHandler{})
smgr, err := sectorstorage.New(ctx, lstor, stor, lr, si, sectorstorage.SealerConfig{ smgr, err := sectorstorage.New(ctx, lstor, stor, lr, si, sectorstorage.SealerConfig{
ParallelFetchLimit: 10, ParallelFetchLimit: 10,
AllowAddPiece: true, AllowAddPiece: true,
AllowPreCommit1: true, AllowPreCommit1: true,
AllowPreCommit2: true, AllowPreCommit2: true,
AllowCommit: true, AllowCommit: true,
AllowUnseal: true, AllowUnseal: true,
AllowReplicaUpdate: true,
AllowProveReplicaUpdate2: true,
AllowRegenSectorKey: true,
}, wsts, smsts) }, wsts, smsts)
if err != nil { if err != nil {
return err return err

View File

@ -173,6 +173,11 @@ var runCmd = &cli.Command{
Usage: "enable prove replica update 2", Usage: "enable prove replica update 2",
Value: true, Value: true,
}, },
&cli.BoolFlag{
Name: "regen-sector-key",
Usage: "enable regen sector key",
Value: true,
},
&cli.IntFlag{ &cli.IntFlag{
Name: "parallel-fetch-limit", Name: "parallel-fetch-limit",
Usage: "maximum fetch operations to run in parallel", Usage: "maximum fetch operations to run in parallel",
@ -284,6 +289,9 @@ var runCmd = &cli.Command{
if cctx.Bool("prove-replica-update2") { if cctx.Bool("prove-replica-update2") {
taskTypes = append(taskTypes, sealtasks.TTProveReplicaUpdate2) taskTypes = append(taskTypes, sealtasks.TTProveReplicaUpdate2)
} }
if cctx.Bool("regen-sector-key") {
taskTypes = append(taskTypes, sealtasks.TTRegenSectorKey)
}
if len(taskTypes) == 0 { if len(taskTypes) == 0 {
return xerrors.Errorf("no task types specified") return xerrors.Errorf("no task types specified")

View File

@ -22,11 +22,14 @@ var tasksCmd = &cli.Command{
} }
var allowSetting = map[sealtasks.TaskType]struct{}{ var allowSetting = map[sealtasks.TaskType]struct{}{
sealtasks.TTAddPiece: {}, sealtasks.TTAddPiece: {},
sealtasks.TTPreCommit1: {}, sealtasks.TTPreCommit1: {},
sealtasks.TTPreCommit2: {}, sealtasks.TTPreCommit2: {},
sealtasks.TTCommit2: {}, sealtasks.TTCommit2: {},
sealtasks.TTUnseal: {}, sealtasks.TTUnseal: {},
sealtasks.TTReplicaUpdate: {},
sealtasks.TTProveReplicaUpdate2: {},
sealtasks.TTRegenSectorKey: {},
} }
var settableStr = func() string { var settableStr = func() string {

View File

@ -46,6 +46,7 @@ OPTIONS:
--commit enable commit (32G sectors: all cores or GPUs, 128GiB Memory + 64GiB swap) (default: true) --commit enable commit (32G sectors: all cores or GPUs, 128GiB Memory + 64GiB swap) (default: true)
--replica-update enable replica update (default: true) --replica-update enable replica update (default: true)
--prove-replica-update2 enable prove replica update 2 (default: true) --prove-replica-update2 enable prove replica update 2 (default: true)
--regen-sector-key enable regen sector key (default: true)
--parallel-fetch-limit value maximum fetch operations to run in parallel (default: 5) --parallel-fetch-limit value maximum fetch operations to run in parallel (default: 5)
--timeout value used when 'listen' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function (default: "30m") --timeout value used when 'listen' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function (default: "30m")
--help, -h show help (default: false) --help, -h show help (default: false)
@ -170,7 +171,7 @@ NAME:
lotus-worker tasks enable - Enable a task type lotus-worker tasks enable - Enable a task type
USAGE: USAGE:
lotus-worker tasks enable [command options] [UNS|C2|PC2|PC1|AP] lotus-worker tasks enable [command options] [UNS|C2|PC2|PC1|PR2|RU|AP|GSK]
OPTIONS: OPTIONS:
--help, -h show help (default: false) --help, -h show help (default: false)
@ -183,7 +184,7 @@ NAME:
lotus-worker tasks disable - Disable a task type lotus-worker tasks disable - Disable a task type
USAGE: USAGE:
lotus-worker tasks disable [command options] [UNS|C2|PC2|PC1|AP] lotus-worker tasks disable [command options] [UNS|C2|PC2|PC1|PR2|RU|AP|GSK]
OPTIONS: OPTIONS:
--help, -h show help (default: false) --help, -h show help (default: false)

View File

@ -438,6 +438,9 @@
# env var: LOTUS_STORAGE_ALLOWPROVEREPLICAUPDATE2 # env var: LOTUS_STORAGE_ALLOWPROVEREPLICAUPDATE2
#AllowProveReplicaUpdate2 = true #AllowProveReplicaUpdate2 = true
# env var: LOTUS_STORAGE_ALLOWREGENSECTORKEY
#AllowRegenSectorKey = true
# env var: LOTUS_STORAGE_RESOURCEFILTERING # env var: LOTUS_STORAGE_RESOURCEFILTERING
#ResourceFiltering = "hardware" #ResourceFiltering = "hardware"

View File

@ -105,6 +105,7 @@ type SealerConfig struct {
AllowUnseal bool AllowUnseal bool
AllowReplicaUpdate bool AllowReplicaUpdate bool
AllowProveReplicaUpdate2 bool AllowProveReplicaUpdate2 bool
AllowRegenSectorKey bool
// ResourceFiltering instructs the system which resource filtering strategy // ResourceFiltering instructs the system which resource filtering strategy
// to use when evaluating tasks against this worker. An empty value defaults // to use when evaluating tasks against this worker. An empty value defaults
@ -169,6 +170,9 @@ func New(ctx context.Context, lstor *stores.Local, stor *stores.Remote, ls store
if sc.AllowProveReplicaUpdate2 { if sc.AllowProveReplicaUpdate2 {
localTasks = append(localTasks, sealtasks.TTProveReplicaUpdate2) localTasks = append(localTasks, sealtasks.TTProveReplicaUpdate2)
} }
if sc.AllowRegenSectorKey {
localTasks = append(localTasks, sealtasks.TTRegenSectorKey)
}
wcfg := WorkerConfig{ wcfg := WorkerConfig{
IgnoreResourceFiltering: sc.ResourceFiltering == ResourceFilteringDisabled, IgnoreResourceFiltering: sc.ResourceFiltering == ResourceFilteringDisabled,

View File

@ -139,6 +139,7 @@ func DefaultStorageMiner() *StorageMiner {
AllowUnseal: true, AllowUnseal: true,
AllowReplicaUpdate: true, AllowReplicaUpdate: true,
AllowProveReplicaUpdate2: true, AllowProveReplicaUpdate2: true,
AllowRegenSectorKey: true,
// Default to 10 - tcp should still be able to figure this out, and // Default to 10 - tcp should still be able to figure this out, and
// it's the ratio between 10gbit / 1gbit // it's the ratio between 10gbit / 1gbit