Atomikos transaction logs com.atomikos.icatch.enable_logging=false

十年热恋 提交于 2019-12-23 08:47:29

问题


I would like to understand if the Distributed Transaction Capabilities will work for my application if I set the com.atomikos.icatch.enable_logging=false

  • Do I understand correctly that the Transaction Recovery is relevant in the cases where there has been a crash, and we want to completely restart the same transaction.
  • Does the recovery work within the same distributed transaction?
  • My application is tolerant to failures in terms that a failure can always just be restarted from the start with a new transaction. Does this mean that in my case it is ok to set com.atomikos.icatch.enable_logging=false
  • Can com.atomikos.icatch.enable_logging=false lead to inconsistent state of the database if not all participants of the distributed transactions have been committed?

Update I was triggered after this problem to learn a little bit more about the internals of the distributed transactions which I have described here : How would you tune Distributed ( XA ) transaction for performance?


回答1:


Well it took me some time to figure it out. The answer is NO if we disable the com.atomikos.icatch.enable_logging we can not guarantee transactional consistency and we can end up with some things committed in one database and not committed in another.

In XA transaction we have two main roles. Transaction coordinator and transaction participant. There are two transactional logs involved. The transactional log of the Coordinator on one hand and the transactional log of the participant.

What happens is that first all participants in an XA transaction register themselves to the coordinator. XA_START then follows a recording phase where all sql statements are dispatched towards the different participants X_END marks the end of this process and moment when from application perspective commit is invoked.

At this point the Transaction Coordinator takes control behind the scenes. PREPARE message is sent to each participant. Each participant responds with READ TO COMMIT or ABORT the message is forced to the logs. If all participants respond with COMMIT. A commit invocation is sent to each participant.

This mean that if there is a crash and the transactional logging is disabled at the coordinator side which is Atomikos their is a fair chance that one participant manages to COMMIT and another participant do not manage to commit.

Basically the com.atomikos.icatch.enable_logging is mandatory if you want to guarantee consistent state.




回答2:


If you want distributed transactions then you probably want to enable logging too. Disabling it is really only meant for testing configurations.



来源:https://stackoverflow.com/questions/41223674/atomikos-transaction-logs-com-atomikos-icatch-enable-logging-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!