From 814ca21e58e54bc28752543903c89357700b4ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Fri, 3 Nov 2023 14:19:41 +0100 Subject: [PATCH] Doc: Update compression protocol information - The "Compressed Packet Header" section says the header is 7 bytes, but only describes the first 4 bytes. - Clarify what happens if both `CLIENT_COMPRESS` and `CLIENT_ZSTD_COMPRESSION_ALGORITHM` are set. - Add links to Zstandard website and update text to clarify that there now are multiple compression algorithms. --- sql-common/net_serv.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sql-common/net_serv.cc b/sql-common/net_serv.cc index 6b78d8520c86..42cd4fce0bd6 100644 --- a/sql-common/net_serv.cc +++ b/sql-common/net_serv.cc @@ -1055,6 +1055,9 @@ static bool net_write_raw_loop(NET *net, const uchar *buf, size_t count) { - Server finishes the @ref page_protocol_connection_phase with an @ref page_protocol_basic_ok_packet. + If both ::CLIENT_COMPRESS and ::CLIENT_ZSTD_COMPRESSION_ALGORITHM are set + then zlib is used. + @subpage page_protocol_basic_compression_packet */ @@ -1079,6 +1082,9 @@ static bool net_write_raw_loop(NET *net, const uchar *buf, size_t count) { compressed sequence id Sequence ID of the compressed packets, reset in the same way as the @ref sect_protocol_basic_packets_packet, but incremented independently + @ref a_protocol_type_int3 "int<3>" + length of uncompressed payload + Length of payload before compression @section sect_protocol_basic_compression_packet_compressed_payload Compressed Payload @@ -1087,10 +1093,11 @@ static bool net_write_raw_loop(NET *net, const uchar *buf, size_t count) { @ref sect_protocol_basic_compression_packet_header is followed by the compressed payload. - It uses the *deflate* algorithm as described in + Depending on which capability flags are set it uses the *deflate* algorithm as described in [RFC 1951](http://tools.ietf.org/html/rfc1951.html) and implemented in - [zlib](http://zlib.org/). The header of the compressed packet has the - parameters of the `uncompress()` function in mind: + [zlib](http://zlib.org/) or [Zstandard](https://facebook.github.io/zstd/). + + When using zlib, the header of the compressed packet has the parameters of the `uncompress()` function in mind: ~~~~~~~~~~~~~ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,