From 0a62a735c39caefaee630c3e07bf5216adb3e1cf Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Wed, 18 Dec 2024 14:31:02 +0530 Subject: [PATCH] wip Signed-off-by: Harshit Gangal --- go/sqltypes/proto3.go | 3 ++- .../endtoend/vtgate/queries/misc/misc_test.go | 22 +++++++++---------- go/vt/vttablet/grpcqueryservice/server.go | 2 +- go/vt/vttablet/grpctabletconn/conn.go | 3 ++- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/go/sqltypes/proto3.go b/go/sqltypes/proto3.go index 5c4934f47a6..badbcf11c5b 100644 --- a/go/sqltypes/proto3.go +++ b/go/sqltypes/proto3.go @@ -100,6 +100,7 @@ func ResultToProto3(qr *Result) *querypb.QueryResult { if qr == nil { return nil } + log.Infof("Result: (%v, %v)", qr.InsertID, qr.InsertIDChanged) return &querypb.QueryResult{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, @@ -136,7 +137,7 @@ func CustomProto3ToResult(fields []*querypb.Field, qr *querypb.QueryResult) *Res if qr == nil { return nil } - log.Info("Result: %v, %v", qr.InsertId, qr.InsertIdChanged) + log.Infof("Result: %v, %v", qr.InsertId, qr.InsertIdChanged) return &Result{ Fields: qr.Fields, RowsAffected: qr.RowsAffected, diff --git a/go/test/endtoend/vtgate/queries/misc/misc_test.go b/go/test/endtoend/vtgate/queries/misc/misc_test.go index eaa2e21892f..7f40d269fbb 100644 --- a/go/test/endtoend/vtgate/queries/misc/misc_test.go +++ b/go/test/endtoend/vtgate/queries/misc/misc_test.go @@ -37,17 +37,17 @@ func start(t *testing.T) (utils.MySQLCompare, func()) { mcmp, err := utils.NewMySQLCompare(t, vtParams, mysqlParams) require.NoError(t, err) - deleteAll := func() { - tables := []string{"t1", "tbl", "unq_idx", "nonunq_idx", "tbl_enum_set", "uks.unsharded"} - for _, table := range tables { - _, _ = mcmp.ExecAndIgnore("delete from " + table) - } - } - - deleteAll() + // deleteAll := func() { + // tables := []string{"t1", "tbl", "unq_idx", "nonunq_idx", "tbl_enum_set", "uks.unsharded"} + // for _, table := range tables { + // _, _ = mcmp.ExecAndIgnore("delete from " + table) + // } + // } + // + // deleteAll() return mcmp, func() { - deleteAll() + // deleteAll() mcmp.Close() } } @@ -135,7 +135,7 @@ func TestCast(t *testing.T) { func TestSetAndGetLastInsertID(t *testing.T) { notZero := 1 checkQuery := func(i string, workload string, tx bool, mcmp utils.MySQLCompare) { - for _, val := range []int{notZero, 0, notZero + 99} { + for _, val := range []int{notZero} { query := fmt.Sprintf(i, val) name := fmt.Sprintf("%s - %s", workload, query) if tx { @@ -155,7 +155,7 @@ func TestSetAndGetLastInsertID(t *testing.T) { queries := []string{ // "select last_insert_id(%d)", - "select last_insert_id(%d), id1, id2 from t1 limit 1", + "select last_insert_id(%d), id1, id2 from t1 where id1 = 1 limit 1", // "select last_insert_id(%d), id1, id2 from t1 where 1 = 2", // "select 12 from t1 where last_insert_id(%d)", // "update t1 set id2 = last_insert_id(%d) where id1 = 1", diff --git a/go/vt/vttablet/grpcqueryservice/server.go b/go/vt/vttablet/grpcqueryservice/server.go index 3fb839ab452..937d64d7a69 100644 --- a/go/vt/vttablet/grpcqueryservice/server.go +++ b/go/vt/vttablet/grpcqueryservice/server.go @@ -66,7 +66,7 @@ func (q *query) StreamExecute(request *querypb.StreamExecuteRequest, stream quer request.ImmediateCallerId, ) err = q.server.StreamExecute(ctx, request.Target, request.Query.Sql, request.Query.BindVariables, request.TransactionId, request.ReservedId, request.Options, func(reply *sqltypes.Result) error { - log.Infof("StreamExecute: (%v, %v)", reply.InsertID, reply.InsertIDChanged) + log.Infof("StreamExecute Sending: (%v, %v, %v)", request.Target.Shard, reply.InsertID, reply.InsertIDChanged) return stream.Send(&querypb.StreamExecuteResponse{ Result: sqltypes.ResultToProto3(reply), }) diff --git a/go/vt/vttablet/grpctabletconn/conn.go b/go/vt/vttablet/grpctabletconn/conn.go index 6bbbefeda27..8144547381d 100644 --- a/go/vt/vttablet/grpctabletconn/conn.go +++ b/go/vt/vttablet/grpctabletconn/conn.go @@ -188,8 +188,9 @@ func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb. if fields == nil { fields = ser.Result.Fields } - log.Infof("StreamExecute result: %v, %v, %v", query, ser.Result.InsertId, ser.Result.InsertIdChanged) + log.Infof("StreamExecute result: %v, %v, rows: %v, %v, %v", query, target.Shard, len(ser.Result.Rows), ser.Result.InsertId, ser.Result.InsertIdChanged) if err := callback(sqltypes.CustomProto3ToResult(fields, ser.Result)); err != nil { + log.Infof("StreamExecute callback error: %v", err) if err == io.EOF { return nil }