Skip to content

Commit

Permalink
Set VReplicationStreamState to Copying on resumption
Browse files Browse the repository at this point in the history
Previously, the `VReplicationStreamState` would initialize as Copying,
but if stopped and restarted, the state shows as Running (despite the
workflow status showing as Copying). This mismatch can cause errors in
reporting and monitoring (depending on which status one recognizes).

This change sets the `VReplicationWorkflowState` (and thereby
`VReplicationStreamState`) as Copying when the copy workflow is resumed.
The workflow status and `VReplicationStreamState` stat are now synced.

Signed-off-by: Tyler Coleman <[email protected]>
  • Loading branch information
tycol7 committed Feb 22, 2024
1 parent 27be916 commit 11edc63
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/vt/vttablet/tabletmanager/vreplication/vcopier.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ func (vc *vcopier) copyTable(ctx context.Context, tableName string, copyState ma
defer vc.vr.stats.PhaseTimings.Record("copy", time.Now())
defer vc.vr.stats.CopyLoopCount.Add(1)

if err := vc.vr.setState(binlogdatapb.VReplicationWorkflowState_Copying, ""); err != nil {
return err
}
log.Infof("Copying table %s, lastpk: %v", tableName, copyState[tableName])

plan, err := buildReplicatorPlan(vc.vr.source, vc.vr.colInfoMap, nil, vc.vr.stats, vc.vr.vre.env.CollationEnv(), vc.vr.vre.env.Parser())
Expand Down

0 comments on commit 11edc63

Please sign in to comment.