Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(migration): improve job progress logging in MigrateStateTree #329

Merged
merged 7 commits into from
Dec 3, 2024
10 changes: 5 additions & 5 deletions migration/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ func RunMigration(ctx context.Context, cfg Config, cache MigrationCache, store c
for {
select {
case <-time.After(cfg.ProgressLogPeriod):
jobsNow := jobCount // Snapshot values to avoid incorrect-looking arithmetic if they change.
doneNow := doneCount
pendingNow := jobsNow - doneNow
jobsNow := atomic.LoadUint32(&jobCount)
doneNow := atomic.LoadUint32(&doneCount)
elapsed := time.Since(startTime)
rate := float64(doneNow) / elapsed.Seconds()
log.Log(rt.INFO, "%d jobs created, %d done, %d pending after %v (%.0f/s)",
jobsNow, doneNow, pendingNow, elapsed, rate)

log.Log(rt.INFO, "Performing migration: %d of %d jobs processed (%.0f/s) [%v elapsed]",
doneNow, jobsNow, rate, elapsed.Round(time.Second))
case <-workersFinished:
return
case <-ctx.Done():
Expand Down
Loading