Skip to content

Commit 8d90d26

Browse files
authored
Online DDL: set migration's progress to 100% once it's ready_to_complete (#18544)
Signed-off-by: Shlomi Noach <[email protected]>
1 parent f27b909 commit 8d90d26

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

go/test/endtoend/onlineddl/scheduler/onlineddl_scheduler_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ func testScheduler(t *testing.T) {
569569
require.NotNil(t, rs)
570570
for _, row := range rs.Named().Rows {
571571
assert.True(t, row["shadow_analyzed_timestamp"].IsNull())
572+
assert.Equal(t, 100.0, row.AsFloat64("progress", 0))
572573
}
573574
})
574575

@@ -619,6 +620,7 @@ func testScheduler(t *testing.T) {
619620
require.NotNil(t, rs)
620621
for _, row := range rs.Named().Rows {
621622
assert.True(t, row["shadow_analyzed_timestamp"].IsNull())
623+
assert.Equal(t, 100.0, row.AsFloat64("progress", 0))
622624
}
623625
})
624626

go/vt/vttablet/onlineddl/executor.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,6 +4041,15 @@ func (e *Executor) updateMigrationReadyToComplete(ctx context.Context, uuid stri
40414041
atomic.StoreInt64(&runningMigration.ReadyToComplete, storeValue)
40424042
}
40434043
}
4044+
4045+
if isReady {
4046+
// We set progress to 100%. Remember that progress is based on table rows estimation. We can get here
4047+
// with progress 87% or another value that is way off. But once we realize the migration is ready to complete,
4048+
// we know row copy is fully complete _and_ that vplayer is not far behind. So it's a better DX to report 100%.
4049+
if err = e.updateMigrationProgress(ctx, uuid, progressPctFull); err != nil {
4050+
return err
4051+
}
4052+
}
40444053
return nil
40454054
}
40464055

0 commit comments

Comments
 (0)