Skip to content

Commit

Permalink
Update comment about splitting compressed packets
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed May 10, 2023
1 parent 3c4597b commit fb55f65
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/packetio.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,10 @@ type compressedWriter struct {
}

func (cw *compressedWriter) Write(data []byte) (n int, err error) {
// MySQL seems to start with 16384 and larger packets after that.
// Must fit in the 3 byte field in the header.
maxCompressedSize := 1048576 // 1024*1024
// MySQL starts with `net_buffer_length` (default 16384) and larger packets after that.
// The length itself must fit in the 3 byte field in the header.
// Can't be bigger then the max value for `net_buffer_length` (1048576)
maxCompressedSize := 1048576 // 1 MiB

for {
remainingLen := maxCompressedSize - cw.buf.Len()
Expand Down

0 comments on commit fb55f65

Please sign in to comment.