Skip to content

Commit 9dac6b0

Browse files
virajbhartiyarjan90
authored andcommitted
chore: more frequent migration progress logs (#12732)
1 parent 7124b7d commit 9dac6b0

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ For certain node operators, such as full archival nodes or systems that need to
4848
- 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))
4949
- Fix checkpointed tipsets being expanded ([filecoin-project/lotus#12747](https://github.com/filecoin-project/lotus/pull/12747))
5050
- 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)
51+
- 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))
5152

5253
## Bug Fixes
5354

chain/consensus/filcns/upgrades.go

+29-2
Original file line numberDiff line numberDiff line change
@@ -2754,9 +2754,14 @@ func PreUpgradeActorsV16(ctx context.Context, sm *stmgr.StateManager, cache stmg
27542754
return xerrors.Errorf("error getting lookback ts for premigration: %w", err)
27552755
}
27562756

2757+
logPeriod, err := getMigrationProgressLogPeriod()
2758+
if err != nil {
2759+
return xerrors.Errorf("error getting progress log period: %w", err)
2760+
}
2761+
27572762
config := migration.Config{
27582763
MaxWorkers: uint(workerCount),
2759-
ProgressLogPeriod: time.Minute * 5,
2764+
ProgressLogPeriod: logPeriod,
27602765
}
27612766

27622767
_, err = upgradeActorsV16Common(ctx, sm, cache, lbRoot, epoch, lbts, config)
@@ -2770,11 +2775,17 @@ func UpgradeActorsV16(ctx context.Context, sm *stmgr.StateManager, cache stmgr.M
27702775
if workerCount <= 0 {
27712776
workerCount = 1
27722777
}
2778+
2779+
logPeriod, err := getMigrationProgressLogPeriod()
2780+
if err != nil {
2781+
return cid.Undef, xerrors.Errorf("error getting progress log period: %w", err)
2782+
}
2783+
27732784
config := migration.Config{
27742785
MaxWorkers: uint(workerCount),
27752786
JobQueueSize: 1000,
27762787
ResultQueueSize: 100,
2777-
ProgressLogPeriod: 10 * time.Second,
2788+
ProgressLogPeriod: logPeriod,
27782789
}
27792790
newRoot, err := upgradeActorsV16Common(ctx, sm, cache, root, epoch, ts, config)
27802791
if err != nil {
@@ -3005,3 +3016,19 @@ func (ml migrationLogger) Log(level rt.LogLevel, msg string, args ...interface{}
30053016
log.Errorf(msg, args...)
30063017
}
30073018
}
3019+
3020+
func getMigrationProgressLogPeriod() (time.Duration, error) {
3021+
logPeriod := time.Second * 2 // default period
3022+
period := os.Getenv("LOTUS_MIGRATE_PROGRESS_LOG_SECONDS")
3023+
if period != "" {
3024+
seconds, err := strconv.Atoi(period)
3025+
if err != nil {
3026+
return 0, xerrors.Errorf("LOTUS_MIGRATE_PROGRESS_LOG_SECONDS must be an integer: %w", err)
3027+
}
3028+
if seconds <= 0 {
3029+
return 0, xerrors.Errorf("LOTUS_MIGRATE_PROGRESS_LOG_SECONDS must be positive")
3030+
}
3031+
logPeriod = time.Duration(seconds) * time.Second
3032+
}
3033+
return logPeriod, nil
3034+
}

documentation/misc/Building_a_network_skeleton.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,14 @@ Typically it's safe to not upgrade filecoin-ffi's version of go-state-types. Th
456456
return xerrors.Errorf("error getting lookback ts for premigration: %w", err)
457457
}
458458
459+
logPeriod, err := getMigrationProgressLogPeriod()
460+
if err != nil {
461+
return xerrors.Errorf("error getting progress log period: %w", err)
462+
}
463+
459464
config := migration.Config{
460465
MaxWorkers: uint(workerCount),
461-
ProgressLogPeriod: time.Minute * 5,
466+
ProgressLogPeriod: logPeriod,
462467
}
463468
464469
_, 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
472477
if workerCount <= 0 {
473478
workerCount = 1
474479
}
480+
481+
logPeriod, err := getMigrationProgressLogPeriod()
482+
if err != nil {
483+
return cid.Undef, xerrors.Errorf("error getting progress log period: %w", err)
484+
}
485+
475486
config := migration.Config{
476487
MaxWorkers: uint(workerCount),
477488
JobQueueSize: 1000,
478489
ResultQueueSize: 100,
479-
ProgressLogPeriod: 10 * time.Second,
490+
ProgressLogPeriod: logPeriod,
480491
}
481492
newRoot, err := upgradeActorsV(XX+1)Common(ctx, sm, cache, root, epoch, ts, config)
482493
if err != nil {

0 commit comments

Comments
 (0)