Skip to content

Commit

Permalink
refactor: standardize migration progress log terminology from timeout…
Browse files Browse the repository at this point in the history
… to period across functions and documentation
  • Loading branch information
virajbhartiya committed Dec 12, 2024
1 parent 5e62a5f commit bf9460e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- Add json output of tipsets to `louts chain list`. ([filecoin-project/lotus#12691](https://github.com/filecoin-project/lotus/pull/12691))
- 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)
- Add `LOTUS_MIGRATE_PROGRESS_LOG_SECONDS` environment variable to control the log period of the migration progress. ([filecoin-project/lotus#12732](https://github.com/filecoin-project/lotus/pull/12732))

# UNRELEASED v.1.32.0

Expand Down
20 changes: 10 additions & 10 deletions chain/consensus/filcns/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2754,14 +2754,14 @@ func PreUpgradeActorsV16(ctx context.Context, sm *stmgr.StateManager, cache stmg
return xerrors.Errorf("error getting lookback ts for premigration: %w", err)
}

timeoutDuration, err := getMigrationProgressLogPeriod()
logPeriod, err := getMigrationProgressLogPeriod()
if err != nil {
return xerrors.Errorf("error getting progress log period: %w", err)
}

config := migration.Config{
MaxWorkers: uint(workerCount),
ProgressLogPeriod: timeoutDuration,
ProgressLogPeriod: logPeriod,
}

_, err = upgradeActorsV16Common(ctx, sm, cache, lbRoot, epoch, lbts, config)
Expand All @@ -2776,7 +2776,7 @@ func UpgradeActorsV16(ctx context.Context, sm *stmgr.StateManager, cache stmgr.M
workerCount = 1
}

timeoutDuration, err := getMigrationProgressLogPeriod()
logPeriod, err := getMigrationProgressLogPeriod()
if err != nil {
return cid.Undef, xerrors.Errorf("error getting progress log period: %w", err)
}
Expand All @@ -2785,7 +2785,7 @@ func UpgradeActorsV16(ctx context.Context, sm *stmgr.StateManager, cache stmgr.M
MaxWorkers: uint(workerCount),
JobQueueSize: 1000,
ResultQueueSize: 100,
ProgressLogPeriod: timeoutDuration,
ProgressLogPeriod: logPeriod,
}
newRoot, err := upgradeActorsV16Common(ctx, sm, cache, root, epoch, ts, config)
if err != nil {
Expand Down Expand Up @@ -3018,17 +3018,17 @@ func (ml migrationLogger) Log(level rt.LogLevel, msg string, args ...interface{}
}

func getMigrationProgressLogPeriod() (time.Duration, error) {
timeoutDuration := time.Second * 2 // default timeout
timeout := os.Getenv("LOTUS_MIGRATE_PROGRESS_LOG_SECONDS")
if timeout != "" {
seconds, err := strconv.Atoi(timeout)
logPeriod := time.Second * 2 // default timeout
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")
}
timeoutDuration = time.Duration(seconds) * time.Second
logPeriod = time.Duration(seconds) * time.Second
}
return timeoutDuration, nil
return logPeriod, nil
}
8 changes: 4 additions & 4 deletions documentation/misc/Building_a_network_skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +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)
}
timeoutDuration, err := getMigrationProgressLogPeriod()
logPeriod, err := getMigrationProgressLogPeriod()
if err != nil {
return xerrors.Errorf("error getting progress log period: %w", err)
}
config := migration.Config{
MaxWorkers: uint(workerCount),
ProgressLogPeriod: timeoutDuration,
ProgressLogPeriod: logPeriod,
}
_, err = upgradeActorsV(XX+1)Common(ctx, sm, cache, lbRoot, epoch, lbts, config)
Expand All @@ -478,7 +478,7 @@ Typically it's safe to not upgrade filecoin-ffi's version of go-state-types. Th
workerCount = 1
}
timeoutDuration, err := getMigrationProgressLogPeriod()
logPeriod, err := getMigrationProgressLogPeriod()
if err != nil {
return cid.Undef, xerrors.Errorf("error getting progress log period: %w", err)
}
Expand All @@ -487,7 +487,7 @@ Typically it's safe to not upgrade filecoin-ffi's version of go-state-types. Th
MaxWorkers: uint(workerCount),
JobQueueSize: 1000,
ResultQueueSize: 100,
ProgressLogPeriod: timeoutDuration,
ProgressLogPeriod: logPeriod,
}
newRoot, err := upgradeActorsV(XX+1)Common(ctx, sm, cache, root, epoch, ts, config)
if err != nil {
Expand Down

0 comments on commit bf9460e

Please sign in to comment.