Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MoveTables: Refresh SrvVSchema (for Routing Rules) and source tablets (for Blacklisted Tables) on completion #7505

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions go/vt/wrangler/traffic_switcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
})
}

Expand Down Expand Up @@ -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)
})
}

Expand Down Expand Up @@ -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)
})
}

Expand Down
20 changes: 19 additions & 1 deletion go/vt/wrangler/traffic_switcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down