-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
store/tikv: support fallback from async commit (take 2) #21531
Conversation
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
/run-all-tests tikv=pr/9196 |
@nrc @youjiali1995 @MyonKeminta Could you take a look at this PR and all its dependencies? |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@@ -162,6 +168,7 @@ func (action actionPrewrite) handleSingleBatch(c *twoPhaseCommitter, bo *Backoff | |||
zap.Uint64("startTS", c.startTS)) | |||
tikvOnePCTxnCounterFallback.Inc() | |||
c.setOnePC(false) | |||
c.setAsyncCommit(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it's here, instead of in the if
clause at L190?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using 1pc, useAsyncCommit
may be true. This field should be set false when fallback from 1pc.
Otherwise, we will get into the wrong branch in https://github.com/pingcap/tidb/blob/0eb8ff97bc/store/tikv/2pc.go#L1162 and https://github.com/pingcap/tidb/blob/0eb8ff97bc/store/tikv/2pc.go#L1235
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry. I just notice that L196 has already unset async commit for non-1pc case. But for 1pc case I recommend that also check min_commit_ts
field to be more strict. There's current no case that 1pc may fallback to async commit though.
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
@@ -162,6 +168,7 @@ func (action actionPrewrite) handleSingleBatch(c *twoPhaseCommitter, bo *Backoff | |||
zap.Uint64("startTS", c.startTS)) | |||
tikvOnePCTxnCounterFallback.Inc() | |||
c.setOnePC(false) | |||
c.setAsyncCommit(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry. I just notice that L196 has already unset async commit for non-1pc case. But for 1pc case I recommend that also check min_commit_ts
field to be more strict. There's current no case that 1pc may fallback to async commit though.
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
@sticnarf merge failed. |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
/run-all-tests |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
What problem does this PR solve?
Issue Number: tikv/sig-transaction#64
What is changed and how it works?
Proposal: tikv/sig-transaction#64 (comment)
If async-commit or 1PC prewrite receives
min_commit_ts = 0
, it will automatically use sync 2PC to commit.When resolving locks, it firstly judges the transaction by the information inside of the primary lock. If
use_async_commit
is true for the primary lock, it will doCheckSecondaryLocks
. IfCheckSecondaryLocks
sees a lock whoseuse_async_commit
is false, we retryCheckTxnStatus
withforceSyncCommit
set to true. Then, we are treating this transaction as a sync 2PC transaction.Related changes
Check List
Tests
Release note