-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for compression protocol #219
Conversation
14ebe8e
to
8967db5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's quite extensive, so it'll take me a bit longer to review thoroughly. Appreciate your patience!
src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactoryProvider.java
Show resolved
Hide resolved
59f20da
to
0b8f17a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT, just tiny details.
src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionConfiguration.java
Outdated
Show resolved
Hide resolved
src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionConfiguration.java
Outdated
Show resolved
Hide resolved
src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactoryProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/io/asyncer/r2dbc/mysql/MySqlConnectionFactoryProvider.java
Outdated
Show resolved
Hide resolved
btw) |
- Refactor message codecs, move sequence ID handling to MessageDuplexCodec - Add compression codec and support for zstd and zlib - Add configuration options for compression algorithms and zstd compression level - Refactor the configuration way at `IntegrationTestSupport`
0b8f17a
to
7ad491a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Motivation:
See also #216 , MySQL Connect Options --compression-algorithms
Modification:
MessageDuplexCodec
IntegrationTestSupport
I refactored codec handlers, used the original Sequence ID concept instead of "Envelope ID", there are two main reasons for this:
QueryFlow
should not consider how the packet should be encoded, the "envelope ID" is obviously something that the encoding layer needs to considerLOCAL INFILE
. TheQueryFlow
needs to constructingLocalInfileResponse
with an envelope ID, but this is obviously not any logic aboutLOCAL INFILE
MessageDecoder
to need to additionally consider whether to pass the envelope ID toServerMessage
QueryFlow
, allClientMessage
s and allServerMessage
s, which is bad.The reason why this concept was created in the early days was that the relationship of sequence IDs between packets was not complicated at that time, and it was reset to 0 every time in the command phase.
Result:
User can configure the compression algorithm to enable the MySQL compression protocol and the driver will auto select the preferred algorithm to use. The compression protocol is disabled by default.