Skip to content

Commit

Permalink
Add comment about when backward compat can be removed
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Apr 29, 2022
1 parent 613da12 commit e340dfc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion go/mysql/replication_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ func ProtoToReplicationStatus(s *replicationdatapb.Status) ReplicationStatus {
}

// We need to be able to process gRPC response messages from v13 and older tablets.
// In those cases there will be no value (uknown) for the IoState or SqlState but
// In those cases there will be no value (unknown) for the IoState or SqlState but
// the message will have the IoThreadRunning and SqlThreadRunning booleans and we
// need to revert to our assumptions about a binary state as that's all the older
// tablet can provide (really only applicable to the IO status as that is NOT binary
// but rather has three states: Running, Stopped, Connecting).
// This backwards compatibility can be removed in v15+.
if replstatus.IOState == ReplicationStateUnknown {
if s.IoThreadRunning {
replstatus.IOState = ReplicationStateRunning
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtctl/reparentutil/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func ReplicaWasRunning(stopStatus *replicationdatapb.StopReplicationStatus) (boo
// 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.
// 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
}
Expand All @@ -168,7 +168,7 @@ func SQLThreadWasRunning(stopStatus *replicationdatapb.StopReplicationStatus) (b

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

Expand Down

0 comments on commit e340dfc

Please sign in to comment.