Why does TC try to rollback branch trsaction infinitely after a dirty write?
Sometimes we want to keep the modification that was caused by the dirty write because of business logic. Is it really appropriate to assume that the rollback is retryable?
The only way to stop TC trying rolling back is to modify the data back to the afterImage manually. And this will cause a lost update since we may want to keep the current modification.
Maybe no retrying this type of rollback is better. Let users decide the modification.
Maybe there is a way to prevent dirty writes completely.
数据库本地事物加行锁 字段锁 可以防止脏数据
数据库本地事物加行锁 字段锁 可以防止脏数据
@Garlichead 感谢回复。本地事务提交后且全局事务提交前,可能别的应用进程修改了本地事务提交的更新。那即使本地事务加上了行锁,也无法避免更新的记录被别的事务修改,因为本地事务已经提交了,锁会被释放。
@Garlichead 感谢回复。本地事务提交后且全局事务提交前,可能别的应用进程修改了本地事务提交的更新。那即使本地事务加上了行锁,也无法避免更新的记录被别的事务修改,因为本地事务已经提交了,锁会被释放。
在全局事物提交前 另外一个事物的线程需要先获取全局锁 才能进行本地事物的提交更新
@Garlichead 感谢回复。本地事务提交后且全局事务提交前,可能别的应用进程修改了本地事务提交的更新。那即使本地事务加上了行锁,也无法避免更新的记录被别的事务修改,因为本地事务已经提交了,锁会被释放。
在全局事物提交前 另外一个事物的线程需要先获取全局锁 才能进行本地事物的提交更新
那其实您说的方案,是不是就是弃用 Spring @Transactional,用 @GlobalTransactional?
那其实您说的方案,是不是就是弃用 Spring @transactional,用 @GlobalTransactional? 嗯 使用 @GlobalTransactional spring @transactional 也可以用 不冲突
那其实您说的方案,是不是就是弃用 Spring @transactional,用 @GlobalTransactional? 嗯 使用 @GlobalTransactional spring @transactional 也可以用 不冲突
现在看来(1.2.0 版本),我觉得,使用 AT 模式,只能通过全部走全局事务(即便全局事务里面只有一个本地事务),才能真的避免全局事务的脏写。