Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: deepthi <[email protected]>
  • Loading branch information
deepthi committed Sep 6, 2024
1 parent c6d246d commit 77018e9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go/vt/vtctl/reparentutil/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func FindValidEmergencyReparentCandidates(
case len(errantGTIDs) != 0:
// This tablet has errant GTIDs. It's not a valid candidate for
// reparent, so don't insert it into the final mapping.
log.Errorf("skipping %v because we detected errant GTIDs - %v", alias, errantGTIDs)
log.Errorf("skipping %v with GTIDSet:%v because we detected errant GTIDs - %v", alias, relayLogGTIDSet, errantGTIDs)
continue
}

Expand Down
30 changes: 27 additions & 3 deletions go/vt/vtctl/reparentutil/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) {
shouldErr: false,
},
{
name: "tablet with errant GTIDs is excluded",
name: "tablet with superset GTIDs is included",
statusMap: map[string]*replicationdatapb.StopReplicationStatus{
"r1": {
After: &replicationdatapb.Status{
SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562",
RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5",
},
},
"errant": {
"r2": {
After: &replicationdatapb.Status{
SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562",
RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5,AAAAAAAA-71CA-11E1-9E33-C80AA9429562:1",
Expand All @@ -181,7 +181,31 @@ func TestFindValidEmergencyReparentCandidates(t *testing.T) {
Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5",
},
},
expected: []string{"r1", "p1"},
expected: []string{"r1", "r2", "p1"},
shouldErr: false,
},
{
name: "tablets with errant GTIDs are excluded",
statusMap: map[string]*replicationdatapb.StopReplicationStatus{
"r1": {
After: &replicationdatapb.Status{
SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562",
RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5,AAAAAAAA-71CA-11E1-9E33-C80AA9429562:1",
},
},
"r2": {
After: &replicationdatapb.Status{
SourceUuid: "3E11FA47-71CA-11E1-9E33-C80AA9429562",
RelayLogPosition: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5,AAAAAAAA-71CA-11E1-9E33-C80AA9429562:2-3",
},
},
},
primaryStatusMap: map[string]*replicationdatapb.PrimaryStatus{
"p1": {
Position: "MySQL56/3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5",
},
},
expected: []string{"p1"},
shouldErr: false,
},
{
Expand Down

0 comments on commit 77018e9

Please sign in to comment.