servicecomb-pack icon indicating copy to clipboard operation
servicecomb-pack copied to clipboard

能否在一个方法上同时使用@SagaStart @Compensable以实现嵌套事务?

Open tinycedar opened this issue 6 years ago • 5 comments

tinycedar avatar Feb 27 '19 11:02 tinycedar

You can use the SagaStart with the Compensable together on the same method. But we don't support define a new StagaStart inside of a SagaStart.

WillemJiang avatar Feb 28 '19 01:02 WillemJiang

We have the https://issues.apache.org/jira/browse/SCB-836 to work on the nested saga support.

zhfeng avatar Feb 28 '19 03:02 zhfeng

We have the https://issues.apache.org/jira/browse/SCB-836 to work on the nested saga support.

Have any plan on this feature? or any implementation doc ?

tinycedar avatar Feb 28 '19 03:02 tinycedar

yeah, I had done some works on this feature but did not prepare for a PR.

The implementation I have is actually:

  1. When calling initializeOmegaContext(), it could check the current omega context to see if there is already an globalTxId and to set the parentTxId with it.
  2. Add the X-Pack-Parent-Transaction-Id to propagate the parentTxId during the services.
  3. The alpha server will update to find the transactions with the parentTxId when rolling back the global transaction.
  4. Add and update the tests to work with the nested saga transactions. 4.1 Test the global transaction and sub nested transactions are success. 4.2 Test the one nested saga transaction is success and the other one is rolled back but the global transaction is success. 4.3 Test the one nested saga transaction is success and the other one is rolled back but the global transaction is rolled back. It should roll back the success nested one.

Anyway, I just finished work on the 1) and 2). I will be happy to see if you have any idea about this implementation and work together with me to support the nested saga in servicecomb-pack.

Thanks

zhfeng avatar Mar 01 '19 14:03 zhfeng

@tinycedar just to mention that I create https://github.com/apache/servicecomb-pack/pull/432 which contains my changes about this issue.

zhfeng avatar Mar 16 '19 15:03 zhfeng