diff --git a/go/vt/wrangler/traffic_switcher.go b/go/vt/wrangler/traffic_switcher.go index d380fd78835..6e2960a17bd 100644 --- a/go/vt/wrangler/traffic_switcher.go +++ b/go/vt/wrangler/traffic_switcher.go @@ -676,6 +676,9 @@ func (wr *Wrangler) DropTargets(ctx context.Context, targetKeyspace, workflow st if err := wr.dropArtifacts(ctx, sw); err != nil { return nil, err } + if err := ts.wr.ts.RebuildSrvVSchema(ctx, nil); err != nil { + return nil, err + } return sw.logs(), nil } @@ -750,6 +753,10 @@ func (wr *Wrangler) DropSources(ctx context.Context, targetKeyspace, workflow st if err := wr.dropArtifacts(ctx, sw); err != nil { return nil, err } + if err := ts.wr.ts.RebuildSrvVSchema(ctx, nil); err != nil { + return nil, err + } + return sw.logs(), nil } @@ -1102,7 +1109,7 @@ func (ts *trafficSwitcher) changeTableSourceWrites(ctx context.Context, access a }); err != nil { return err } - return ts.wr.tmc.RefreshState(ctx, source.master.Tablet) + return ts.wr.RefreshTabletsByShard(ctx, source.si, nil, nil) }) } @@ -1337,7 +1344,7 @@ func (ts *trafficSwitcher) allowTableTargetWrites(ctx context.Context) error { }); err != nil { return err } - return ts.wr.tmc.RefreshState(ctx, target.master.Tablet) + return ts.wr.RefreshTabletsByShard(ctx, target.si, nil, nil) }) } @@ -1481,7 +1488,7 @@ func (ts *trafficSwitcher) dropSourceBlacklistedTables(ctx context.Context) erro }); err != nil { return err } - return ts.wr.tmc.RefreshState(ctx, source.master.Tablet) + return ts.wr.RefreshTabletsByShard(ctx, source.si, nil, nil) }) } diff --git a/go/vt/wrangler/traffic_switcher_test.go b/go/vt/wrangler/traffic_switcher_test.go index 092ce43fd18..8a8658c2dfa 100644 --- a/go/vt/wrangler/traffic_switcher_test.go +++ b/go/vt/wrangler/traffic_switcher_test.go @@ -915,10 +915,28 @@ func TestTableMigrateOneToMany(t *testing.T) { } dropSources() + checkRouting(t, tme.wr, map[string][]string{ + "t1": {"ks2.t1"}, + "ks1.t1": {"ks2.t1"}, + "t2": {"ks2.t2"}, + "ks1.t2": {"ks2.t2"}, + "t1@replica": {"ks2.t1"}, + "ks2.t1@replica": {"ks2.t1"}, + "ks1.t1@replica": {"ks2.t1"}, + "t2@replica": {"ks2.t2"}, + "ks2.t2@replica": {"ks2.t2"}, + "ks1.t2@replica": {"ks2.t2"}, + "t1@rdonly": {"ks2.t1"}, + "ks2.t1@rdonly": {"ks2.t1"}, + "ks1.t1@rdonly": {"ks2.t1"}, + "t2@rdonly": {"ks2.t2"}, + "ks2.t2@rdonly": {"ks2.t2"}, + "ks1.t2@rdonly": {"ks2.t2"}, + }) _, err = tme.wr.DropSources(ctx, tme.targetKeyspace, "test", RenameTable, false, false, false) require.NoError(t, err) checkBlacklist(t, tme.ts, fmt.Sprintf("%s:%s", "ks1", "0"), nil) - + checkRouting(t, tme.wr, map[string][]string{}) verifyQueries(t, tme.allDBClients) }