func (manager *DistributedTransactionManager) branchCommit(bs *api.BranchSession) (api.BranchSession_BranchStatus, error) {
db := resource.GetDBManager().GetDB(bs.ResourceID)
if db == nil {
return 0, fmt.Errorf("DB resource is not exist, db name: %s", bs.ResourceID)
}
if err := GetUndoLogManager().DeleteUndoLogByXID(db, bs.XID); err != nil {
return api.PhaseTwoCommitting, err
}
if err := manager.storageDriver.DeleteBranchSession(context.Background(), bs.BranchID); err != nil {
log.Error(err)
}
log.Debugf("branch session committed, branch id: %s, lock key: %s", bs.BranchID, bs.LockKey)
return api.Complete, nil
}