Skip to content
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

backend, net: Support compression protocol #373

Merged
merged 16 commits into from
Oct 9, 2023

Conversation

djshow832
Copy link
Collaborator

@djshow832 djshow832 commented Sep 28, 2023

What problem does this PR solve?

Issue Number: close #361

Problem Summary:

What is changed and how it works:

  • Support the compression protocol in compress.go.
  • The 3 protocols can be treated as layered protocols: packet -> compression(optional) -> TLS(optional) -> proxy-protocol(optional) -> raw connection. Each layer doesn't care about what the underlying protocol really is. So I decouple the protocols into:
    • PacketIO still handles MySQL packet reading and writing
    • (optional)compressReadWriter handles compression protocol
    • (optional)tlsReadWriter handles TLS
    • (optional)proxyReadWriter handles proxy-protocol
    • basicReadWriter wraps the raw connection and handles basic connection features like recording the traffic, checking if the peer is alive

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Tested with:

  • MySQL client 8.0.33 -> TiProxy -> MySQL server 8.0.33
  • MySQL connector/J 8.01 -> TiProxy -> MySQL server 8.0.33

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change
  • Has tiproxyctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot requested review from bb7133 and xhebox September 28, 2023 01:40
@ti-chi-bot ti-chi-bot bot added the size/XXL label Sep 28, 2023
Copy link
Collaborator

@xhebox xhebox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

pkg/proxy/net/compress.go Outdated Show resolved Hide resolved
pkg/proxy/net/proxy.go Outdated Show resolved Hide resolved
pkg/proxy/net/tls.go Outdated Show resolved Hide resolved
pkg/proxy/net/compress_test.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the lgtm label Oct 9, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 9, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xhebox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 9, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-09 07:06:23.654482812 +0000 UTC m=+1035981.241592941: ☑️ agreed by xhebox.

@ti-chi-bot ti-chi-bot bot added the approved label Oct 9, 2023
@ti-chi-bot ti-chi-bot bot merged commit 419e26d into pingcap:main Oct 9, 2023
6 checks passed
@djshow832 djshow832 deleted the compress branch October 9, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support compressed MySQL protocol
2 participants