Hi, everyone.
In ShardingSphere, SQL and their execution result will be cached in saga
transaction manager.
When users call `commit` or `rollback` method, the cached SQL will generate
`SagaDefinition`
and submit it to the saga actuator.
Saga actuator do `Transaction` first and get execution result from cached.
When the result is successful, the actuator will directly judge that the
Transaction is successful
and execute the next Transaction.
When the result not found in cached or the result is failed, the actuator will
do retry or compensation
according to configuration.
But there is a problem that saga actuator cannot rollback when business
exception happened.
The situation will happen in following workflow.
-----------multiple times-----------
begin transaction --> | execute SQL --> cached result | --> throw business
exception --> call rollback
--------------------------------------
|
|
|
but all SQL success, saga actuator don't run compensation <-- get result from
cache <-- saga actuator
All SQL is executed successfully, but the business program throws an exception.
So the actuator will judge
transaction is successful, and not to do compensation, which makes users
confused.
On this issue, I would like to ask for advice, should resolved in Saga actuator
or ShardingSphere?
And how to resolve better?
------------------
Yi Yang (Sion)
Apache ShardingSphere contributor