From ad09bb01d8336d57e8ff3b03848858d64a4fcec3 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Thu, 23 Jan 2025 22:48:41 +0000 Subject: [PATCH] Minor optimization for copying phase Signed-off-by: Matt Lord --- go/vt/vtctl/workflow/workflows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/go/vt/vtctl/workflow/workflows.go b/go/vt/vtctl/workflow/workflows.go index 0418e005682..a1b4393f2c0 100644 --- a/go/vt/vtctl/workflow/workflows.go +++ b/go/vt/vtctl/workflow/workflows.go @@ -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{} } @@ -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.