Skip to content

Commit

Permalink
feat: fix ReplicaWasRunning so that it doesn't have code dependent on…
Browse files Browse the repository at this point in the history
… the upgrade

Signed-off-by: Manan Gupta <manan@planetscale.com>
  • Loading branch information
GuptaManan100 committed Apr 29, 2022
1 parent 7dd3dad commit cdca70e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions go/vt/vtctl/reparentutil/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,9 @@ func ReplicaWasRunning(stopStatus *replicationdatapb.StopReplicationStatus) (boo
return false, vterrors.Errorf(vtrpc.Code_INVALID_ARGUMENT, "could not determine Before state of StopReplicationStatus %v", stopStatus)
}

// v13 and older tablets will only provide the binary IoThreadRunning and
// SqlThreadRunning values while v14 and newer tablets will provide the
// non-binary replication states.
// This backwards compatible check can be removed in v15+.
return ((stopStatus.Before.IoState == int32(mysql.ReplicationStateRunning) || stopStatus.Before.IoThreadRunning) ||
(stopStatus.Before.SqlState == int32(mysql.ReplicationStateRunning) || stopStatus.Before.SqlThreadRunning)), nil
replStatus := mysql.ProtoToReplicationStatus(stopStatus.Before)
return (replStatus.IOState == mysql.ReplicationStateRunning) ||
(replStatus.SQLState == mysql.ReplicationStateRunning), nil
}

// SetReplicationSource is used to set the replication source on the specified
Expand Down

0 comments on commit cdca70e

Please sign in to comment.