diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b753e60122..73759d91224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ For certain node operators, such as full archival nodes or systems that need to - The miner actor builtin `QAPowerForWeight` no longer accepts the unused "dealWeight" parameter, the function signature now only takes 3 arguments: sectorSize, sectorDuration, verifiedWeight. ([filecoin-project/lotus#12445](https://github.com/filecoin-project/lotus/pull/12445)) - Fix checkpointed tipsets being expanded ([filecoin-project/lotus#12747](https://github.com/filecoin-project/lotus/pull/12747)) - Remove IPNI advertisement relay over pubsub via Lotus node as it now has been deprecated. ([filecoin-project/lotus#12768](https://github.com/filecoin-project/lotus/pull/12768) +- During a network upgrade, log migration progress every 2 seconds so they are more helpful and informative. The `LOTUS_MIGRATE_PROGRESS_LOG_SECONDS` environment variable can be used to change this if needed. ([filecoin-project/lotus#12732](https://github.com/filecoin-project/lotus/pull/12732)) ## Bug Fixes diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index 3f68960861f..a93af1f4420 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -2754,9 +2754,14 @@ func PreUpgradeActorsV16(ctx context.Context, sm *stmgr.StateManager, cache stmg return xerrors.Errorf("error getting lookback ts for premigration: %w", err) } + logPeriod, err := getMigrationProgressLogPeriod() + if err != nil { + return xerrors.Errorf("error getting progress log period: %w", err) + } + config := migration.Config{ MaxWorkers: uint(workerCount), - ProgressLogPeriod: time.Minute * 5, + ProgressLogPeriod: logPeriod, } _, err = upgradeActorsV16Common(ctx, sm, cache, lbRoot, epoch, lbts, config) @@ -2770,11 +2775,17 @@ func UpgradeActorsV16(ctx context.Context, sm *stmgr.StateManager, cache stmgr.M if workerCount <= 0 { workerCount = 1 } + + logPeriod, err := getMigrationProgressLogPeriod() + if err != nil { + return cid.Undef, xerrors.Errorf("error getting progress log period: %w", err) + } + config := migration.Config{ MaxWorkers: uint(workerCount), JobQueueSize: 1000, ResultQueueSize: 100, - ProgressLogPeriod: 10 * time.Second, + ProgressLogPeriod: logPeriod, } newRoot, err := upgradeActorsV16Common(ctx, sm, cache, root, epoch, ts, config) if err != nil { @@ -3005,3 +3016,19 @@ func (ml migrationLogger) Log(level rt.LogLevel, msg string, args ...interface{} log.Errorf(msg, args...) } } + +func getMigrationProgressLogPeriod() (time.Duration, error) { + logPeriod := time.Second * 2 // default period + period := os.Getenv("LOTUS_MIGRATE_PROGRESS_LOG_SECONDS") + if period != "" { + seconds, err := strconv.Atoi(period) + if err != nil { + return 0, xerrors.Errorf("LOTUS_MIGRATE_PROGRESS_LOG_SECONDS must be an integer: %w", err) + } + if seconds <= 0 { + return 0, xerrors.Errorf("LOTUS_MIGRATE_PROGRESS_LOG_SECONDS must be positive") + } + logPeriod = time.Duration(seconds) * time.Second + } + return logPeriod, nil +} diff --git a/documentation/misc/Building_a_network_skeleton.md b/documentation/misc/Building_a_network_skeleton.md index d7d1fdbc9e0..1fae76b923b 100644 --- a/documentation/misc/Building_a_network_skeleton.md +++ b/documentation/misc/Building_a_network_skeleton.md @@ -456,9 +456,14 @@ Typically it's safe to not upgrade filecoin-ffi's version of go-state-types. Th return xerrors.Errorf("error getting lookback ts for premigration: %w", err) } + logPeriod, err := getMigrationProgressLogPeriod() + if err != nil { + return xerrors.Errorf("error getting progress log period: %w", err) + } + config := migration.Config{ MaxWorkers: uint(workerCount), - ProgressLogPeriod: time.Minute * 5, + ProgressLogPeriod: logPeriod, } _, err = upgradeActorsV(XX+1)Common(ctx, sm, cache, lbRoot, epoch, lbts, config) @@ -472,11 +477,17 @@ Typically it's safe to not upgrade filecoin-ffi's version of go-state-types. Th if workerCount <= 0 { workerCount = 1 } + + logPeriod, err := getMigrationProgressLogPeriod() + if err != nil { + return cid.Undef, xerrors.Errorf("error getting progress log period: %w", err) + } + config := migration.Config{ MaxWorkers: uint(workerCount), JobQueueSize: 1000, ResultQueueSize: 100, - ProgressLogPeriod: 10 * time.Second, + ProgressLogPeriod: logPeriod, } newRoot, err := upgradeActorsV(XX+1)Common(ctx, sm, cache, root, epoch, ts, config) if err != nil {