Skip to content

Commit

Permalink
incorporated review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: c-r-dev <[email protected]>
  • Loading branch information
c-r-dev committed Jan 27, 2025
1 parent 65d7721 commit 5acda89
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 22 deletions.
2 changes: 1 addition & 1 deletion go/vt/vtadmin/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ func (api *API) VExplain(ctx context.Context, req *vtadminpb.VExplainRequest) (*
return nil, vterrors.VT09017("Invalid VExplain statement")
}

response, err := c.GetVExplain(ctx, req, stmt.(*sqlparser.VExplainStmt))
response, err := c.DB.VExplain(ctx, req.GetSql(), stmt.(*sqlparser.VExplainStmt))

if err != nil {
return nil, err
Expand Down
1 change: 0 additions & 1 deletion go/vt/vtadmin/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5309,7 +5309,6 @@ func TestVExplain(t *testing.T) {

// We don't particularly care to test the contents of the VExplain response,
// just that it exists.
print(resp.Response)
assert.NotEmpty(t, resp.Response)
}
})
Expand Down
20 changes: 0 additions & 20 deletions go/vt/vtadmin/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"vitess.io/vitess/go/vt/callerid"
"vitess.io/vitess/go/vt/concurrency"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/topo/topoproto"
"vitess.io/vitess/go/vt/vtadmin/cache"
"vitess.io/vitess/go/vt/vtadmin/cluster/discovery"
Expand Down Expand Up @@ -2506,25 +2505,6 @@ func (c *Cluster) ToggleTabletReplication(ctx context.Context, tablet *vtadminpb
return err
}

// GetVExplain returns the VExplain json message.
func (c *Cluster) GetVExplain(ctx context.Context, req *vtadminpb.VExplainRequest, vexplainStmt *sqlparser.VExplainStmt) (*vtadminpb.VExplainResponse, error) {
span, ctx := trace.NewSpan(ctx, "Cluster.GetVExplain")
defer span.Finish()

AnnotateSpan(c, span)
span.Annotate("clusterId", req.ClusterId)
span.Annotate("keyspace", req.Keyspace)
span.Annotate("sql", req.Sql)

query := req.GetSql()

return c.getVExplain(ctx, query, vexplainStmt)
}

func (c *Cluster) getVExplain(ctx context.Context, query string, vexplainStmt *sqlparser.VExplainStmt) (*vtadminpb.VExplainResponse, error) {
return c.DB.VExplain(ctx, query, vexplainStmt)
}

// Debug returns a map of debug information for a cluster.
func (c *Cluster) Debug() map[string]any {
m := map[string]any{
Expand Down
1 change: 1 addition & 0 deletions go/vt/vtadmin/vtsql/vtsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func (vtgate *VTGateProxy) VExplain(ctx context.Context, query string, vexplainS
return nil, nil
}
}

func convertVExplainResultToString(rows *sql.Rows) (*vtadminpb.VExplainResponse, error) {
var queryPlan string
for rows.Next() {
Expand Down

0 comments on commit 5acda89

Please sign in to comment.