Skip to content

Commit

Permalink
bugfix: when mixed use of AT and TCC, AT branchs is not deleted (#3296)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Nov 24, 2020
1 parent 15f0d6e commit 23a407e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
10 changes: 5 additions & 5 deletions script/client/spring/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ seata.tx-service-group=my_test_tx_group
seata.enable-auto-data-source-proxy=true
seata.data-source-proxy-mode=AT
seata.use-jdk-proxy=false
seata.client.rm.async-commit-buffer-limit=1000
seata.client.rm.async-commit-buffer-limit=10000
seata.client.rm.report-retry-count=5
seata.client.rm.table-meta-check-enable=false
seata.client.rm.report-success-enable=false
Expand All @@ -40,7 +40,7 @@ seata.client.undo.data-validation=true
seata.client.undo.log-serialization=jackson
seata.client.undo.only-care-update-columns=true
seata.client.undo.log-table=undo_log
seata.log.exceptionRate=100
seata.log.exception-rate=100
seata.service.vgroup-mapping.my_test_tx_group=default
seata.service.grouplist.default=127.0.0.1:8091
seata.service.enable-degrade=false
Expand Down Expand Up @@ -74,7 +74,7 @@ seata.config.apollo.namespace=application
seata.config.etcd3.server-addr=http://localhost:2379

seata.config.nacos.namespace=
seata.config.nacos.serverAddr=127.0.0.1:8848
seata.config.nacos.server-addr=127.0.0.1:8848
seata.config.nacos.group=SEATA_GROUP
seata.config.nacos.username=
seata.config.nacos.password=
Expand All @@ -91,7 +91,7 @@ seata.registry.type=file

seata.registry.consul.server-addr=127.0.0.1:8500

seata.registry.etcd3.serverAddr=http://localhost:2379
seata.registry.etcd3.server-addr=http://localhost:2379

seata.registry.eureka.weight=1
seata.registry.eureka.service-url=http://localhost:8761/eureka
Expand All @@ -112,7 +112,7 @@ seata.registry.sofa.server-addr=127.0.0.1:9603
seata.registry.sofa.region=DEFAULT_ZONE
seata.registry.sofa.datacenter=DefaultDataCenter
seata.registry.sofa.group=SEATA_GROUP
seata.registry.sofa.addressWaitTime=3000
seata.registry.sofa.address-wait-time=3000
seata.registry.sofa.application=default

seata.registry.zk.server-addr=127.0.0.1:2181
Expand Down
16 changes: 8 additions & 8 deletions script/client/spring/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ seata:
excludes-for-auto-proxying: firstClassNameForExclude,secondClassNameForExclude
client:
rm:
async-commit-buffer-limit: 1000
async-commit-buffer-limit: 10000
report-retry-count: 5
table-meta-check-enable: false
report-success-enable: false
Expand Down Expand Up @@ -68,8 +68,8 @@ seata:
etcd3:
server-addr: http://localhost:2379
nacos:
namespace:
serverAddr: 127.0.0.1:8848
namespace: ""
server-addr: 127.0.0.1:8848
group: SEATA_GROUP
username: ""
password: ""
Expand All @@ -90,28 +90,28 @@ seata:
consul:
server-addr: 127.0.0.1:8500
etcd3:
serverAddr: http://localhost:2379
server-addr: http://localhost:2379
eureka:
weight: 1
service-url: http://localhost:8761/eureka
nacos:
application: seata-server
server-addr: 127.0.0.1:8848
group : "SEATA_GROUP"
namespace:
namespace: ""
username: ""
password: ""
redis:
server-addr: localhost:6379
db: 0
password:
password: ""
timeout: 0
sofa:
server-addr: 127.0.0.1:9603
region: DEFAULT_ZONE
datacenter: DefaultDataCenter
group: SEATA_GROUP
addressWaitTime: 3000
address-wait-time: 3000
application: default
zk:
server-addr: 127.0.0.1:2181
Expand All @@ -122,4 +122,4 @@ seata:
custom:
name: ""
log:
exceptionRate: 100
exception-rate: 100
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.UndoProperties",
"defaultValue": true
},
{
"name": "seata.client.log.exception-rate",
"type": "java.lang.Integer",
"sourceType": "io.seata.spring.boot.autoconfigure.properties.client.LogProperties",
"deprecation": {
"level": "error",
"replacement": "seata.log.exception-rate",
"reason": "The location of this configuration has been changed to 'seata.log.exception-rate'."
}
},
{
"name": "seata.log.exception-rate",
"type": "java.lang.Integer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ public GlobalStatus commit(String xid) throws TransactionException {

if (shouldCommit) {
boolean success = doGlobalCommit(globalSession, false);
if (success && !globalSession.getBranchSessions().isEmpty()) {
//If successful and all remaining branches can be committed asynchronously, do async commit.
if (success && globalSession.hasBranch() && globalSession.canBeCommittedAsync()) {
globalSession.asyncCommit();
return GlobalStatus.Committed;
} else {
Expand Down Expand Up @@ -235,11 +236,14 @@ public boolean doGlobalCommit(GlobalSession globalSession, boolean retrying) thr
}
}
}
if (globalSession.hasBranch()) {
//If has branch and not all remaining branches can be committed asynchronously,
//do print log and return false
if (globalSession.hasBranch() && !globalSession.canBeCommittedAsync()) {
LOGGER.info("Committing global transaction is NOT done, xid = {}.", globalSession.getXid());
return false;
}
}
//If success and there is no branch, end the global transaction.
if (success && globalSession.getBranchSessions().isEmpty()) {
SessionHelper.endCommitted(globalSession);

Expand Down

0 comments on commit 23a407e

Please sign in to comment.