Skip to content

Commit

Permalink
Minor optimization for copying phase
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Jan 23, 2025
1 parent bb1207a commit ad09bb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions go/vt/vtctl/workflow/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,9 @@ func getStreamState(stream *vtctldatapb.Workflow_Stream, rstream *tabletmanagerd
// switching during the copy phase, so in that case we just return a large lag.
// All timestamps are in seconds since epoch.
func getVReplicationTrxLag(trxTs, updatedTs, heartbeatTs *vttimepb.Time, state binlogdatapb.VReplicationWorkflowState) float64 {
if state == binlogdatapb.VReplicationWorkflowState_Copying {
return math.MaxInt64
}
if trxTs == nil {
trxTs = &vttimepb.Time{}
}
Expand All @@ -668,9 +671,6 @@ func getVReplicationTrxLag(trxTs, updatedTs, heartbeatTs *vttimepb.Time, state b
heartbeatTs = &vttimepb.Time{}
}
lastHeartbeatTime := heartbeatTs.Seconds
if state == binlogdatapb.VReplicationWorkflowState_Copying {
return math.MaxInt64
}
// We do NOT update the heartbeat timestamp when we are regularly updating the
// position as we replicate transactions (GTIDs).
// When we DO record a heartbeat, we set the updated time to the same value.
Expand Down

0 comments on commit ad09bb0

Please sign in to comment.