diff --git a/go/vt/vttablet/tabletserver/query_executor.go b/go/vt/vttablet/tabletserver/query_executor.go index 01783ea0197..54c51a1821e 100644 --- a/go/vt/vttablet/tabletserver/query_executor.go +++ b/go/vt/vttablet/tabletserver/query_executor.go @@ -643,7 +643,7 @@ func (qre *QueryExecutor) execNextval() (*sqltypes.Result, error) { if t.SequenceInfo.NextVal == 0 || t.SequenceInfo.NextVal+inc > t.SequenceInfo.LastVal { _, err := qre.execAsTransaction(func(conn *StatefulConnection) (*sqltypes.Result, error) { query := fmt.Sprintf("select next_id, cache from %s where id = 0 for update", sqlparser.String(tableName)) - qr, err := qre.execStatefulConn(conn, query, false) + qr, err := qre.execStatefulConnWithOpt(conn, query, mysql.ExecuteOptions{MaxRows: int(qre.tsv.qe.maxResultSize.Load())}) if err != nil { return nil, err } @@ -1133,6 +1133,17 @@ func (qre *QueryExecutor) execDBConn(conn *connpool.Conn, sql string, wantfields } func (qre *QueryExecutor) execStatefulConn(conn *StatefulConnection, sql string, wantfields bool) (*sqltypes.Result, error) { + opt := mysql.ExecuteOptions{ + MaxRows: int(qre.tsv.qe.maxResultSize.Load()), + WantFields: wantfields, + } + if qre.options != nil { + opt.RawPackets = qre.options.RawMysqlPackets + } + return qre.execStatefulConnWithOpt(conn, sql, opt) +} + +func (qre *QueryExecutor) execStatefulConnWithOpt(conn *StatefulConnection, sql string, opt mysql.ExecuteOptions) (*sqltypes.Result, error) { span, ctx := trace.NewSpan(qre.ctx, "QueryExecutor.execStatefulConn") defer span.Finish() @@ -1145,11 +1156,6 @@ func (qre *QueryExecutor) execStatefulConn(conn *StatefulConnection, sql string, } defer qre.tsv.statefulql.Remove(qd) - opt := mysql.ExecuteOptions{ - MaxRows: int(qre.tsv.qe.maxResultSize.Load()), - WantFields: wantfields, - RawPackets: qre.options.RawMysqlPackets, - } return conn.ExecOpt(ctx, sql, opt) }