Skip to content

Commit

Permalink
Correct primary tablet type filtering in switchReads
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Apr 5, 2022
1 parent 2ff4613 commit 7dba144
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions go/vt/wrangler/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,18 @@ func (vrw *VReplicationWorkflow) initReshard() error {

func (vrw *VReplicationWorkflow) switchReads() (*[]string, error) {
log.Infof("In VReplicationWorkflow.switchReads() for %+v", vrw)
tabletTypes, _, err := discovery.ParseTabletTypesAndOrder(vrw.params.TabletTypes)
fullTabletTypes, _, err := discovery.ParseTabletTypesAndOrder(vrw.params.TabletTypes)
if err != nil {
return nil, err
}
for _, tt := range tabletTypes {
var nonPrimaryTabletTypes []topodatapb.TabletType
for _, tt := range fullTabletTypes {
if tt != topodatapb.TabletType_PRIMARY {
tabletTypes = append(tabletTypes, tt)
nonPrimaryTabletTypes = append(nonPrimaryTabletTypes, tt)
}
}
var dryRunResults *[]string
dryRunResults, err = vrw.wr.SwitchReads(vrw.ctx, vrw.params.TargetKeyspace, vrw.params.Workflow, tabletTypes,
dryRunResults, err = vrw.wr.SwitchReads(vrw.ctx, vrw.params.TargetKeyspace, vrw.params.Workflow, nonPrimaryTabletTypes,
vrw.getCellsAsArray(), vrw.params.Direction, vrw.params.DryRun)
if err != nil {
return nil, err
Expand Down

0 comments on commit 7dba144

Please sign in to comment.