-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
server: support compressed MySQL protocol #36780
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Tested with:
All the above with 8.x versions |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/04b0a5f9bf70136a12e06daf2f35c8b61889b5fe |
fadd451
to
c668b62
Compare
Tested with:
|
/run-common-test |
d3e862a
to
04b0a5f
Compare
04b0a5f
to
6189bb0
Compare
/cc @lance6716 |
With my latest update it now compresses multiple mysql packets into a single compressed packet once This works somewhat:
Next up is to figure out where we violate the protocol and fix that. |
c677614
to
176d542
Compare
1825842
to
b61b8fb
Compare
b61b8fb
to
6b44c45
Compare
This needs some tests, but otherwise it works. Tested with:
This is with The go-sql-driver/mysql doesn't support compression yet: go-sql-driver/mysql#24 Wireshark (master branch/4.1) supports decompressing both zlib and zstd and can be used to check the client and server flags etc. |
} else if n != (4 + mysql.MaxPayloadLen) { | ||
return errors.Trace(mysql.ErrBadConn) | ||
if p.compressionAlgorithm != mysql.CompressionNone { | ||
if n, err := p.compressedWriter.Write(data[:4+maxPayloadLen]); err != nil { |
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.
seems we only use Write
and Flush
for both compressedWriter
and bufWriter
, maybe we can abstract an interface so there's no if-branch
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.
@dveeden I have no strong opinion about it. You can merge this PR or address it in following commit.
/test unit-test |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: fb55f65
|
What problem does this PR solve?
Issue Number: close #22605
Problem Summary: Support deflate compression in the mysql protocol
This helps with:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note