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

net: fix packet sequence when sequence overflows #378

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

djshow832
Copy link
Collaborator

@djshow832 djshow832 commented Oct 11, 2023

What problem does this PR solve?

Issue Number: close #377

Problem Summary:

  • The uncompressed sequence is incorrectly set before writing: it should be set before writing the uncompressed packet, rather than writing the compressed packet.
  • The compressed sequence is set to 0 when the uncompressed sequence overflows. SetSequence() mistakenly set both the compressed and uncompressed sequences to 0.

What is changed and how it works:

  • Move BeginRW from compressedReadWriter to PacketIO so that the uncompressed sequence can be set before writing the uncompressed packet.
  • Add a ResetSequence() and only set the compressed sequence to 0 when a new command begins.

Check List

Tests

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

Tested with jdbc-test:

  • ConnectionRegressionTest#testBug11237
  • ConnectionTest#testCompression
  • ConnectionTest#testUseCompress

Test with sysbench (--range_size=1000):

sysbench --table_size=10000 --mysql-user=root --threads=1 --time=60 --report-interval=10 --mysql-host=127.0.0.1 --mysql-port=6000 --mysql-db=test --mysql-compression=on oltp_read_only --point_selects=0 --sum_ranges=0 --order_ranges=0 --distinct_ranges=0 --simple_ranges=1 --range_size=1000 run

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 October 11, 2023 12:56
@ti-chi-bot ti-chi-bot bot added the size/L label Oct 11, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 12, 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 ti-chi-bot bot added the lgtm label Oct 12, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 12, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-12 03:03:50.958074527 +0000 UTC m=+1280628.545184672: ☑️ agreed by xhebox.

@ti-chi-bot ti-chi-bot bot added the approved label Oct 12, 2023
@xhebox
Copy link
Collaborator

xhebox commented Oct 12, 2023

/retest

@ti-chi-bot ti-chi-bot bot merged commit a4d2de9 into pingcap:main Oct 12, 2023
6 checks passed
@djshow832 djshow832 deleted the fix_seq branch October 12, 2023 03:35
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.

Run sysbench with --mysql-compression=on --range_size=1000 fails
2 participants