GitHub user vincent50411 created a discussion: 同一条记录多次修改分支回滚时执行顺序异常导致update 
time不一致出现脏写回滚失败

**环境说明:**生产环境中业务服务和seata server都是单节点部署,业务表中存在update time时间戳(6),使用postgresql 
15数据库。
**业务场景:**业务服务A更新A表一条记录得字段A_1后,调用业务服务B更新B表数据,业务服务B又调用A服务更新A表同一条记录的字段A_2,当业务执行异常后,执行全局回滚,业务服务A中提示全局回滚失败,日志记录显示:
2025-12-10 11:13:57.725 INFO  1 TID:N/A --- [rpcDispatch_RMROLE_1_2_16] 
o.a.s.c.r.p.c.RmBranchRollbackProcessor : rm handle branch rollback 
process:BranchRollbackRequest{xid='10.232.68.199:8091:5567173722488930773', 
branchId=5567173722488930775, branchType=AT, 
resourceId='jdbc:postgresql://xxxx:54321/haic', applicationData='null'}
2025-12-10 11:13:57.725 INFO  1 TID:N/A --- [rpcDispatch_RMROLE_1_2_16] 
o.a.seata.rm.AbstractRMHandler : Branch Rollbacking: 
10.232.68.199:8091:5567173722488930773 5567173722488930775 
jdbc:postgresql://xxxxx:54321/haic

**2025-12-10 11:13:57.729 INFO  1 TID:N/A --- [rpcDispatch_RMROLE_1_2_16] 
o.a.s.r.d.u.AbstractUndoExecutor : Field not equals, name update_datetime, old 
value 2025-12-10 11:13:57.671, new value 2025-12-10 11:13:57.7**

2025-12-10 11:13:57.730 ERROR 1 TID:N/A --- [rpcDispatch_RMROLE_1_2_16] 
o.a.s.r.d.DataSourceManager : branchRollback failed. branchType:[AT], 
xid:[10.232.68.199:8091:5567173722488930773], branchId:[5567173722488930775], 
resourceId:[jdbc:postgresql://xxxxx:54321/haic], applicationData:[null]. 
reason:[Branch session rollback failed because of dirty undo log, please delete 
the relevant undolog after manually calibrating the data. xid = 
10.232.68.199:8091:5567173722488930773 branchId = 5567173722488930775]
2025-12-10 11:13:57.730 INFO  1 TID:N/A --- [rpcDispatch_RMROLE_1_2_16] 
o.a.seata.rm.AbstractRMHandler : Branch Rollbacked result: 
PhaseTwo_RollbackFailed_Unretryable

**问题说明**:业务服务A更新同一条记录2次,对应注册2个branch id,业务库中undo log表中存在2条log,branch 
id不同。日志显示update_datetime, old value 2025-12-10 11:13:57.671, new value 
2025-12-10 11:13:57.7不一致,与undo log表对比,可以确认是rm回滚时,先回滚了最早修改的第一条记录,导致update 
time与当前记录不一致; 但是seata server未启用并行发送消息,branchsession 
也做了逆序循环,理论上rm端应该是先收到最后一条branch才对,但是现象是发生了乱序。请问还有什么问题可能导致tc发送给rm的2条branch乱序?
**seata server端的配置:**
store.db.datasource=druid
store.db.dbType=postgresql
store.db.url=jdbc:postgresql://xxxxx:54321/seata
store.db.user=xxxx
store.db.password=xxxxx
store.db.driverClassName=org.postgresql.Driver
store.db.lockTable=lock_table
store.db.globalTable=global_table
store.db.queryLimit=100
store.db.maxConn=400
client.rm.lock.retryInterval=100
store.db.maxWait=5000
store.db.minConn=10
store.mode=db
store.db.branchTable=branch_table
service.vgroupMapping.my_tx_group=default

**seata 客户端配置:**
seata:
  enabled: true
  enable-auto-data-source-proxy: true
  tx-service-group: my_tx_group
  registry:
    type: nacos
    nacos:
      application: seata-server
      server-addr: ${common.nacos.server-addr}
      namespace: ${common.nacos.discovery-namespace}
      group: ${common.nacos.discovery-group}
      cluster: default
      username: ${common.nacos.discovery-username}
      password: ${common.nacos.discovery-password}
  config:
    type: nacos
    nacos:
      server-addr: ${common.nacos.server-addr}
      namespace: ${common.nacos.config-namespace}
      group: ${common.nacos.discovery-group}
      cluster: default
      username: ${common.nacos.discovery-username}
      password: ${common.nacos.discovery-password}
      dataId: haic-seata.properties


GitHub link: https://github.com/apache/incubator-seata/discussions/7866

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to