Repository: vitessio/vitess
Pull request #7562 (2021-02-26 20:34:52)

Materialize: Add cells and tablet_types parameters
## Description

PR for #7555
* Add cells and tablet_types parameters
* Also change -cell to cells in CreateVLookupIndex

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

## Checklist
- [ ] Should this PR be backported?
- [X] Tests were added or are not required
- [ ] Documentation was added or is not required

## Impacted Areas in Vitess
Components that this PR will affect:

- [ ]  Query Serving
- [X]  VReplication
- [ ]  Cluster Management
- [ ]  Build/CI
- [ ]  VTAdmin



Patch:
diff --git a/go/vt/sqlparser/analyzer.go b/go/vt/sqlparser/analyzer.go
index 27eaab393e..b44f5b36b1 100644
--- a/go/vt/sqlparser/analyzer.go
+++ b/go/vt/sqlparser/analyzer.go
@@ -130,17 +130,11 @@ func CachePlan(stmt Statement) bool {
 	return false
 }
 
-//MustRewriteAST takes Statement and returns true if RewriteAST must run on it for correct execution irrespective of user flags.
-func MustRewriteAST(stmt Statement) bool {
-	switch node := stmt.(type) {
+//IsSetStatement takes Statement and returns if the statement is set statement.
+func IsSetStatement(stmt Statement) bool {
+	switch stmt.(type) {
 	case *Set:
 		return true
-	case *Show:
-		switch node.Internal.(type) {
-		case *ShowBasic:
-			return true
-		}
-		return false
 	}
 	return false
 }
diff --git a/go/vt/sqlparser/ast_rewriting.go b/go/vt/sqlparser/ast_rewriting.go
index 2494a39527..bc4fbdc9df 100644
--- a/go/vt/sqlparser/ast_rewriting.go
+++ b/go/vt/sqlparser/ast_rewriting.go
@@ -178,13 +178,6 @@ func (er *expressionRewriter) rewrite(cursor *Cursor) bool {
 			node.Expr = aliasTableName
 			cursor.Replace(node)
 		}
-	case *ShowBasic:
-		if node.Command == VariableGlobal || node.Command == VariableSession {
-			varsToAdd := sysvars.GetInterestingVariables()
-			for _, sysVar := range varsToAdd {
-				er.bindVars.AddSysVar(sysVar)
-			}
-		}
 	}
 	return true
 }
diff --git a/go/vt/sysvars/sysvars.go b/go/vt/sysvars/sysvars.go
index 40cb7818cf..d7a7f8d50d 100644
--- a/go/vt/sysvars/sysvars.go
+++ b/go/vt/sysvars/sysvars.go
@@ -238,16 +238,3 @@ var (
 		{Name: "version_tokens_session"},
 	}
 )
-
-// GetInterestingVariables is used to return all the variables that may be listed in a SHOW VARIABLES command.
-func GetInterestingVariables() []string {
-	var res []string
-	// Add all the vitess aware variables
-	for _, variable := range VitessAware {
-		res = append(res, variable.Name)
-	}
-	// Also add version and version comment
-	res = append(res, Version.Name)
-	res = append(res, VersionComment.Name)
-	return res
-}
diff --git a/go/vt/vtadmin/api.go b/go/vt/vtadmin/api.go
index 5c301bfb35..bb45cc03dd 100644
--- a/go/vt/vtadmin/api.go
+++ b/go/vt/vtadmin/api.go
@@ -31,7 +31,6 @@ import (
 	"vitess.io/vitess/go/vt/concurrency"
 	"vitess.io/vitess/go/vt/topo"
 	"vitess.io/vitess/go/vt/vtadmin/cluster"
-	"vitess.io/vitess/go/vt/vtadmin/errors"
 	"vitess.io/vitess/go/vt/vtadmin/grpcserver"
 	vtadminhttp "vitess.io/vitess/go/vt/vtadmin/http"
 	vthandlers "vitess.io/vitess/go/vt/vtadmin/http/handlers"
@@ -303,7 +302,7 @@ func (api *API) GetSchemas(ctx context.Context, req *vtadminpb.GetSchemasRequest
 
 			// Since tablets are per-cluster, we can fetch them once
 			// and use them throughout the other waitgroups.
-			tablets, err := c.GetTablets(ctx)
+			tablets, err := api.getTablets(ctx, c)
 			if err != nil {
 				er.RecordError(err)
 				return
@@ -450,7 +449,7 @@ func (api *API) GetTablet(ctx context.Context, req *vtadminpb.GetTabletRequest)
 		go func(c *cluster.Cluster) {
 			defer wg.Done()
 
-			ts, err := c.GetTablets(ctx)
+			ts, err := api.getTablets(ctx, c)
 			if err != nil {
 				er.RecordError(err)
 				return
@@ -478,12 +477,12 @@ func (api *API) GetTablet(ctx context.Context, req *vtadminpb.GetTabletRequest)
 
 	switch len(tablets) {
 	case 0:
-		return nil, vterrors.Errorf(vtrpcpb.Code_NOT_FOUND, "%s: %s, searched clusters = %v", errors.ErrNoTablet, req.Hostname, ids)
+		return nil, vterrors.Errorf(vtrpcpb.Code_NOT_FOUND, "%s: %s, searched clusters = %v", ErrNoTablet, req.Hostname, ids)
 	case 1:
 		return tablets[0], nil
 	}
 
-	return nil, vterrors.Errorf(vtrpcpb.Code_NOT_FOUND, "%s: %s, searched clusters = %v", errors.ErrAmbiguousTablet, req.Hostname, ids)
+	return nil, vterrors.Errorf(vtrpcpb.Code_NOT_FOUND, "%s: %s, searched clusters = %v", ErrAmbiguousTablet, req.Hostname, ids)
 }
 
 // GetTablets is part of the vtadminpb.VTAdminServer interface.
@@ -506,7 +505,7 @@ func (api *API) GetTablets(ctx context.Context, req *vtadminpb.GetTabletsRequest
 		go func(c *cluster.Cluster) {
 			defer wg.Done()
 
-			ts, err := c.GetTablets(ctx)
+			ts, err := api.getTablets(ctx, c)
 			if err != nil {
 				er.RecordError(err)
 				return
@@ -529,6 +528,60 @@ func (api *API) GetTablets(ctx context.Context, req *vtadminpb.GetTabletsRequest
 	}, nil
 }
 
+func (api *API) getTablets(ctx context.Context, c *cluster.Cluster) ([]*vtadminpb.Tablet, error) {
+	if err := c.DB.Dial(ctx, ""); err != nil {
+		return nil, err
+	}
+
+	rows, err := c.DB.ShowTablets(ctx)
+	if err != nil {
+		return nil, err
+	}
+
+	return ParseTablets(rows, c)
+}
+
+// findTablet returns the first tablet in a given cluster that satisfies the filter function.
+func (api *API) findTablet(ctx context.Context, cluster *cluster.Cluster, filter func(*vtadminpb.Tablet) bool) (*vtadminpb.Tablet, error) {
+	tablets, err := api.findTablets(ctx, cluster, filter, 1)
+	if err != nil {
+		return nil, err
+	}
+
+	if len(tablets) != 1 {
+		return nil, ErrNoTablet
+	}
+
+	return tablets[0], nil
+}
+
+// findTablets returns the first N tablets in the given cluster that satisfy
+// the filter function. If N = -1, then all matching tablets are returned.
+// Ordering is not guaranteed, and callers should write their filter functions accordingly.
+func (api *API) findTablets(ctx context.Context, cluster *cluster.Cluster, filter func(*vtadminpb.Tablet) bool, n int) ([]*vtadminpb.Tablet, error) {
+	tablets, err := api.getTablets(ctx, cluster)
+	if err != nil {
+		return nil, err
+	}
+
+	if n == -1 {
+		n = len(tablets)
+	}
+
+	results := make([]*vtadminpb.Tablet, 0, n)
+	for _, t := range tablets {
+		if len(results) >= n {
+			break
+		}
+
+		if filter(t) {
+			results = append(results, t)
+		}
+	}
+
+	return results, nil
+}
+
 func (api *API) getClustersForRequest(ids []string) ([]*cluster.Cluster, []string) {
 	if len(ids) == 0 {
 		clusterIDs := make([]string, 0, len(api.clusters))
@@ -557,23 +610,23 @@ func (api *API) VTExplain(ctx context.Context, req *vtadminpb.VTExplainRequest)
 	defer span.Finish()
 
 	if req.Cluster == "" {
-		return nil, fmt.Errorf("%w: cluster ID is required", errors.ErrInvalidRequest)
+		return nil, fmt.Errorf("%w: cluster ID is required", ErrInvalidRequest)
 	}
 
 	if req.Keyspace == "" {
-		return nil, fmt.Errorf("%w: keyspace name is required", errors.ErrInvalidRequest)
+		return nil, fmt.Errorf("%w: keyspace name is required", ErrInvalidRequest)
 	}
 
 	if req.Sql == "" {
-		return nil, fmt.Errorf("%w: SQL query is required", errors.ErrInvalidRequest)
+		return nil, fmt.Errorf("%w: SQL query is required", ErrInvalidRequest)
 	}
 
 	c, ok := api.clusterMap[req.Cluster]
 	if !ok {
-		return nil, errors.ErrUnsupportedCluster
+		return nil, ErrUnsupportedCluster
 	}
 
-	tablet, err := c.FindTablet(ctx, func(t *vtadminpb.Tablet) bool {
+	tablet, err := api.findTablet(ctx, c, func(t *vtadminpb.Tablet) bool {
 		return t.Tablet.Keyspace == req.Keyspace && topo.IsInServingGraph(t.Tablet.Type) && t.Tablet.Type != topodatapb.TabletType_MASTER && t.State == vtadminpb.Tablet_SERVING
 	})
 
@@ -637,7 +690,7 @@ func (api *API) VTExplain(ctx context.Context, req *vtadminpb.VTExplainRequest)
 
 		ksvs, ok := res.SrvVSchema.Keyspaces[req.Keyspace]
 		if !ok {
-			er.RecordError(fmt.Errorf("%w: keyspace %s", errors.ErrNoSrvVSchema, req.Keyspace))
+			er.RecordError(fmt.Errorf("%w: keyspace %s", ErrNoSrvVSchema, req.Keyspace))
 			return
 		}
 
diff --git a/go/vt/vtadmin/cluster/cluster.go b/go/vt/vtadmin/cluster/cluster.go
index 4fd9f49685..c7a23e0d28 100644
--- a/go/vt/vtadmin/cluster/cluster.go
+++ b/go/vt/vtadmin/cluster/cluster.go
@@ -17,21 +17,12 @@ limitations under the License.
 package cluster
 
 import (
-	"context"
-	"database/sql"
 	"fmt"
-	"time"
 
-	"vitess.io/vitess/go/vt/log"
-	"vitess.io/vitess/go/vt/logutil"
-	"vitess.io/vitess/go/vt/topo/topoproto"
 	"vitess.io/vitess/go/vt/vtadmin/cluster/discovery"
-	"vitess.io/vitess/go/vt/vtadmin/errors"
-	"vitess.io/vitess/go/vt/vtadmin/vtadminproto"
 	"vitess.io/vitess/go/vt/vtadmin/vtctldclient"
 	"vitess.io/vitess/go/vt/vtadmin/vtsql"
 
-	topodatapb "vitess.io/vitess/go/vt/proto/topodata"
 	vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin"
 )
 
@@ -107,147 +98,3 @@ func buildPFlagSlice(flags map[string]string) []string {
 
 	return args
 }
-
-// parseTablets converts a set of *sql.Rows into a slice of Tablets, for the
-// given cluster.
-func (c *Cluster) parseTablets(rows *sql.Rows) ([]*vtadminpb.Tablet, error) {
-	var tablets []*vtadminpb.Tablet
-
-	for rows.Next() {
-		if err := rows.Err(); err != nil {
-			return nil, err
-		}
-
-		tablet, err := c.parseTablet(rows)
-		if err != nil {
-			return nil, err
-		}
-
-		tablets = append(tablets, tablet)
-	}
-
-	if err := rows.Err(); err != nil {
-		return nil, err
-	}
-
-	return tablets, nil
-}
-
-// Fields are:
-// Cell | Keyspace | Shard | TabletType (string) | ServingState (string) | Alias | Hostname | MasterTermStartTime.
-func (c *Cluster) parseTablet(rows *sql.Rows) (*vtadminpb.Tablet, error) {
-	var (
-		cell            string
-		tabletTypeStr   string
-		servingStateStr string
-		aliasStr        string
-		mtstStr         string
-		topotablet      topodatapb.Tablet
-
-		err error
-	)
-
-	if err := rows.Scan(
-		&cell,
-		&topotablet.Keyspace,
-		&topotablet.Shard,
-		&tabletTypeStr,
-		&servingStateStr,
-		&aliasStr,
-		&topotablet.Hostname,
-		&mtstStr,
-	); err != nil {
-		return nil, err
-	}
-
-	tablet := &vtadminpb.Tablet{
-		Cluster: &vtadminpb.Cluster{
-			Id:   c.ID,
-			Name: c.Name,
-		},
-		Tablet: &topotablet,
-	}
-
-	topotablet.Type, err = topoproto.ParseTabletType(tabletTypeStr)
-	if err != nil {
-		return nil, err
-	}
-
-	tablet.State = vtadminproto.ParseTabletServingState(servingStateStr)
-
-	topotablet.Alias, err = topoproto.ParseTabletAlias(aliasStr)
-	if err != nil {
-		return nil, err
-	}
-
-	if topotablet.Alias.Cell != cell {
-		// (TODO:@amason) ???
-		log.Warningf("tablet cell %s does not match alias %s. ignoring for now", cell, topoproto.TabletAliasString(topotablet.Alias))
-	}
-
-	if mtstStr != "" {
-		timeTime, err := time.Parse(time.RFC3339, mtstStr)
-		if err != nil {
-			return nil, err
-		}
-
-		topotablet.MasterTermStartTime = logutil.TimeToProto(timeTime)
-	}
-
-	return tablet, nil
-}
-
-// GetTablets returns all tablets in the cluster.
-func (c *Cluster) GetTablets(ctx context.Context) ([]*vtadminpb.Tablet, error) {
-	if err := c.DB.Dial(ctx, ""); err != nil {
-		return nil, err
-	}
-
-	rows, err := c.DB.ShowTablets(ctx)
-	if err != nil {
-		return nil, err
-	}
-
-	return c.parseTablets(rows)
-}
-
-// FindTablet returns the first tablet in a given cluster that satisfies the filter function.
-func (c *Cluster) FindTablet(ctx context.Context, filter func(*vtadminpb.Tablet) bool) (*vtadminpb.Tablet, error) {
-	tablets, err := c.FindTablets(ctx, filter, 1)
-	if err != nil {
-		return nil, err
-	}
-
-	if len(tablets) != 1 {
-		return nil, errors.ErrNoTablet
-	}
-
-	return tablets[0], nil
-}
-
-// FindTablets returns the first N tablets in the given cluster that satisfy
-// the filter function. If N = -1, then all matching tablets are returned.
-// Ordering is not guaranteed, and callers should write their filter functions accordingly.
-func (c *Cluster) FindTablets(ctx context.Context, filter func(*vtadminpb.Tablet) bool, n int) ([]*vtadminpb.Tablet, error) {
-	tablets, err := c.GetTablets(ctx)
-	if err != nil {
-		return nil, err
-	}
-
-	if n == -1 {
-		n = len(tablets)
-	}
-
-	results := make([]*vtadminpb.Tablet, 0, n)
-	for _, t := range tablets {
-		if len(results) >= n {
-			break
-		}
-
-		if filter(t) {
-			results = append(results, t)
-		}
-	}
-
-	return results, nil
-}
diff --git a/go/vt/vtadmin/errors/errors.go b/go/vt/vtadmin/errors.go
similarity index 98%
rename from go/vt/vtadmin/errors/errors.go
rename to go/vt/vtadmin/errors.go
index c63f9cc78e..efec58e2de 100644
--- a/go/vt/vtadmin/errors/errors.go
+++ b/go/vt/vtadmin/errors.go
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */
 
-package errors
+package vtadmin
 
 import "errors"
 
diff --git a/go/vt/vtadmin/tablets.go b/go/vt/vtadmin/tablets.go
new file mode 100644
index 0000000000..739ffac148
--- /dev/null
+++ b/go/vt/vtadmin/tablets.go
@@ -0,0 +1,120 @@
+/*
+Copyright 2020 The Vitess Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package vtadmin
+
+import (
+	"database/sql"
+	"time"
+
+	"vitess.io/vitess/go/vt/log"
+	"vitess.io/vitess/go/vt/logutil"
+	"vitess.io/vitess/go/vt/topo/topoproto"
+	"vitess.io/vitess/go/vt/vtadmin/cluster"
+	"vitess.io/vitess/go/vt/vtadmin/vtadminproto"
+
+	topodatapb "vitess.io/vitess/go/vt/proto/topodata"
+	vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin"
+)
+
+// ParseTablets converts a set of *sql.Rows into a slice of Tablets, for the
+// given cluster.
+func ParseTablets(rows *sql.Rows, c *cluster.Cluster) ([]*vtadminpb.Tablet, error) {
+	var tablets []*vtadminpb.Tablet
+
+	for rows.Next() {
+		if err := rows.Err(); err != nil {
+			return nil, err
+		}
+
+		tablet, err := parseTablet(rows, c)
+		if err != nil {
+			return nil, err
+		}
+
+		tablets = append(tablets, tablet)
+	}
+
+	if err := rows.Err(); err != nil {
+		return nil, err
+	}
+
+	return tablets, nil
+}
+
+// Fields are:
+// Cell | Keyspace | Shard | TabletType (string) | ServingState (string) | Alias | Hostname | MasterTermStartTime.
+func parseTablet(rows *sql.Rows, c *cluster.Cluster) (*vtadminpb.Tablet, error) {
+	var (
+		cell            string
+		tabletTypeStr   string
+		servingStateStr string
+		aliasStr        string
+		mtstStr         string
+		topotablet      topodatapb.Tablet
+
+		err error
+	)
+
+	if err := rows.Scan(
+		&cell,
+		&topotablet.Keyspace,
+		&topotablet.Shard,
+		&tabletTypeStr,
+		&servingStateStr,
+		&aliasStr,
+		&topotablet.Hostname,
+		&mtstStr,
+	); err != nil {
+		return nil, err
+	}
+
+	tablet := &vtadminpb.Tablet{
+		Cluster: &vtadminpb.Cluster{
+			Id:   c.ID,
+			Name: c.Name,
+		},
+		Tablet: &topotablet,
+	}
+
+	topotablet.Type, err = topoproto.ParseTabletType(tabletTypeStr)
+	if err != nil {
+		return nil, err
+	}
+
+	tablet.State = vtadminproto.ParseTabletServingState(servingStateStr)
+
+	topotablet.Alias, err = topoproto.ParseTabletAlias(aliasStr)
+	if err != nil {
+		return nil, err
+	}
+
+	if topotablet.Alias.Cell != cell {
+		// (TODO:@amason) ???
+		log.Warningf("tablet cell %s does not match alias %s. ignoring for now", cell, topoproto.TabletAliasString(topotablet.Alias))
+	}
+
+	if mtstStr != "" {
+		timeTime, err := time.Parse(time.RFC3339, mtstStr)
+		if err != nil {
+			return nil, err
+		}
+
+		topotablet.MasterTermStartTime = logutil.TimeToProto(timeTime)
+	}
+
+	return tablet, nil
+}
diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go
index 48cbd6fdde..e8422d7137 100644
--- a/go/vt/vtctl/vtctl.go
+++ b/go/vt/vtctl/vtctl.go
@@ -312,13 +312,13 @@ var commands = []commandGroup{
 				"[-dry_run] [-rename_tables] <keyspace.workflow>",
 				"After a MoveTables or Resharding workflow cleanup unused artifacts like source tables, source shards and blacklists"},
 			{"CreateLookupVindex", commandCreateLookupVindex,
-				"[-cell=<cell>] [-tablet_types=<source_tablet_types>] <keyspace> <json_spec>",
+				"[-cell=<source_cells> DEPRECATED] [-cells=<source_cells>] [-tablet_types=<source_tablet_types>] <keyspace> <json_spec>",
 				`Create and backfill a lookup vindex. the json_spec must contain the vindex and colvindex specs for the new lookup.`},
 			{"ExternalizeVindex", commandExternalizeVindex,
 				"<keyspace>.<vindex>",
 				`Externalize a backfilled vindex.`},
 			{"Materialize", commandMaterialize,
-				`<json_spec>, example : '{"workflow": "aaa", "source_keyspace": "source", "target_keyspace": "target", "table_settings": [{"target_table": "customer", "source_expression": "select * from customer", "create_ddl": "copy"}]}'`,
+				`[-cells=<cells>] [-tablet_types=<source_tablet_types>] <json_spec>, example : '{"workflow": "aaa", "source_keyspace": "source", "target_keyspace": "target", "table_settings": [{"target_table": "customer", "source_expression": "select * from customer", "create_ddl": "copy"}]}'`,
 				"Performs materialization based on the json spec. Is used directly to form VReplication rules, with an optional step to copy table structure/DDL."},
 			{"SplitClone", commandSplitClone,
 				"<keyspace> <from_shards> <to_shards>",
@@ -2263,6 +2263,8 @@ func commandVRWorkflow(ctx context.Context, wr *wrangler.Wrangler, subFlags *fla
 }
 
 func commandCreateLookupVindex(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
+	cells := subFlags.String("cells", "", "Source cells to replicate from.")
+	//TODO: keep -cell around for backward compatibility and remove it in a future version
 	cell := subFlags.String("cell", "", "Cell to replicate from.")
 	tabletTypes := subFlags.String("tablet_types", "", "Source tablet types to replicate from.")
 	if err := subFlags.Parse(args); err != nil {
@@ -2271,6 +2273,9 @@ func commandCreateLookupVindex(ctx context.Context, wr *wrangler.Wrangler, subFl
 	if subFlags.NArg() != 2 {
 		return fmt.Errorf("two arguments are required: keyspace and json_spec")
 	}
+	if *cells == "" && *cell != "" {
+		*cells = *cell
+	}
 	keyspace := subFlags.Arg(0)
 	specs := &vschemapb.Keyspace{}
 	if err := json2.Unmarshal([]byte(subFlags.Arg(1)), specs); err != nil {
@@ -2290,6 +2295,8 @@ func commandExternalizeVindex(ctx context.Context, wr *wrangler.Wrangler, subFla
 }
 
 func commandMaterialize(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
+	cells := subFlags.String("cells", "", "Source cells to replicate from.")
+	tabletTypes := subFlags.String("tablet_types", "", "Source tablet types to replicate from.")
 	if err := subFlags.Parse(args); err != nil {
 		return err
 	}
@@ -2300,6 +2307,8 @@ func commandMaterialize(ctx context.Context, wr *wrangler.Wrangler, subFlags *fl
 	if err := json2.Unmarshal([]byte(subFlags.Arg(0)), ms); err != nil {
 		return err
 	}
+	ms.Cell = *cells
+	ms.TabletTypes = *tabletTypes
 	return wr.Materialize(ctx, ms)
 }
 
diff --git a/go/vt/vtgate/engine/cached_size.go b/go/vt/vtgate/engine/cached_size.go
index a3b98ee7fc..2278127a81 100644
--- a/go/vt/vtgate/engine/cached_size.go
+++ b/go/vt/vtgate/engine/cached_size.go
@@ -443,45 +443,6 @@ func (cached *PulloutSubquery) CachedSize(alloc bool) int64 {
 	}
 	return size
 }
-func (cached *RenameFields) CachedSize(alloc bool) int64 {
-	if cached == nil {
-		return int64(0)
-	}
-	size := int64(0)
-	if alloc {
-		size += int64(64)
-	}
-	// field Cols []string
-	{
-		size += int64(cap(cached.Cols)) * int64(16)
-		for _, elem := range cached.Cols {
-			size += int64(len(elem))
-		}
-	}
-	// field Indices []int
-	{
-		size += int64(cap(cached.Indices)) * int64(8)
-	}
-	// field Input vitess.io/vitess/go/vt/vtgate/engine.Primitive
-	if cc, ok := cached.Input.(cachedObject); ok {
-		size += cc.CachedSize(true)
-	}
-	return size
-}
-func (cached *ReplaceVariables) CachedSize(alloc bool) int64 {
-	if cached == nil {
-		return int64(0)
-	}
-	size := int64(0)
-	if alloc {
-		size += int64(16)
-	}
-	// field Input vitess.io/vitess/go/vt/vtgate/engine.Primitive
-	if cc, ok := cached.Input.(cachedObject); ok {
-		size += cc.CachedSize(true)
-	}
-	return size
-}
 func (cached *Route) CachedSize(alloc bool) int64 {
 	if cached == nil {
 		return int64(0)
diff --git a/go/vt/vtgate/engine/rename_fields.go b/go/vt/vtgate/engine/rename_fields.go
deleted file mode 100644
index 9983c5036e..0000000000
--- a/go/vt/vtgate/engine/rename_fields.go
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
-Copyright 2021 The Vitess Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package engine
-
-import (
-	"vitess.io/vitess/go/sqltypes"
-	querypb "vitess.io/vitess/go/vt/proto/query"
-	"vitess.io/vitess/go/vt/proto/vtrpc"
-	"vitess.io/vitess/go/vt/vterrors"
-)
-
-var _ Primitive = (*RenameFields)(nil)
-
-// RenameFields is a primitive that renames the fields
-type RenameFields struct {
-	Cols    []string
-	Indices []int
-	Input   Primitive
-	noTxNeeded
-}
-
-// NewRenameField creates a new rename field
-func NewRenameField(cols []string, indices []int, input Primitive) (*RenameFields, error) {
-	if len(cols) != len(indices) {
-		return nil, vterrors.New(vtrpc.Code_INTERNAL, "Unequal length of columns and indices in RenameField primitive")
-	}
-	return &RenameFields{
-		Cols:    cols,
-		Indices: indices,
-		Input:   input,
-	}, nil
-}
-
-// RouteType implements the primitive interface
-func (r *RenameFields) RouteType() string {
-	return r.Input.RouteType()
-}
-
-// GetKeyspaceName implements the primitive interface
-func (r *RenameFields) GetKeyspaceName() string {
-	return r.Input.GetKeyspaceName()
-}
-
-// GetTableName implements the primitive interface
-func (r *RenameFields) GetTableName() string {
-	return r.Input.GetTableName()
-}
-
-// Execute implements the primitive interface
-func (r *RenameFields) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
-	qr, err := r.Input.Execute(vcursor, bindVars, wantfields)
-	if err != nil {
-		return nil, err
-	}
-	if wantfields {
-		r.renameFields(qr)
-	}
-	return qr, nil
-}
-
-func (r *RenameFields) renameFields(qr *sqltypes.Result) {
-	for ind, index := range r.Indices {
-		colName := r.Cols[ind]
-		qr.Fields[index].Name = colName
-	}
-}
-
-// StreamExecute implements the primitive interface
-func (r *RenameFields) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
-	if wantfields {
-		innerCallback := callback
-		callback = func(result *sqltypes.Result) error {
-			r.renameFields(result)
-			return innerCallback(result)
-		}
-	}
-	return r.Input.StreamExecute(vcursor, bindVars, wantfields, callback)
-}
-
-// GetFields implements the primitive interface
-func (r *RenameFields) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
-	qr, err := r.Input.GetFields(vcursor, bindVars)
-	if err != nil {
-		return nil, err
-	}
-	r.renameFields(qr)
-	return qr, nil
-}
-
-// Inputs implements the primitive interface
-func (r *RenameFields) Inputs() []Primitive {
-	return []Primitive{r.Input}
-}
-
-// description implements the primitive interface
-func (r *RenameFields) description() PrimitiveDescription {
-	return PrimitiveDescription{
-		OperatorType: "RenameFields",
-		Other: map[string]interface{}{
-			"Indices": r.Indices,
-			"Columns": r.Cols,
-		},
-	}
-}
diff --git a/go/vt/vtgate/engine/replace_variables.go b/go/vt/vtgate/engine/replace_variables.go
deleted file mode 100644
index c0397e2640..0000000000
--- a/go/vt/vtgate/engine/replace_variables.go
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-Copyright 2021 The Vitess Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package engine
-
-import (
-	"vitess.io/vitess/go/sqltypes"
-	querypb "vitess.io/vitess/go/vt/proto/query"
-)
-
-var _ Primitive = (*ReplaceVariables)(nil)
-
-// ReplaceVariables is used in SHOW VARIABLES statements so that it replaces the values for vitess-aware variables
-type ReplaceVariables struct {
-	Input Primitive
-	noTxNeeded
-}
-
-// NewReplaceVariables is used to create a new ReplaceVariables primitive
-func NewReplaceVariables(input Primitive) *ReplaceVariables {
-	return &ReplaceVariables{Input: input}
-}
-
-// RouteType implements the Primitive interface
-func (r *ReplaceVariables) RouteType() string {
-	return r.Input.RouteType()
-}
-
-// GetKeyspaceName implements the Primitive interface
-func (r *ReplaceVariables) GetKeyspaceName() string {
-	return r.Input.GetKeyspaceName()
-}
-
-// GetTableName implements the Primitive interface
-func (r *ReplaceVariables) GetTableName() string {
-	return r.Input.GetTableName()
-}
-
-// Execute implements the Primitive interface
-func (r *ReplaceVariables) Execute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) {
-	qr, err := r.Input.Execute(vcursor, bindVars, wantfields)
-	if err != nil {
-		return nil, err
-	}
-	replaceVariables(qr, bindVars)
-	return qr, nil
-}
-
-// StreamExecute implements the Primitive interface
-func (r *ReplaceVariables) StreamExecute(vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool, callback func(*sqltypes.Result) error) error {
-	innerCallback := callback
-	callback = func(result *sqltypes.Result) error {
-		replaceVariables(result, bindVars)
-		return innerCallback(result)
-	}
-	return r.Input.StreamExecute(vcursor, bindVars, wantfields, callback)
-}
-
-// GetFields implements the Primitive interface
-func (r *ReplaceVariables) GetFields(vcursor VCursor, bindVars map[string]*querypb.BindVariable) (*sqltypes.Result, error) {
-	return r.Input.GetFields(vcursor, bindVars)
-}
-
-// Inputs implements the Primitive interface
-func (r *ReplaceVariables) Inputs() []Primitive {
-	return []Primitive{r.Input}
-}
-
-// description implements the Primitive interface
-func (r *ReplaceVariables) description() PrimitiveDescription {
-	return PrimitiveDescription{
-		OperatorType: "ReplaceVariables",
-	}
-}
-
-func replaceVariables(qr *sqltypes.Result, bindVars map[string]*querypb.BindVariable) {
-	for i, row := range qr.Rows {
-		variableName := row[0].ToString()
-		res, found := bindVars["__vt"+variableName]
-		if found {
-			qr.Rows[i][1] = sqltypes.NewVarChar(string(res.GetValue()))
-		}
-	}
-}
diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go
index 8b5c1bd831..452ae56173 100644
--- a/go/vt/vtgate/executor.go
+++ b/go/vt/vtgate/executor.go
@@ -1237,7 +1237,7 @@ func (e *Executor) getPlan(vcursor *vcursorImpl, sql string, comments sqlparser.
 	vcursor.SetIgnoreMaxMemoryRows(ignoreMaxMemoryRows)
 
 	// Normalize if possible and retry.
-	if (e.normalize && sqlparser.CanNormalize(stmt)) || sqlparser.MustRewriteAST(stmt) {
+	if (e.normalize && sqlparser.CanNormalize(stmt)) || sqlparser.IsSetStatement(stmt) {
 		parameterize := e.normalize // the public flag is called normalize
 		result, err := sqlparser.PrepareAST(stmt, bindVars, "vtg", parameterize, vcursor.keyspace)
 		if err != nil {
diff --git a/go/vt/vtgate/planbuilder/show.go b/go/vt/vtgate/planbuilder/show.go
index 79d08d1e9f..31b36d7e58 100644
--- a/go/vt/vtgate/planbuilder/show.go
+++ b/go/vt/vtgate/planbuilder/show.go
@@ -54,10 +54,9 @@ func buildShowBasicPlan(show *sqlparser.ShowBasic, vschema ContextVSchema) (engi
 	switch show.Command {
 	case sqlparser.Charset:
 		return buildCharsetPlan(show)
-	case sqlparser.Collation, sqlparser.Function, sqlparser.Privilege, sqlparser.Procedure:
+	case sqlparser.Collation, sqlparser.Function, sqlparser.Privilege, sqlparser.Procedure,
+		sqlparser.VariableGlobal, sqlparser.VariableSession:
 		return buildSendAnywherePlan(show, vschema)
-	case sqlparser.VariableGlobal, sqlparser.VariableSession:
-		return buildVariablePlan(show, vschema)
 	case sqlparser.Column, sqlparser.Index:
 		return buildShowTblPlan(show, vschema)
 	case sqlparser.Database, sqlparser.Keyspace:
@@ -99,15 +98,6 @@ func buildSendAnywherePlan(show *sqlparser.ShowBasic, vschema ContextVSchema) (e
 	}, nil
 }
 
-func buildVariablePlan(show *sqlparser.ShowBasic, vschema ContextVSchema) (engine.Primitive, error) {
-	plan, err := buildSendAnywherePlan(show, vschema)
-	if err != nil {
-		return nil, err
-	}
-	plan = engine.NewReplaceVariables(plan)
-	return plan, nil
-}
-
 func buildShowTblPlan(show *sqlparser.ShowBasic, vschema ContextVSchema) (engine.Primitive, error) {
 	if show.DbName != "" {
 		show.Tbl.Qualifier = sqlparser.NewTableIdent(show.DbName)
@@ -174,18 +164,17 @@ func buildDBPlan(show *sqlparser.ShowBasic, vschema ContextVSchema) (engine.Prim
 
 func buildPlanWithDB(show *sqlparser.ShowBasic, vschema ContextVSchema) (engine.Primitive, error) {
 	dbName := show.DbName
-	dbDestination := show.DbName
-	if sqlparser.SystemSchema(dbDestination) {
+	if sqlparser.SystemSchema(dbName) {
 		ks, err := vschema.AnyKeyspace()
 		if err != nil {
 			return nil, err
 		}
-		dbDestination = ks.Name
+		dbName = ks.Name
 	} else {
 		// Remove Database Name from the query.
 		show.DbName = ""
 	}
-	destination, keyspace, _, err := vschema.TargetDestination(dbDestination)
+	destination, keyspace, _, err := vschema.TargetDestination(dbName)
 	if err != nil {
 		return nil, err
 	}
@@ -193,26 +182,14 @@ func buildPlanWithDB(show *sqlparser.ShowBasic, vschema ContextVSchema) (engine.
 		destination = key.DestinationAnyShard{}
 	}
 
-	if dbName == "" {
-		dbName = keyspace.Name
-	}
-
 	query := sqlparser.String(show)
-	var plan engine.Primitive
-	plan = &engine.Send{
+	return &engine.Send{
 		Keyspace:          keyspace,
 		TargetDestination: destination,
 		Query:             query,
 		IsDML:             false,
 		SingleShardOnly:   true,
-	}
-	if show.Command == sqlparser.Table {
-		plan, err = engine.NewRenameField([]string{"Tables_in_" + dbName}, []int{0}, plan)
-		if err != nil {
-			return nil, err
-		}
-	}
-	return plan, nil
+	}, nil
 
 }
 
diff --git a/go/vt/vttablet/sandboxconn/sandboxconn.go b/go/vt/vttablet/sandboxconn/sandboxconn.go
index f07383ee65..b2187b4742 100644
--- a/go/vt/vttablet/sandboxconn/sandboxconn.go
+++ b/go/vt/vttablet/sandboxconn/sandboxconn.go
@@ -505,7 +505,7 @@ func (sbc *SandboxConn) getNextResult(stmt sqlparser.Statement) *sqltypes.Result
 	}
 	if stmt == nil {
 		// if we didn't get a valid query, we'll assume we need a SELECT
-		return getSingleRowResult()
+		return SingleRowResult
 	}
 	switch stmt.(type) {
 	case *sqlparser.Select,
@@ -513,7 +513,7 @@ func (sbc *SandboxConn) getNextResult(stmt sqlparser.Statement) *sqltypes.Result
 		*sqlparser.Show,
 		sqlparser.Explain,
 		*sqlparser.OtherRead:
-		return getSingleRowResult()
+		return SingleRowResult
 	case *sqlparser.Set,
 		sqlparser.DDLStatement,
 		*sqlparser.AlterVschema,
@@ -551,25 +551,6 @@ func (sbc *SandboxConn) StringQueries() []string {
 	return result
 }
 
-// getSingleRowResult is used to get a SingleRowResult but it creates separate fields because some tests change the fields
-// If these fields are not created separately then the constants value also changes which leads to some other tests failing later
-func getSingleRowResult() *sqltypes.Result {
-	singleRowResult := &sqltypes.Result{
-		InsertID:    SingleRowResult.InsertID,
-		StatusFlags: SingleRowResult.StatusFlags,
-		Rows:        SingleRowResult.Rows,
-	}
-
-	for _, field := range SingleRowResult.Fields {
-		singleRowResult.Fields = append(singleRowResult.Fields, &querypb.Field{
-			Name: field.Name,
-			Type: field.Type,
-		})
-	}
-
-	return singleRowResult
-}
-
 // SingleRowResult is returned when there is no pre-stored result.
 var SingleRowResult = &sqltypes.Result{
 	Fields: []*querypb.Field{
diff --git a/go/vt/vttablet/tabletserver/tabletserver.go b/go/vt/vttablet/tabletserver/tabletserver.go
index 79d75194b8..40085bdb76 100644
--- a/go/vt/vttablet/tabletserver/tabletserver.go
+++ b/go/vt/vttablet/tabletserver/tabletserver.go
@@ -719,11 +719,7 @@ func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sq
 			if sqltypes.IncludeFieldsOrDefault(options) == querypb.ExecuteOptions_ALL {
 				for _, f := range result.Fields {
 					if f.Database != "" {
-						if qre.plan.PlanID == planbuilder.PlanShow {
-							f.Database = "information_schema"
-						} else {
-							f.Database = tsv.sm.target.Keyspace
-						}
+						f.Database = tsv.sm.target.Keyspace
 					}
 				}
 			}


Test patch:
diff --git a/go/test/endtoend/vtgate/misc_test.go b/go/test/endtoend/vtgate/misc_test.go
index 38570ef03e..133e8397d9 100644
--- a/go/test/endtoend/vtgate/misc_test.go
+++ b/go/test/endtoend/vtgate/misc_test.go
@@ -77,18 +77,6 @@ func TestShowColumns(t *testing.T) {
 	assertMatches(t, conn, "SHOW columns FROM `t5_null_vindex` in `ks`", expected)
 }
 
-func TestShowTables(t *testing.T) {
-	conn, err := mysql.Connect(context.Background(), &vtParams)
-	require.NoError(t, err)
-	defer conn.Close()
-
-	query := "show tables;"
-	qr := exec(t, conn, query)
-
-	assert.Equal(t, "information_schema", qr.Fields[0].Database)
-	assert.Equal(t, "Tables_in_ks", qr.Fields[0].Name)
-}
-
 func TestCastConvert(t *testing.T) {
 	conn, err := mysql.Connect(context.Background(), &vtParams)
 	require.NoError(t, err)
@@ -541,23 +529,6 @@ func TestFlush(t *testing.T) {
 	exec(t, conn, "flush local tables t1, t2")
 }
 
-func TestShowVariables(t *testing.T) {
-	defer cluster.PanicHandler(t)
-	ctx := context.Background()
-	conn, err := mysql.Connect(ctx, &vtParams)
-	require.NoError(t, err)
-	defer conn.Close()
-	res := exec(t, conn, "show variables like \"%version%\";")
-	found := false
-	for _, row := range res.Rows {
-		if row[0].ToString() == "version" {
-			assert.Contains(t, row[1].ToString(), "vitess")
-			found = true
-		}
-	}
-	require.True(t, found, "Expected a row for version in show query")
-}
-
 func assertMatches(t *testing.T, conn *mysql.Conn, query, expected string) {
 	t.Helper()
 	qr := exec(t, conn, query)
diff --git a/go/vt/sqlparser/ast_rewriting_test.go b/go/vt/sqlparser/ast_rewriting_test.go
index 721e7ccdb4..be76008c42 100644
--- a/go/vt/sqlparser/ast_rewriting_test.go
+++ b/go/vt/sqlparser/ast_rewriting_test.go
@@ -181,40 +181,6 @@ func TestRewrites(in *testing.T) {
 		in:       "CALL proc(@foo)",
 		expected: "CALL proc(:__vtudvfoo)",
 		udv:      1,
-	}, {
-		in:                          "SHOW VARIABLES",
-		expected:                    "SHOW VARIABLES",
-		autocommit:                  true,
-		clientFoundRows:             true,
-		skipQueryPlanCache:          true,
-		sqlSelectLimit:              true,
-		transactionMode:             true,
-		workload:                    true,
-		version:                     true,
-		versionComment:              true,
-		ddlStrategy:                 true,
-		sessionUUID:                 true,
-		sessionEnableSystemSettings: true,
-		rawGTID:                     true,
-		rawTimeout:                  true,
-		sessTrackGTID:               true,
-	}, {
-		in:                          "SHOW GLOBAL VARIABLES",
-		expected:                    "SHOW GLOBAL VARIABLES",
-		autocommit:                  true,
-		clientFoundRows:             true,
-		skipQueryPlanCache:          true,
-		sqlSelectLimit:              true,
-		transactionMode:             true,
-		workload:                    true,
-		version:                     true,
-		versionComment:              true,
-		ddlStrategy:                 true,
-		sessionUUID:                 true,
-		sessionEnableSystemSettings: true,
-		rawGTID:                     true,
-		rawTimeout:                  true,
-		sessTrackGTID:               true,
 	}}
 
 	for _, tc := range tests {
diff --git a/go/vt/vtadmin/api_test.go b/go/vt/vtadmin/api_test.go
index f92554f677..b79372f0d8 100644
--- a/go/vt/vtadmin/api_test.go
+++ b/go/vt/vtadmin/api_test.go
@@ -18,21 +18,28 @@ package vtadmin
 
 import (
 	"context"
+	"database/sql"
 	"errors"
+	"fmt"
 	"testing"
 
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
+	"google.golang.org/grpc"
 
+	"vitess.io/vitess/go/vt/grpcclient"
 	"vitess.io/vitess/go/vt/topo"
 	"vitess.io/vitess/go/vt/topo/memorytopo"
 	"vitess.io/vitess/go/vt/topo/topoproto"
+	"vitess.io/vitess/go/vt/vitessdriver"
 	"vitess.io/vitess/go/vt/vtadmin/cluster"
 	"vitess.io/vitess/go/vt/vtadmin/cluster/discovery/fakediscovery"
-	vtadminerrors "vitess.io/vitess/go/vt/vtadmin/errors"
 	"vitess.io/vitess/go/vt/vtadmin/grpcserver"
 	"vitess.io/vitess/go/vt/vtadmin/http"
 	vtadmintestutil "vitess.io/vitess/go/vt/vtadmin/testutil"
+	vtadminvtctldclient "vitess.io/vitess/go/vt/vtadmin/vtctldclient"
+	"vitess.io/vitess/go/vt/vtadmin/vtsql"
+	"vitess.io/vitess/go/vt/vtadmin/vtsql/fakevtsql"
 	"vitess.io/vitess/go/vt/vtctl/grpcvtctldserver"
 	"vitess.io/vitess/go/vt/vtctl/grpcvtctldserver/testutil"
 	"vitess.io/vitess/go/vt/vtctl/vtctldclient"
@@ -390,8 +397,8 @@ func TestGetKeyspaces(t *testing.T) {
 				clusterClients := []vtctldclient.VtctldClient{cluster0Client, cluster1Client}
 
 				clusters := []*cluster.Cluster{
-					vtadmintestutil.BuildCluster(0, clusterClients[0], nil, nil),
-					vtadmintestutil.BuildCluster(1, clusterClients[1], nil, nil),
+					buildCluster(0, clusterClients[0], nil, nil),
+					buildCluster(1, clusterClients[1], nil, nil),
 				}
 
 				api := NewAPI(clusters, grpcserver.Options{}, http.Options{})
@@ -892,7 +899,7 @@ func TestGetSchemas(t *testing.T) {
 							}
 						}
 
-						clusters[cdx] = vtadmintestutil.BuildCluster(cdx, clusterClients[cdx], cts, nil)
+						clusters[cdx] = buildCluster(cdx, clusterClients[cdx], cts, nil)
 					}
 
 					api := NewAPI(clusters, grpcserver.Options{}, http.Options{})
@@ -911,7 +918,7 @@ func TestGetTablets(t *testing.T) {
 	tests := []struct {
 		name           string
 		clusterTablets [][]*vtadminpb.Tablet
-		dbconfigs      map[string]*vtadmintestutil.Dbcfg
+		dbconfigs      map[string]*dbcfg
 		req            *vtadminpb.GetTabletsRequest
 		expected       []*vtadminpb.Tablet
 		shouldErr      bool
@@ -936,7 +943,7 @@ func TestGetTablets(t *testing.T) {
 					},
 				},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{},
+			dbconfigs: map[string]*dbcfg{},
 			req:       &vtadminpb.GetTabletsRequest{},
 			expected: []*vtadminpb.Tablet{
 				{
@@ -995,8 +1002,8 @@ func TestGetTablets(t *testing.T) {
 					},
 				},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{
-				"c1": {ShouldErr: true},
+			dbconfigs: map[string]*dbcfg{
+				"c1": {shouldErr: true},
 			},
 			req:       &vtadminpb.GetTabletsRequest{},
 			expected:  nil,
@@ -1038,7 +1045,7 @@ func TestGetTablets(t *testing.T) {
 					},
 				},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{},
+			dbconfigs: map[string]*dbcfg{},
 			req:       &vtadminpb.GetTabletsRequest{ClusterIds: []string{"c0"}},
 			expected: []*vtadminpb.Tablet{
 				{
@@ -1068,7 +1075,7 @@ func TestGetTablets(t *testing.T) {
 			clusters := make([]*cluster.Cluster, len(tt.clusterTablets))
 
 			for i, tablets := range tt.clusterTablets {
-				cluster := vtadmintestutil.BuildCluster(i, nil, tablets, tt.dbconfigs)
+				cluster := buildCluster(i, nil, tablets, tt.dbconfigs)
 				clusters[i] = cluster
 			}
 
@@ -1085,11 +1092,35 @@ func TestGetTablets(t *testing.T) {
 	}
 }
 
+// This test only validates the error handling on dialing database connections.
+// Other cases are covered by one or both of TestGetTablets and TestGetTablet.
+func Test_getTablets(t *testing.T) {
+	api := &API{}
+	disco := fakediscovery.New()
+	disco.AddTaggedGates(nil, &vtadminpb.VTGate{Hostname: "gate"})
+
+	db := vtsql.New(&vtsql.Config{
+		Cluster: &vtadminpb.Cluster{
+			Id:   "c1",
+			Name: "one",
+		},
+		Discovery: disco,
+	})
+	db.DialFunc = func(cfg vitessdriver.Configuration) (*sql.DB, error) {
+		return nil, assert.AnError
+	}
+
+	_, err := api.getTablets(context.Background(), &cluster.Cluster{
+		DB: db,
+	})
+	assert.Error(t, err)
+}
+
 func TestGetTablet(t *testing.T) {
 	tests := []struct {
 		name           string
 		clusterTablets [][]*vtadminpb.Tablet
-		dbconfigs      map[string]*vtadmintestutil.Dbcfg
+		dbconfigs      map[string]*dbcfg
 		req            *vtadminpb.GetTabletRequest
 		expected       *vtadminpb.Tablet
 		shouldErr      bool
@@ -1114,7 +1145,7 @@ func TestGetTablet(t *testing.T) {
 					},
 				},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{},
+			dbconfigs: map[string]*dbcfg{},
 			req: &vtadminpb.GetTabletRequest{
 				Hostname: "ks1-00-00-zone1-a",
 			},
@@ -1173,8 +1204,8 @@ func TestGetTablet(t *testing.T) {
 					},
 				},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{
-				"c1": {ShouldErr: true},
+			dbconfigs: map[string]*dbcfg{
+				"c1": {shouldErr: true},
 			},
 			req: &vtadminpb.GetTabletRequest{
 				Hostname: "doesn't matter",
@@ -1218,7 +1249,7 @@ func TestGetTablet(t *testing.T) {
 					},
 				},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{},
+			dbconfigs: map[string]*dbcfg{},
 			req: &vtadminpb.GetTabletRequest{
 				Hostname:   "ks1-00-00-zone1-a",
 				ClusterIds: []string{"c0"},
@@ -1278,7 +1309,7 @@ func TestGetTablet(t *testing.T) {
 					},
 				},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{},
+			dbconfigs: map[string]*dbcfg{},
 			req: &vtadminpb.GetTabletRequest{
 				Hostname: "ks1-00-00-zone1-a",
 			},
@@ -1291,7 +1322,7 @@ func TestGetTablet(t *testing.T) {
 				/* cluster 0 */
 				{},
 			},
-			dbconfigs: map[string]*vtadmintestutil.Dbcfg{},
+			dbconfigs: map[string]*dbcfg{},
 			req: &vtadminpb.GetTabletRequest{
 				Hostname: "ks1-00-00-zone1-a",
 			},
@@ -1305,7 +1336,7 @@ func TestGetTablet(t *testing.T) {
 			clusters := make([]*cluster.Cluster, len(tt.clusterTablets))
 
 			for i, tablets := range tt.clusterTablets {
-				cluster := vtadmintestutil.BuildCluster(i, nil, tablets, tt.dbconfigs)
+				cluster := buildCluster(i, nil, tablets, tt.dbconfigs)
 				clusters[i] = cluster
 			}
 
@@ -1512,7 +1543,7 @@ func TestVTExplain(t *testing.T) {
 				Keyspace: "commerce",
 				Sql:      "select * from customers",
 			},
-			expectedError: vtadminerrors.ErrNoTablet,
+			expectedError: ErrNoTablet,
 		},
 		{
 			name: "returns an error if cluster unspecified in request",
@@ -1520,7 +1551,7 @@ func TestVTExplain(t *testing.T) {
 				Keyspace: "commerce",
 				Sql:      "select * from customers",
 			},
-			expectedError: vtadminerrors.ErrInvalidRequest,
+			expectedError: ErrInvalidRequest,
 		},
 		{
 			name: "returns an error if keyspace unspecified in request",
@@ -1528,7 +1559,7 @@ func TestVTExplain(t *testing.T) {
 				Cluster: "c0",
 				Sql:     "select * from customers",
 			},
-			expectedError: vtadminerrors.ErrInvalidRequest,
+			expectedError: ErrInvalidRequest,
 		},
 		{
 			name: "returns an error if SQL unspecified in request",
@@ -1536,7 +1567,7 @@ func TestVTExplain(t *testing.T) {
 				Cluster:  "c0",
 				Keyspace: "commerce",
 			},
-			expectedError: vtadminerrors.ErrInvalidRequest,
+			expectedError: ErrInvalidRequest,
 		},
 	}
 
@@ -1580,7 +1611,7 @@ func TestVTExplain(t *testing.T) {
 					}
 				}
 
-				c := vtadmintestutil.BuildCluster(0, vtctldClient, tt.tablets, nil)
+				c := buildCluster(0, vtctldClient, tt.tablets, nil)
 				clusters := []*cluster.Cluster{c}
 
 				api := NewAPI(clusters, grpcserver.Options{}, http.Options{})
@@ -1600,6 +1631,51 @@ func TestVTExplain(t *testing.T) {
 	}
 }
 
+type dbcfg struct {
+	shouldErr bool
+}
+
+// shared helper for building a cluster that contains the given tablets and
+// talking to the given vtctld server. dbconfigs contains an optional config
+// for controlling the behavior of the cluster's DB at the package sql level.
+func buildCluster(i int, vtctldClient vtctldclient.VtctldClient, tablets []*vtadminpb.Tablet, dbconfigs map[string]*dbcfg) *cluster.Cluster {
+	disco := fakediscovery.New()
+	disco.AddTaggedGates(nil, &vtadminpb.VTGate{Hostname: fmt.Sprintf("cluster%d-gate", i)})
+	disco.AddTaggedVtctlds(nil, &vtadminpb.Vtctld{Hostname: "doesn't matter"})
+
+	cluster := &cluster.Cluster{
+		ID:        fmt.Sprintf("c%d", i),
+		Name:      fmt.Sprintf("cluster%d", i),
+		Discovery: disco,
+	}
+
+	dbconfig, ok := dbconfigs[cluster.ID]
+	if !ok {
+		dbconfig = &dbcfg{shouldErr: false}
+	}
+
+	db := vtsql.New(&vtsql.Config{
+		Cluster:   cluster.ToProto(),
+		Discovery: disco,
+	})
+	db.DialFunc = func(cfg vitessdriver.Configuration) (*sql.DB, error) {
+		return sql.OpenDB(&fakevtsql.Connector{Tablets: tablets, ShouldErr: dbconfig.shouldErr}), nil
+	}
+
+	vtctld := vtadminvtctldclient.New(&vtadminvtctldclient.Config{
+		Cluster:   cluster.ToProto(),
+		Discovery: disco,
+	})
+	vtctld.DialFunc = func(addr string, ff grpcclient.FailFast, opts ...grpc.DialOption) (vtctldclient.VtctldClient, error) {
+		return vtctldClient, nil
+	}
+
+	cluster.DB = db
+	cluster.Vtctld = vtctld
+
+	return cluster
+}
+
 func init() {
 	// For tests that don't actually care about mocking the tmclient (i.e. they
 	// call grpcvtctldserver.NewVtctldServer to initialize the unit under test),
diff --git a/go/vt/vtadmin/cluster/cluster_test.go b/go/vt/vtadmin/cluster/cluster_test.go
deleted file mode 100644
index a7d0bdde70..0000000000
--- a/go/vt/vtadmin/cluster/cluster_test.go
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
-Copyright 2021 The Vitess Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package cluster_test
-
-import (
-	"context"
-	"database/sql"
-	"errors"
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-
-	"vitess.io/vitess/go/vt/vitessdriver"
-	"vitess.io/vitess/go/vt/vtadmin/cluster"
-	"vitess.io/vitess/go/vt/vtadmin/cluster/discovery/fakediscovery"
-	vtadminerrors "vitess.io/vitess/go/vt/vtadmin/errors"
-	"vitess.io/vitess/go/vt/vtadmin/testutil"
-	"vitess.io/vitess/go/vt/vtadmin/vtsql"
-
-	topodatapb "vitess.io/vitess/go/vt/proto/topodata"
-	"vitess.io/vitess/go/vt/proto/vtadmin"
-	vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin"
-)
-
-// This test only validates the error handling on dialing database connections.
-// Other cases are covered by one or both of TestFindTablets and TestFindTablet.
-func TestGetTablets(t *testing.T) {
-	disco := fakediscovery.New()
-	disco.AddTaggedGates(nil, &vtadminpb.VTGate{Hostname: "gate"})
-
-	db := vtsql.New(&vtsql.Config{
-		Cluster: &vtadminpb.Cluster{
-			Id:   "c1",
-			Name: "one",
-		},
-		Discovery: disco,
-	})
-	db.DialFunc = func(cfg vitessdriver.Configuration) (*sql.DB, error) {
-		return nil, assert.AnError
-	}
-
-	c := &cluster.Cluster{DB: db}
-	_, err := c.GetTablets(context.Background())
-	assert.Error(t, err)
-}
-
-func TestFindTablets(t *testing.T) {
-	tests := []struct {
-		name     string
-		tablets  []*vtadminpb.Tablet
-		filter   func(*vtadminpb.Tablet) bool
-		n        int
-		expected []*vtadminpb.Tablet
-	}{
-		{
-			name: "returns n filtered tablets",
-			tablets: []*vtadminpb.Tablet{
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  100,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_NOT_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  101,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  102,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  103,
-						},
-						Keyspace: "commerce",
-					},
-				},
-			},
-			filter: func(t *vtadminpb.Tablet) bool {
-				return t.State == vtadminpb.Tablet_SERVING
-			},
-			n: 2,
-			expected: []*vtadminpb.Tablet{
-				{
-					Cluster: &vtadmin.Cluster{
-						Id:   "c0",
-						Name: "cluster0",
-					},
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  100,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					Cluster: &vtadmin.Cluster{
-						Id:   "c0",
-						Name: "cluster0",
-					},
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  102,
-						},
-						Keyspace: "commerce",
-					},
-				},
-			},
-		},
-		{
-			name: "returns all filtered tablets when n == -1",
-			tablets: []*vtadminpb.Tablet{
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  100,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_NOT_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  101,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  102,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  103,
-						},
-						Keyspace: "commerce",
-					},
-				},
-			},
-			filter: func(t *vtadminpb.Tablet) bool {
-				return t.State == vtadminpb.Tablet_SERVING
-			},
-			n: -1,
-			expected: []*vtadminpb.Tablet{
-				{
-					Cluster: &vtadmin.Cluster{
-						Id:   "c0",
-						Name: "cluster0",
-					},
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  100,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					Cluster: &vtadmin.Cluster{
-						Id:   "c0",
-						Name: "cluster0",
-					},
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  102,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					Cluster: &vtadmin.Cluster{
-						Id:   "c0",
-						Name: "cluster0",
-					},
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  103,
-						},
-						Keyspace: "commerce",
-					},
-				},
-			},
-		},
-	}
-
-	for _, tt := range tests {
-		cluster := testutil.BuildCluster(0, nil, tt.tablets, nil)
-		tablets, err := cluster.FindTablets(context.Background(), tt.filter, tt.n)
-
-		assert.NoError(t, err)
-		testutil.AssertTabletSlicesEqual(t, tt.expected, tablets)
-	}
-}
-
-func TestFindTablet(t *testing.T) {
-	tests := []struct {
-		name          string
-		tablets       []*vtadminpb.Tablet
-		filter        func(*vtadminpb.Tablet) bool
-		expected      *vtadminpb.Tablet
-		expectedError error
-	}{
-		{
-			name: "returns the first matching tablet",
-			tablets: []*vtadminpb.Tablet{
-				{
-					State: vtadminpb.Tablet_NOT_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  100,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  101,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  102,
-						},
-						Keyspace: "commerce",
-					},
-				},
-			},
-
-			filter: func(t *vtadminpb.Tablet) bool {
-				return t.State == vtadminpb.Tablet_SERVING
-			},
-			expected: &vtadminpb.Tablet{
-				Cluster: &vtadmin.Cluster{
-					Id:   "c0",
-					Name: "cluster0",
-				},
-				State: vtadminpb.Tablet_SERVING,
-				Tablet: &topodatapb.Tablet{
-					Alias: &topodatapb.TabletAlias{
-						Cell: "c0_cell1",
-						Uid:  101,
-					},
-					Keyspace: "commerce",
-				},
-			},
-		},
-		{
-			name: "returns an error if no match found",
-			tablets: []*vtadminpb.Tablet{
-				{
-					State: vtadminpb.Tablet_NOT_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  100,
-						},
-						Keyspace: "commerce",
-					},
-				},
-				{
-					State: vtadminpb.Tablet_NOT_SERVING,
-					Tablet: &topodatapb.Tablet{
-						Alias: &topodatapb.TabletAlias{
-							Cell: "c0_cell1",
-							Uid:  101,
-						},
-						Keyspace: "commerce",
-					},
-				},
-			},
-			filter: func(t *vtadminpb.Tablet) bool {
-				return t.State == vtadminpb.Tablet_SERVING
-			},
-			expectedError: vtadminerrors.ErrNoTablet,
-		},
-	}
-
-	for _, tt := range tests {
-		cluster := testutil.BuildCluster(0, nil, tt.tablets, nil)
-		tablet, err := cluster.FindTablet(context.Background(), tt.filter)
-
-		if tt.expectedError != nil {
-			assert.True(t, errors.Is(err, tt.expectedError), "expected error type %w does not match actual error type %w", err, tt.expectedError)
-		} else {
-			assert.NoError(t, err)
-			testutil.AssertTabletsEqual(t, tt.expected, tablet)
-		}
-	}
-}
diff --git a/go/vt/vtadmin/testutil/cluster.go b/go/vt/vtadmin/testutil/cluster.go
deleted file mode 100644
index 6c7fea37a9..0000000000
--- a/go/vt/vtadmin/testutil/cluster.go
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Copyright 2021 The Vitess Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package testutil
-
-import (
-	"database/sql"
-	"fmt"
-
-	"google.golang.org/grpc"
-
-	"vitess.io/vitess/go/vt/grpcclient"
-	"vitess.io/vitess/go/vt/vitessdriver"
-	"vitess.io/vitess/go/vt/vtadmin/cluster"
-	"vitess.io/vitess/go/vt/vtadmin/cluster/discovery/fakediscovery"
-	vtadminvtctldclient "vitess.io/vitess/go/vt/vtadmin/vtctldclient"
-	"vitess.io/vitess/go/vt/vtadmin/vtsql"
-	"vitess.io/vitess/go/vt/vtadmin/vtsql/fakevtsql"
-	"vitess.io/vitess/go/vt/vtctl/vtctldclient"
-
-	vtadminpb "vitess.io/vitess/go/vt/proto/vtadmin"
-)
-
-// Dbcfg is a test utility for controlling the behavior of the cluster's DB
-// at the package sql level.
-type Dbcfg struct {
-	ShouldErr bool
-}
-
-// BuildCluster is a shared helper for building a cluster that contains the given tablets and
-// talking to the given vtctld server. dbconfigs contains an optional config
-// for controlling the behavior of the cluster's DB at the package sql level.
-func BuildCluster(i int, vtctldClient vtctldclient.VtctldClient, tablets []*vtadminpb.Tablet, dbconfigs map[string]*Dbcfg) *cluster.Cluster {
-	disco := fakediscovery.New()
-	disco.AddTaggedGates(nil, &vtadminpb.VTGate{Hostname: fmt.Sprintf("cluster%d-gate", i)})
-	disco.AddTaggedVtctlds(nil, &vtadminpb.Vtctld{Hostname: "doesn't matter"})
-
-	cluster := &cluster.Cluster{
-		ID:        fmt.Sprintf("c%d", i),
-		Name:      fmt.Sprintf("cluster%d", i),
-		Discovery: disco,
-	}
-
-	dbconfig, ok := dbconfigs[cluster.ID]
-	if !ok {
-		dbconfig = &Dbcfg{ShouldErr: false}
-	}
-
-	db := vtsql.New(&vtsql.Config{
-		Cluster:   cluster.ToProto(),
-		Discovery: disco,
-	})
-	db.DialFunc = func(cfg vitessdriver.Configuration) (*sql.DB, error) {
-		return sql.OpenDB(&fakevtsql.Connector{Tablets: tablets, ShouldErr: dbconfig.ShouldErr}), nil
-	}
-
-	vtctld := vtadminvtctldclient.New(&vtadminvtctldclient.Config{
-		Cluster:   cluster.ToProto(),
-		Discovery: disco,
-	})
-	vtctld.DialFunc = func(addr string, ff grpcclient.FailFast, opts ...grpc.DialOption) (vtctldclient.VtctldClient, error) {
-		return vtctldClient, nil
-	}
-
-	cluster.DB = db
-	cluster.Vtctld = vtctld
-
-	return cluster
-}
diff --git a/go/vt/vtadmin/testutil/proto_compare.go b/go/vt/vtadmin/testutil/proto_compare.go
index 496b302d43..2a24853e87 100644
--- a/go/vt/vtadmin/testutil/proto_compare.go
+++ b/go/vt/vtadmin/testutil/proto_compare.go
@@ -71,43 +71,3 @@ func AssertSchemaSlicesEqual(t *testing.T, expected []*vtadminpb.Schema, actual
 
 	assert.ElementsMatch(t, expected, actual, msgAndArgs...)
 }
-
-// AssertTabletSlicesEqual is a convenience function to assert that two
-// []*vtadminpb.Tablet slices are equal, after clearing out any reserved
-// proto XXX_ fields.
-func AssertTabletSlicesEqual(t *testing.T, expected []*vtadminpb.Tablet, actual []*vtadminpb.Tablet, msgAndArgs ...interface{}) {
-	t.Helper()
-
-	for _, ts := range [][]*vtadminpb.Tablet{expected, actual} {
-		for _, t := range ts {
-			t.XXX_sizecache = 0
-			t.XXX_unrecognized = nil
-
-			if t.Cluster != nil {
-				t.Cluster.XXX_sizecache = 0
-				t.Cluster.XXX_unrecognized = nil
-			}
-
-			if t.Tablet != nil {
-				t.Tablet.XXX_sizecache = 0
-				t.Tablet.XXX_unrecognized = nil
-
-				if t.Tablet.Alias != nil {
-					t.Tablet.Alias.XXX_sizecache = 0
-					t.Tablet.Alias.XXX_unrecognized = nil
-				}
-			}
-		}
-	}
-
-	assert.ElementsMatch(t, expected, actual, msgAndArgs...)
-}
-
-// AssertTabletsEqual is a convenience function to assert that two
-// *vtadminpb.Tablets are equal, after clearing out any reserved
-// proto XXX_ fields.
-func AssertTabletsEqual(t *testing.T, expected *vtadminpb.Tablet, actual *vtadminpb.Tablet, msgAndArgs ...interface{}) {
-	t.Helper()
-
-	AssertTabletSlicesEqual(t, []*vtadminpb.Tablet{expected}, []*vtadminpb.Tablet{actual}, msgAndArgs...)
-}
diff --git a/go/vt/vtgate/planbuilder/testdata/show_cases.txt b/go/vt/vtgate/planbuilder/testdata/show_cases.txt
index 5aa2ade657..8316f4c756 100644
--- a/go/vt/vtgate/planbuilder/testdata/show_cases.txt
+++ b/go/vt/vtgate/planbuilder/testdata/show_cases.txt
@@ -220,43 +220,15 @@
   "QueryType": "SHOW",
   "Original": "show variables",
   "Instructions": {
-    "OperatorType": "ReplaceVariables",
-    "Inputs": [
-      {
-        "OperatorType": "Send",
-        "Keyspace": {
-          "Name": "main",
-          "Sharded": false
-        },
-        "TargetDestination": "AnyShard()",
-        "IsDML": false,
-        "Query": "show variables",
-        "SingleShardOnly": true
-      }
-    ]
-  }
-}
-
-# show global variables
-"show global variables"
-{
-  "QueryType": "SHOW",
-  "Original": "show global variables",
-  "Instructions": {
-    "OperatorType": "ReplaceVariables",
-    "Inputs": [
-      {
-        "OperatorType": "Send",
-        "Keyspace": {
-          "Name": "main",
-          "Sharded": false
-        },
-        "TargetDestination": "AnyShard()",
-        "IsDML": false,
-        "Query": "show global variables",
-        "SingleShardOnly": true
-      }
-    ]
+    "OperatorType": "Send",
+    "Keyspace": {
+      "Name": "main",
+      "Sharded": false
+    },
+    "TargetDestination": "AnyShard()",
+    "IsDML": false,
+    "Query": "show variables",
+    "SingleShardOnly": true
   }
 }
 
@@ -424,26 +396,15 @@
   "QueryType": "SHOW",
   "Original": "show tables",
   "Instructions": {
-    "OperatorType": "RenameFields",
-    "Columns": [
-      "Tables_in_main"
-    ],
-    "Indices": [
-      0
-    ],
-    "Inputs": [
-      {
-        "OperatorType": "Send",
-        "Keyspace": {
-          "Name": "main",
-          "Sharded": false
-        },
-        "TargetDestination": "AnyShard()",
-        "IsDML": false,
-        "Query": "show tables",
-        "SingleShardOnly": true
-      }
-    ]
+    "OperatorType": "Send",
+    "Keyspace": {
+      "Name": "main",
+      "Sharded": false
+    },
+    "TargetDestination": "AnyShard()",
+    "IsDML": false,
+    "Query": "show tables",
+    "SingleShardOnly": true
   }
 }
 
@@ -453,26 +414,15 @@
   "QueryType": "SHOW",
   "Original": "show tables from user",
   "Instructions": {
-    "OperatorType": "RenameFields",
-    "Columns": [
-      "Tables_in_user"
-    ],
-    "Indices": [
-      0
-    ],
-    "Inputs": [
-      {
-        "OperatorType": "Send",
-        "Keyspace": {
-          "Name": "user",
-          "Sharded": true
-        },
-        "TargetDestination": "AnyShard()",
-        "IsDML": false,
-        "Query": "show tables",
-        "SingleShardOnly": true
-      }
-    ]
+    "OperatorType": "Send",
+    "Keyspace": {
+      "Name": "user",
+      "Sharded": true
+    },
+    "TargetDestination": "AnyShard()",
+    "IsDML": false,
+    "Query": "show tables",
+    "SingleShardOnly": true
   }
 }
 
@@ -482,25 +432,15 @@
   "QueryType": "SHOW",
   "Original": "show tables from performance_schema",
   "Instructions": {
-    "OperatorType": "RenameFields",
-    "Columns": [
-      "Tables_in_performance_schema"
-    ],
-    "Indices": [
-      0
-    ],
-    "Inputs": [
-      {
-        "OperatorType": "Send",
-        "Keyspace": {
-          "Name": "main",
-          "Sharded": false
-        },
-        "TargetDestination": "AnyShard()",
-        "IsDML": false,
-        "Query": "show tables from performance_schema",
-        "SingleShardOnly": true
-      }
-    ]
+    "OperatorType": "Send",
+    "Keyspace": {
+      "Name": "main",
+      "Sharded": false
+    },
+    "TargetDestination": "AnyShard()",
+    "IsDML": false,
+    "Query": "show tables from performance_schema",
+    "SingleShardOnly": true
   }
 }
+
diff --git a/go/vt/vtgate/planbuilder/testdata/show_cases_no_default_keyspace.txt b/go/vt/vtgate/planbuilder/testdata/show_cases_no_default_keyspace.txt
index df2253e38b..737b6ed6bb 100644
--- a/go/vt/vtgate/planbuilder/testdata/show_cases_no_default_keyspace.txt
+++ b/go/vt/vtgate/planbuilder/testdata/show_cases_no_default_keyspace.txt
@@ -40,19 +40,14 @@
   "QueryType": "SHOW",
   "Original": "show variables",
   "Instructions": {
-    "OperatorType": "ReplaceVariables",
-    "Inputs": [
-      {
-        "OperatorType": "Send",
-        "Keyspace": {
-          "Name": "main",
-          "Sharded": false
-        },
-        "TargetDestination": "AnyShard()",
-        "IsDML": false,
-        "Query": "show variables",
-        "SingleShardOnly": true
-      }
-    ]
+    "OperatorType": "Send",
+    "Keyspace": {
+      "Name": "main",
+      "Sharded": false
+    },
+    "TargetDestination": "AnyShard()",
+    "IsDML": false,
+    "Query": "show variables",
+    "SingleShardOnly": true
   }
 }
diff --git a/go/vt/vtgate/vtgate_test.go b/go/vt/vtgate/vtgate_test.go
index 2871b663dd..fe9d9ebe30 100644
--- a/go/vt/vtgate/vtgate_test.go
+++ b/go/vt/vtgate/vtgate_test.go
@@ -21,8 +21,6 @@ import (
 	"strings"
 	"testing"
 
-	"vitess.io/vitess/go/test/utils"
-
 	"context"
 
 	"github.com/golang/protobuf/proto"
@@ -209,7 +207,9 @@ func TestVTGateStreamExecute(t *testing.T) {
 	}, {
 		Rows: sandboxconn.StreamRowResult.Rows,
 	}}
-	utils.MustMatch(t, want, qrs)
+	if !reflect.DeepEqual(want, qrs) {
+		t.Errorf("want \n%+v, got \n%+v", want, qrs)
+	}
 	if !proto.Equal(sbc.Options[0], executeOptions) {
 		t.Errorf("got ExecuteOptions \n%+v, want \n%+v", sbc.Options[0], executeOptions)
 	}
diff --git a/go/vt/wrangler/materializer_test.go b/go/vt/wrangler/materializer_test.go
index 4bfb07357f..08500a2d80 100644
--- a/go/vt/wrangler/materializer_test.go
+++ b/go/vt/wrangler/materializer_test.go
@@ -1574,6 +1574,8 @@ func TestMaterializerOneToOne(t *testing.T) {
 				CreateDdl:        "t4ddl",
 			},
 		},
+		Cell:        "zone1",
+		TabletTypes: "master,rdonly",
 	}
 	env := newTestMaterializerEnv(t, ms, []string{"0"}, []string{"0"})
 	defer env.close()
@@ -1590,7 +1592,7 @@ func TestMaterializerOneToOne(t *testing.T) {
 				`rules:<match:\\"t2\\" filter:\\"select.*t3\\" > `+
 				`rules:<match:\\"t4\\" > `+
 				`> ', `)+
-			`'', [0-9]*, [0-9]*, '', '', [0-9]*, 0, 'Stopped', 'vt_targetks'`+
+			`'', [0-9]*, [0-9]*, 'zone1', 'master,rdonly', [0-9]*, 0, 'Stopped', 'vt_targetks'`+
 			`\)`+eol,
 		&sqltypes.Result{},
 	)