Skip to content

Commit

Permalink
update func GetBackupCandidates
Browse files Browse the repository at this point in the history
Signed-off-by: Jun Wang <[email protected]>
  • Loading branch information
Jun Wang committed Nov 28, 2023
1 parent d846316 commit ddad61a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/vt/vtctl/reparentutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,16 @@ func waitForCatchUp(

// GetBackupCandidates is used to get a list of healthy tablets for backup
func GetBackupCandidates(tablets []*topo.TabletInfo, stats []*replicationdatapb.Status) (res []*topo.TabletInfo) {
// In case of all tablets has nil stats, return TabletType_PRIMARY
if len(stats) == 0 {
for _, tablet := range tablets {
if tablet.Type == topodatapb.TabletType_PRIMARY {
res = append(res, tablet)
break
}
}
return res
}
for i, stat := range stats {
// Always include TabletType_PRIMARY
if tablets[i].Type == topodatapb.TabletType_PRIMARY {
Expand Down

0 comments on commit ddad61a

Please sign in to comment.