From a4bf80bbd14e7c52635275be9a68c1e350e04c6b Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Wed, 6 Dec 2023 15:59:48 -0500 Subject: [PATCH] go/vt/wrangler: fix nilness issues and unused variable Signed-off-by: Matt Layher --- go/vt/wrangler/materializer.go | 10 ++++------ go/vt/wrangler/traffic_switcher.go | 3 --- go/vt/wrangler/vexec.go | 7 ++----- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/go/vt/wrangler/materializer.go b/go/vt/wrangler/materializer.go index 01a3a640fb8..13f430919fd 100644 --- a/go/vt/wrangler/materializer.go +++ b/go/vt/wrangler/materializer.go @@ -318,13 +318,11 @@ func (wr *Wrangler) MoveTables(ctx context.Context, workflow, sourceKeyspace, ta return err } } - if vschema != nil { - // We added to the vschema. - if err := wr.ts.SaveVSchema(ctx, targetKeyspace, vschema); err != nil { - return err - } - } + // We added to the vschema. + if err := wr.ts.SaveVSchema(ctx, targetKeyspace, vschema); err != nil { + return err + } } if err := wr.ts.RebuildSrvVSchema(ctx, nil); err != nil { return err diff --git a/go/vt/wrangler/traffic_switcher.go b/go/vt/wrangler/traffic_switcher.go index e7700e08079..498e83a2a3a 100644 --- a/go/vt/wrangler/traffic_switcher.go +++ b/go/vt/wrangler/traffic_switcher.go @@ -1920,9 +1920,6 @@ func (ts *trafficSwitcher) addParticipatingTablesToKeyspace(ctx context.Context, if err := json2.Unmarshal([]byte(wrap), ks); err != nil { return err } - if err != nil { - return err - } for table, vtab := range ks.Tables { vschema.Tables[table] = vtab } diff --git a/go/vt/wrangler/vexec.go b/go/vt/wrangler/vexec.go index 7cad9a5f318..c705ad3f6f1 100644 --- a/go/vt/wrangler/vexec.go +++ b/go/vt/wrangler/vexec.go @@ -661,9 +661,6 @@ func (wr *Wrangler) getReplicationStatusFromRow(ctx context.Context, row sqltype workflowSubType, _ = row.ToInt32("workflow_sub_type") deferSecondaryKeys, _ = row.ToBool("defer_secondary_keys") rowsCopied = row.AsInt64("rows_copied", 0) - if err != nil { - return nil, "", err - } status := &ReplicationStatus{ Shard: primary.Shard, @@ -701,8 +698,8 @@ func (wr *Wrangler) getStreams(ctx context.Context, workflow, keyspace string) ( var rsr ReplicationStatusResult rsr.ShardStatuses = make(map[string]*ShardReplicationStatus) rsr.Workflow = workflow - var results map[*topo.TabletInfo]*querypb.QueryResult - query := `select + + const query = `select id, source, pos,