Skip to content

Commit

Permalink
recyle buffer changes
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
  • Loading branch information
harshit-gangal committed Nov 24, 2024
1 parent f831d5f commit 4422cf7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions go/mysql/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,10 @@ func (c *Conn) ReadQueryResultAsSliceBuffer(maxrows int) (*sqltypes.Result, bool
c.recycleReadPacket()
// empty by design
} else if isErrorPacket(data) {
c.recycleReadPacket()
defer c.recycleReadPacket()
return nil, false, 0, ParseErrorPacket(data)
} else {
c.recycleReadPacket()
defer c.recycleReadPacket()
return nil, false, 0, vterrors.Errorf(vtrpc.Code_INTERNAL, "unexpected packet after fields: %v", data)
}
}
Expand All @@ -494,7 +494,8 @@ func (c *Conn) ReadQueryResultAsSliceBuffer(maxrows int) (*sqltypes.Result, bool
}
dest := make([]byte, len(data))
copy(dest, data)
rawPackets = append(rawPackets, dest)
data = dest
rawPackets = append(rawPackets, data)
c.recycleReadPacket()

if c.isEOFPacket(data) {
Expand Down

0 comments on commit 4422cf7

Please sign in to comment.