Skip to content

Commit

Permalink
tikv: commit all keys asynchronously in async commit (#19936)
Browse files Browse the repository at this point in the history
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
  • Loading branch information
youjiali1995 authored Sep 10, 2020
1 parent 52d3dae commit 4d0d946
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions store/tikv/2pc.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,9 @@ func (c *twoPhaseCommitter) doActionOnGroupMutations(bo *Backoffer, action twoPh
}
})

if firstIsPrimary && (actionIsCommit || actionIsCleanup || actionIsPessimiticLock) {
// primary should be committed/cleanup/pessimistically locked first
if firstIsPrimary &&
((actionIsCommit && !c.isAsyncCommit()) || actionIsCleanup || actionIsPessimiticLock) {
// primary should be committed(not async commit)/cleanup/pessimistically locked first
err = c.doActionOnBatches(bo, action, batchBuilder.primaryBatch())
if err != nil {
return errors.Trace(err)
Expand All @@ -494,7 +495,8 @@ func (c *twoPhaseCommitter) doActionOnGroupMutations(bo *Backoffer, action twoPh
}
batchBuilder.forgetPrimary()
}
if actionIsCommit && !actionCommit.retry {
// Already spawned a goroutine for async commit transaction.
if actionIsCommit && !actionCommit.retry && !c.isAsyncCommit() {
secondaryBo := NewBackofferWithVars(context.Background(), int(atomic.LoadUint64(&CommitMaxBackoff)), c.txn.vars)
go func() {
e := c.doActionOnBatches(secondaryBo, action, batchBuilder.allBatches())
Expand Down

0 comments on commit 4d0d946

Please sign in to comment.