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

server,session: make sure ResultSet.Close() errors return to the client #48447

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Nov 8, 2023

What problem does this PR solve?

Issue Number: close #48446, ref #48411

Problem Summary:

What is changed and how it works?

This also fix #48411 in another way, and can prevent more bugs.

Close the result set after all rs.Next(), and before cc.writeEOF()
Avoid the case that error happen and can't be sent to the client after writeEOF.

Check List

Tests

The test code in #48412 should also apply for this one, as the both can fix #48411, so I don't bother writer another duplicated test.

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

See #48411

  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

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

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-tests-checked needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 8, 2023
Copy link

tiprow bot commented Nov 8, 2023

Hi @tiancaiamao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #48447 (b842bda) into master (d4618d4) will increase coverage by 1.4397%.
Report is 20 commits behind head on master.
The diff coverage is 72.7272%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #48447        +/-   ##
================================================
+ Coverage   71.3849%   72.8246%   +1.4397%     
================================================
  Files          1402       1425        +23     
  Lines        406866     413375      +6509     
================================================
+ Hits         290441     301039     +10598     
+ Misses        96487      93368      -3119     
+ Partials      19938      18968       -970     
Flag Coverage Δ
integration 43.2613% <72.7272%> (?)
unit 71.3946% <72.7272%> (+0.0097%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9874% <ø> (ø)
parser ∅ <ø> (∅)
br 48.8281% <ø> (-4.1945%) ⬇️

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 9, 2023
Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Nov 9, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: crazycs520, YangKeao

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:
  • OWNERS [YangKeao,crazycs520]

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 9, 2023
Copy link

ti-chi-bot bot commented Nov 9, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-09 03:48:32.428684696 +0000 UTC m=+3702510.015794837: ☑️ agreed by crazycs520.
  • 2023-11-09 06:09:20.794942721 +0000 UTC m=+3710958.382052865: ☑️ agreed by YangKeao.

Copy link

ti-chi-bot bot commented Nov 9, 2023

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-tests-checked label, please finished the tests then check the finished items in description.

For example:

Tests

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

📖 For more info, you can check the "Contribute Code" section in the development guide.

@tiancaiamao
Copy link
Contributor Author

Reuse the unit test of the other PR https://github.com/pingcap/tidb/pull/48412/files#diff-d7a5d1557d888bb61179ecad9eb02d6275358a3954f74a8b5ab600e332843075R2461-R2470

Where the check need to be changed:

rows := dbt.MustQuery("select * from t for update;")
for rows.Next() {}
err := rows.Err() 
require.Error(t, err)

Because #48412 return error to the client by the first packet, while this one return error in the last packet.

@ti-chi-bot ti-chi-bot bot merged commit 24c7f8c into pingcap:master Nov 9, 2023
13 of 16 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.4: #48482.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 9, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #48483.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 9, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #48484.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #48485.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #48486.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.3: #48487.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 9, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
tiancaiamao added a commit that referenced this pull request Nov 17, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Nov 17, 2023
@tiancaiamao tiancaiamao deleted the finish-stmt-err branch December 14, 2023 02:40
@tiancaiamao tiancaiamao removed needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. labels Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error happened but not returned to the client select for update statement can't got stmt-count-limit error
4 participants