Skip to content

Commit

Permalink
only request raw packets for Execute API
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
  • Loading branch information
harshit-gangal committed Nov 12, 2024
1 parent 3991d28 commit 846022c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 6 additions & 2 deletions go/test/endtoend/vtgate/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,15 +854,19 @@ func getVar(t *testing.T, key string) interface{} {
return val
}

// TestShow is simple test to check if show tables works.
func TestShow(t *testing.T) {
ctx := context.Background()
conn, err := mysql.Connect(ctx, &vtParams)
require.NoError(t, err)
defer conn.Close()

qr := utils.Exec(t, conn, "show tables")
fmt.Printf("output1: %v\n", qr.Rows)
assert.Equal(t, 1, len(qr.Fields))
assert.Equal(t, 21, len(qr.Rows))

utils.Exec(t, conn, "begin")
qr = utils.Exec(t, conn, "show tables")
fmt.Printf("output2: %v\n", qr.Rows)
assert.Equal(t, 1, len(qr.Fields))
assert.Equal(t, 21, len(qr.Rows))
}
12 changes: 12 additions & 0 deletions go/vt/vttablet/grpctabletconn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ func (conn *gRPCQueryClient) BeginExecute(ctx context.Context, target *querypb.T
return state, nil, tabletconn.ConnClosed
}

if options != nil {
options.RawMysqlPackets = false
}

req := &querypb.BeginExecuteRequest{
Target: target,
EffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),
Expand Down Expand Up @@ -875,6 +879,10 @@ func (conn *gRPCQueryClient) ReserveBeginExecute(ctx context.Context, target *qu
return state, nil, tabletconn.ConnClosed
}

if options != nil {
options.RawMysqlPackets = false
}

req := &querypb.ReserveBeginExecuteRequest{
Target: target,
EffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),
Expand Down Expand Up @@ -991,6 +999,10 @@ func (conn *gRPCQueryClient) ReserveExecute(ctx context.Context, target *querypb
return state, nil, tabletconn.ConnClosed
}

if options != nil {
options.RawMysqlPackets = false
}

req := &querypb.ReserveExecuteRequest{
EffectiveCallerId: callerid.EffectiveCallerIDFromContext(ctx),
ImmediateCallerId: callerid.ImmediateCallerIDFromContext(ctx),
Expand Down

0 comments on commit 846022c

Please sign in to comment.