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

txn: fix some logs and assumptions are inaccurate when the async commit protocol is used #24140

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

zhaoxugang
Copy link
Contributor

@zhaoxugang zhaoxugang commented Apr 19, 2021

What problem does this PR solve?

Issue Number: close #23542

Problem Summary:

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

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

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

  • fix some logs and assumptions are inaccurate when the async commit protocol is used

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 19, 2021
@ti-srebot
Copy link
Contributor

@ichn-hu ichn-hu mentioned this pull request Apr 19, 2021
@zhaoxugang
Copy link
Contributor Author

PTAL @cfzjywxk

c.mu.Lock()
defer c.mu.Unlock()
// Group that contains primary key is always the first.
// We mark transaction's status committed when we receive the first success response.
c.mu.committed = true
Copy link
Contributor

Choose a reason for hiding this comment

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

We may need to mark this field correctly when async commit protocol is used, as the cilent will receive OK packet when all prewrite requests are successfully processed. Then we may need to adjust the error log messages in L129, the debug log in L137 seems ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We may need to mark this field correctly when async commit protocol is used, as the cilent will receive OK packet when all prewrite requests are successfully processed. Then we may need to adjust the error log messages in L129, the debug log in L137 seems ok.

I think the twoPhaseCommitter.mu.commited is true means the primary of batchs was commited,so L129 is ok,but in async commit ,the batch mabe not primary,so L137 mabe not accurate

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'd better maintain committed for async commit transactions (setting it in 2pc.go after prewriting finishes).
If we maintain `committed for async commit transactions, then "2PC failed commit key after primary key committed" would be inaccurate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@cfzjywxk cfzjywxk added contribution This PR is from a community contributor. sig/transaction SIG:Transaction labels Apr 21, 2021
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 24, 2021
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 15, 2021
# Conflicts:
#	store/tikv/commit.go
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 29, 2021
@ti-chi-bot
Copy link
Member

@zhaoxugang: PR needs rebase.

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.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/transaction SIG:Transaction size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

txn: some logs and assumptions are inaccurate when the async commit protocol is used
5 participants