tidb icon indicating copy to clipboard operation
tidb copied to clipboard

execution: commit the transaction before responding explain analyze results to the client (#38044)

Open ti-srebot opened this issue 1 year ago • 2 comments

cherry-pick #38044 to release-5.4 You can switch your code base to this Pull Request by using git-extras:

# In tidb repo:
git pr https://github.com/pingcap/tidb/pull/38060

After apply modifications, you can push your change to this PR via:

git push [email protected]:ti-srebot/tidb.git pr/38060:release-5.4-b0e073478ffe

What problem does this PR solve?

Issue Number: close #37373

Problem Summary: The explain analyze statement execution with DML executors may respond to the client before the transaction commit finishing.

What is changed and how it works?

Trigger the commit operation if the statement is an explain analyze statement with DML executors before returning the record set of itself.

Check List

Tests

  • [x] Unit test
  • [ ] Integration test
  • [x] Manual test (add detailed scripts or steps below)
    • Sleep before the commit
    • Execute explain analyze
    • Check if it responses before the commit has finished
  • [ ] No code

Side effects

Documentation

Release note

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

Fix the issue explain analyze with DML executors may respond to the client before the transaction commit has finished.

ti-srebot avatar Sep 21 '22 13:09 ti-srebot

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • ekexium
  • zyguan

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment. After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review. Reviewer can cancel approval by submitting a request changes review.

ti-chi-bot avatar Sep 21 '22 13:09 ti-chi-bot

/run-all-tests

ti-srebot avatar Sep 21 '22 13:09 ti-srebot

There are still some conflicts.

MyonKeminta avatar Sep 23 '22 03:09 MyonKeminta

@MyonKeminta Conflicts are resolved, PTAL

cfzjywxk avatar Sep 23 '22 03:09 cfzjywxk

/merge

cfzjywxk avatar Sep 23 '22 03:09 cfzjywxk

This pull request has been accepted and is ready to merge.

Commit hash: e8464e21f73087a396bcfe5081008d70a16b0832

ti-chi-bot avatar Sep 23 '22 03:09 ti-chi-bot

@MyonKeminta Conflicts are resolved, PTAL

We have to use the old version of testkit.

zyguan avatar Sep 23 '22 05:09 zyguan

/merge

zyguan avatar Sep 23 '22 09:09 zyguan

This pull request has been accepted and is ready to merge.

Commit hash: 3674411ad0b35474cfa79d2bab47114a56978c42

ti-chi-bot avatar Sep 23 '22 09:09 ti-chi-bot

@cfzjywxk PTAL

[2022-09-23T09:44:19.618Z] planner/core/integration_test.go:19: File is not `goimports`-ed (goimports)

[2022-09-23T09:44:19.618Z] 	"fmt"

hawkingrei avatar Sep 26 '22 01:09 hawkingrei

/merge

cfzjywxk avatar Sep 27 '22 01:09 cfzjywxk

This pull request has been accepted and is ready to merge.

Commit hash: f10a1f54ef5e2f39f1b2b6afa62b171cae169fc7

ti-chi-bot avatar Sep 27 '22 01:09 ti-chi-bot

/merge

cfzjywxk avatar Sep 27 '22 03:09 cfzjywxk

/run-unit-test

cfzjywxk avatar Sep 27 '22 04:09 cfzjywxk