seata1.7.1版本全局事务内修改同一条数据导致回滚失败

mbskvtky  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(47)
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

在全局事务内先 insert 里一条数据,然后批量 update 这个表里的部分数据(前面 insert 的数据也包含在里面),我查看日志发现到这里的时候分支事务都是注册成功的,后面发生异常回滚的时候失败了。

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@80c571] was not registered for synchronization because synchronization is not active
JDBC Connection [io.seata.rm.datasource.ConnectionProxy@3098dae] will not be managed by Spring
==> Preparing: insert into zuzhizhongxin_jiaozhigong_bumen(jzgbmbm, jzgbm, jsxm, bmbm, bmmc, jglxbh, jglx, jgbm, jgmc, xqbm, xqmc, cjsj, cjr, cjip, bzw, shzt, jsztbh, jszt, jszwbm, jszw, gh) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
==> Parameters: a9c77a9c81a74d0a880f700b722cbb21(String), bef36ea03b09454894e782d5d247231e(String), 导入老师12245(String), aa49c3e795cf42eaaae1c88c1cb794db(String), 教师室(String), 99664955531330010(String), 区属学校(String), b9ce321ad966487e8b53e35ade527f35(String), 上海市杨浦区向阳幼儿园(String), b9ce321ad966487e8b53e35ade527f35(String), 上海市杨浦区向阳幼儿园(String), 2024-01-22T18:09:04.657(LocalDateTime), liucc5415(String), 192.168.64.191(String), I(String), 通过(String), jszt_11(String), 在职(String), null, null, (String)
2024-01-22 18:09:04.665 INFO 1 --- [TaskExecutor-48] io.seata.rm.AbstractResourceManager : branch register success, xid:172.17.0.3:8091:27481549239641924, branchId:27481549239641925, lockKeys:zuzhizhongxin_jiaozhigong_bumen:1216
<== Updates: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@80c571]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1eba080b] was not registered for synchronization because synchronization is not active
JDBC Connection [io.seata.rm.datasource.ConnectionProxy@1817ede0] will not be managed by Spring
==> Preparing: update zuzhizhongxin_jiaozhigong_bumen SET gxsj = ?, gxr = ?, gxip = ?, bzw = ?, jsztbh = ?, jszt = ?, gh = ? where bzw != 'D' and jzgbm = ? and jgbm = ?
==> Parameters: 2024-01-22T18:09:04.667(LocalDateTime), liucc5415(String), 192.168.64.191(String), M(String), jszt_11(String), 在职(String), (String), bef36ea03b09454894e782d5d247231e(String), b9ce321ad966487e8b53e35ade527f35(String)
2024-01-22 18:09:04.672 INFO 1 --- [TaskExecutor-48] io.seata.rm.AbstractResourceManager : branch register success, xid:172.17.0.3:8091:27481549239641924, branchId:27481549239641926, lockKeys:zuzhizhongxin_jiaozhigong_bumen:1216
<== Updates: 1

2024-01-22 18:09:04.725 INFO 1 --- [TaskExecutor-48] i.seata.tm.api.DefaultGlobalTransaction : transaction 172.17.0.3:8091:27481549239641924 will be rollback
2024-01-22 18:09:04.728 INFO 1 --- [ch_RMROLE_1_2_8] i.s.c.r.p.c.RmBranchRollbackProcessor : rm handle branch rollback process:BranchRollbackRequest{xid='172.17.0.3:8091:27481549239641924', branchId=27481549239641925, branchType=AT, resourceId='jdbc:postgresql://172.16.90.170:5434/yangpu?currentSchema=zuzhizhongxin', applicationData='null'}
2024-01-22 18:09:04.728 INFO 1 --- [ch_RMROLE_1_2_8] io.seata.rm.AbstractRMHandler : Branch Rollbacking: 172.17.0.3:8091:27481549239641924 27481549239641925 jdbc:postgresql://172.16.90.170:5434/yangpu?currentSchema=zuzhizhongxin
2024-01-22 18:09:04.733 INFO 1 --- [ch_RMROLE_1_2_8] i.s.r.d.undo.AbstractUndoExecutor : Field not equals, name bzw, old value I, new value M
2024-01-22 18:09:04.734 ERROR 1 --- [ch_RMROLE_1_2_8] i.seata.rm.datasource.DataSourceManager : branchRollback failed. branchType:[AT], xid:[172.17.0.3:8091:27481549239641924], branchId:[27481549239641925], resourceId:[jdbc:postgresql://172.16.90.170:5434/yangpu?currentSchema=zuzhizhongxin], applicationData:[null]. reason:[Branch session rollback failed because of dirty undo log, please delete the relevant undolog after manually calibrating the data. xid = 172.17.0.3:8091:27481549239641924 branchId = 27481549239641925]
2024-01-22 18:09:04.734 INFO 1 --- [ch_RMROLE_1_2_8] io.seata.rm.AbstractRMHandler : Branch Rollbacked result: PhaseTwo_RollbackFailed_Unretryable
2024-01-22 18:09:04.741 INFO 1 --- [ch_RMROLE_1_7_8] i.s.c.r.p.c.RmBranchCommitProcessor : rm client handle branch commit process:BranchCommitRequest{xid='172.17.0.3:8091:27481549239641911', branchId=27481549239641920, branchType=AT, resourceId='jdbc:postgresql://172.16.90.170:5434/yangpu?currentSchema=zuzhizhongxin', applicationData='null'}
2024-01-22 18:09:04.741 INFO 1 --- [ch_RMROLE_1_7_8] io.seata.rm.AbstractRMHandler : Branch committing: 172.17.0.3:8091:27481549239641911 27481549239641920 jdbc:postgresql://172.16.90.170:5434/yangpu?currentSchema=zuzhizhongxin null
2024-01-22 18:09:04.741 INFO 1 --- [ch_RMROLE_1_7_8] io.seata.rm.AbstractRMHandler : Branch commit result: PhaseTwo_Committed
2024-01-22 18:09:04.744 INFO 1 --- [TaskExecutor-48] i.seata.tm.api.DefaultGlobalTransaction : transaction end, xid = 172.17.0.3:8091:27481549239641924
2024-01-22 18:09:04.744 INFO 1 --- [TaskExecutor-48] i.seata.tm.api.DefaultGlobalTransaction : [172.17.0.3:8091:27481549239641924] rollback status: RollbackFailed

Ⅲ. Describe what you expected to happen

bzw这个字段在 insert 的时候我设置的是 I ,后面 update 的时候设置成了 M ,看日志好像是这里出了问题,求教一下大家,这里为什么没能回滚成功?

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Minimal yet complete reproducer code (or URL to code):

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK 1.8
  • Seata 1.7.1
  • Database 业务数据库PostgreSQL 9.2.4 Seata数据库MySQL8.0
bxfogqkk

bxfogqkk1#

Data is modified without Seata transaction management, resulting in dirty data.

o3imoua4

o3imoua42#

seata server版本是什么?客户端的日志是否能发到这看下?
What is the seata server version? Can the client logs be posted here to see?

yzckvree

yzckvree3#

Check the precision of datetime in your database branchtable

相关问题