Skip to content

Commit 8ef1f74

Browse files
author
James Cor
committed
feedback
1 parent feef082 commit 8ef1f74

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

server/handler.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,8 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
654654
// clean out rows that have already been spooled.
655655
// A server-side cursor allows the caller to fetch results cached on the server-side,
656656
// so if a cursor exists, we can't release the buffer memory yet.
657-
resetCallback := callback
658657
if c.StatusFlags&uint16(mysql.ServerCursorExists) != 0 {
659-
resetCallback = func(r *sqltypes.Result, more bool) error {
658+
callback = func(r *sqltypes.Result, more bool) error {
660659
defer buf.Reset()
661660
return callback(r, more)
662661
}
@@ -717,7 +716,7 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
717716
case <-timer.C:
718717
if h.readTimeout != 0 {
719718
// Cancel and return so Vitess can call the CloseConnection callback
720-
ctx.GetLogger().Tracef("connection timeout")
719+
ctx.GetLogger().Warn("connection timeout")
721720
return ErrRowTimeout.New()
722721
}
723722

@@ -757,7 +756,7 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
757756
}
758757
})
759758

760-
// Drain sqltypes.Result from resChan and call callback (send to client and reset buffer)
759+
// Drain sqltypes.Result from resChan and call callback (send to client and potentially reset buffer)
761760
var processedAtLeastOneBatch bool
762761
eg.Go(func() (err error) {
763762
defer pan2err(&err)
@@ -772,7 +771,7 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
772771
return nil
773772
}
774773
processedAtLeastOneBatch = true
775-
err = resetCallback(r, more)
774+
err = callback(r, more)
776775
if err != nil {
777776
return err
778777
}
@@ -834,9 +833,8 @@ func (h *Handler) resultForValueRowIter(ctx *sql.Context, c *mysql.Conn, schema
834833
// clean out rows that have already been spooled.
835834
// A server-side cursor allows the caller to fetch results cached on the server-side,
836835
// so if a cursor exists, we can't release the buffer memory yet.
837-
resetCallback := callback
838836
if c.StatusFlags&uint16(mysql.ServerCursorExists) != 0 {
839-
resetCallback = func(r *sqltypes.Result, more bool) error {
837+
callback = func(r *sqltypes.Result, more bool) error {
840838
defer buf.Reset()
841839
return callback(r, more)
842840
}
@@ -895,7 +893,7 @@ func (h *Handler) resultForValueRowIter(ctx *sql.Context, c *mysql.Conn, schema
895893
case <-timer.C:
896894
if h.readTimeout != 0 {
897895
// Cancel and return so Vitess can call the CloseConnection callback
898-
ctx.GetLogger().Tracef("connection timeout")
896+
ctx.GetLogger().Warn("connection timeout")
899897
return ErrRowTimeout.New()
900898
}
901899

@@ -942,7 +940,7 @@ func (h *Handler) resultForValueRowIter(ctx *sql.Context, c *mysql.Conn, schema
942940
return nil
943941
}
944942
processedAtLeastOneBatch = true
945-
err = resetCallback(r, more)
943+
err = callback(r, more)
946944
if err != nil {
947945
return err
948946
}

0 commit comments

Comments
 (0)