From 429ca08dd81355c45aef848641891bf443d883a6 Mon Sep 17 00:00:00 2001 From: James Cor Date: Tue, 1 Oct 2024 12:08:15 -0700 Subject: [PATCH 1/4] revert alloc --- sql/rowexec/rel_iters.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/rowexec/rel_iters.go b/sql/rowexec/rel_iters.go index a331278190..0d0e37e185 100644 --- a/sql/rowexec/rel_iters.go +++ b/sql/rowexec/rel_iters.go @@ -149,7 +149,7 @@ func ProjectRow( row sql.Row, ) (sql.Row, error) { var fields = make(sql.Row, len(projections)) - var secondPass = make([]int, 0, len(projections)) + var secondPass []int for i, expr := range projections { // Default values that are expressions may reference other fields, thus they must evaluate after all other exprs. // Also default expressions may not refer to other columns that come after them if they also have a default expr. From 052c0d929995f40826e35a8d6622b1c8ba8beb46 Mon Sep 17 00:00:00 2001 From: James Cor Date: Tue, 1 Oct 2024 13:22:02 -0700 Subject: [PATCH 2/4] move poll --- server/handler.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/handler.go b/server/handler.go index 00cf8a162e..3d4ebef75b 100644 --- a/server/handler.go +++ b/server/handler.go @@ -558,12 +558,6 @@ func (h *Handler) resultForDefaultIter( } } - pollCtx, cancelF := ctx.NewSubContext() - eg.Go(func() error { - defer pan2err() - return h.pollForClosedConnection(pollCtx, c) - }) - wg := sync.WaitGroup{} wg.Add(2) @@ -594,6 +588,12 @@ func (h *Handler) resultForDefaultIter( } }) + pollCtx, cancelF := ctx.NewSubContext() + eg.Go(func() error { + defer pan2err() + return h.pollForClosedConnection(pollCtx, c) + }) + // Default waitTime is one minute if there is no timeout configured, in which case // it will loop to iterate again unless the socket died by the OS timeout or other problems. // If there is a timeout, it will be enforced to ensure that Vitess has a chance to From 78b297ff5932144c78409cc25c3d8494c790cc87 Mon Sep 17 00:00:00 2001 From: James Cor Date: Tue, 1 Oct 2024 13:27:05 -0700 Subject: [PATCH 3/4] readd extra row alloc --- sql/rowexec/rel_iters.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/rowexec/rel_iters.go b/sql/rowexec/rel_iters.go index 0d0e37e185..4397c1ea55 100644 --- a/sql/rowexec/rel_iters.go +++ b/sql/rowexec/rel_iters.go @@ -175,7 +175,7 @@ func ProjectRow( field = normalizeNegativeZeros(field) fields[index] = field } - return fields, nil + return sql.NewRow(fields...), nil } func defaultValFromProjectExpr(e sql.Expression) (*sql.ColumnDefaultValue, bool) { From 05f30a1a11f2705717f6bb25a198de4e1b8f3ee4 Mon Sep 17 00:00:00 2001 From: James Cor Date: Tue, 1 Oct 2024 13:37:17 -0700 Subject: [PATCH 4/4] undo --- sql/rowexec/rel_iters.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/rowexec/rel_iters.go b/sql/rowexec/rel_iters.go index 4397c1ea55..0d0e37e185 100644 --- a/sql/rowexec/rel_iters.go +++ b/sql/rowexec/rel_iters.go @@ -175,7 +175,7 @@ func ProjectRow( field = normalizeNegativeZeros(field) fields[index] = field } - return sql.NewRow(fields...), nil + return fields, nil } func defaultValFromProjectExpr(e sql.Expression) (*sql.ColumnDefaultValue, bool) {