Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Dec 18, 2024
1 parent 2fbe771 commit 0a62a73
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion go/sqltypes/proto3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions go/test/endtoend/vtgate/queries/misc/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/grpcqueryservice/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
Expand Down
3 changes: 2 additions & 1 deletion go/vt/vttablet/grpctabletconn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 0a62a73

Please sign in to comment.