Skip to content

Commit

Permalink
bugfix: fix return of Commit and Rollback (#595)
Browse files Browse the repository at this point in the history
bugfix: commit or rollback success,but ctx error happens
  • Loading branch information
luweiqianyi authored Feb 3, 2024
1 parent fd9afa8 commit 3534336
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/tm/global_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (g *GlobalTransactionManager) Commit(ctx context.Context, gtr *GlobalTransa
bf.Wait()
}

if bf.Err() != nil {
if err != nil || bf.Err() != nil {
lastErr := errors.Wrap(err, bf.Err().Error())
log.Warnf("send global commit request failed, xid %s, error %v", gtr.Xid, lastErr)
return lastErr
Expand Down Expand Up @@ -140,7 +140,7 @@ func (g *GlobalTransactionManager) Rollback(ctx context.Context, gtr *GlobalTran
bf.Wait()
}

if bf.Err() != nil {
if err != nil && bf.Err() != nil {
lastErr := errors.Wrap(err, bf.Err().Error())
log.Errorf("GlobalRollbackRequest rollback failed, xid %s, error %v", gtr.Xid, lastErr)
return lastErr
Expand Down

0 comments on commit 3534336

Please sign in to comment.