Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,12 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
timer := time.NewTimer(waitTime)
defer timer.Stop()

// Wrap the callback to include a BytesBuffer.Reset() to clean out rows that have already been spooled
resetCallback := func(r *sqltypes.Result, more bool) error {
defer buf.Reset()
return callback(r, more)
}

// Reads rows from the channel, converts them to wire format,
// and calls |callback| to give them to vitess.
eg.Go(func() error {
Expand All @@ -645,7 +651,7 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
r = &sqltypes.Result{Fields: resultFields}
}
if r.RowsAffected == rowsBatch {
if err := callback(r, more); err != nil {
if err := resetCallback(r, more); err != nil {
return err
}
r = nil
Expand Down
Loading