You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/08/06 03:51:36 UTC

[incubator-servicecomb-saga] branch master updated: SCB-665 Added the design document for the TCC

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git


The following commit(s) were added to refs/heads/master by this push:
     new 7c93cb3  SCB-665 Added the design document for the TCC
7c93cb3 is described below

commit 7c93cb3d8f67dd3808d75361c65a3b723fee9580
Author: Willem Jiang <ji...@huawei.com>
AuthorDate: Mon Aug 6 11:51:20 2018 +0800

    SCB-665 Added the design document for the TCC
---
 docs/design.md                                |  14 +++++++++++++-
 docs/design_zh.md                             |  19 ++++++++++++++++---
 docs/static_files/exception_scenario_TCC.png  | Bin 0 -> 151451 bytes
 docs/static_files/successful_scenario_TCC.png | Bin 0 -> 163718 bytes
 4 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/docs/design.md b/docs/design.md
index 7329b02..fb07b7f 100644
--- a/docs/design.md
+++ b/docs/design.md
@@ -15,7 +15,8 @@ The process of Inter-Service Communication is similar to [Zipkin](https://github
 
 ![Inter-Service Communication](static_files/inter-service_communication.png)
 
-## Workflow
+## Workflow Saga
+Saga处理场景是要求相关的子事务提供事务处理函数同时也提供补偿函数。Saga协调器alpha会根据事务的执行情况向omega发送相关的指令,确定是否向前重试或者向后恢复。
 ### Successful Scenario
 In a successful scenario, all started events will have a corresponding ended event.
 
@@ -30,3 +31,14 @@ In an exception scenario, omega inside the abnormal service will report an abort
 In timeout scenario, timeouted events will be detected by alpha's period scanner, the corresponding global transaction will be abort at the same time.
 
 ![Timeout Scenario](static_files/timeout_scenario.png)
+
+## Workflow TCC
+Comparing Saga, TCC(try-confirm-cancel) just have one more method(try) to check if we have enough resource to finish the transaction.
+ The transaction starter knows all the distributed sub transactions status, so it can work with alpha to confirm or cancel the transactions。
+### Successful Scenario
+In a successful scenario, all try events are confirmed.
+
+![Successful Scenario](static_files/successful_scenario_TCC.png)
+
+### Exception Scenario
+In an exception scenario, the starter will send the cancel event to alpha, and alpha could invoke the cancel methods which are registered to the Alpha server to clean up the pre allocated resources.
diff --git a/docs/design_zh.md b/docs/design_zh.md
index 072565a..7659755 100644
--- a/docs/design_zh.md
+++ b/docs/design_zh.md
@@ -17,9 +17,10 @@ omega是微服务中内嵌的一个agent。当服务收到请求时,omega会
 
 ![Inter-Service Communication](static_files/inter-service_communication.png)
 
-## 具体处理流程
+## Saga 具体处理流程
+Saga处理场景是要求相关的子事务提供事务处理函数同时也提供补偿函数。Saga协调器alpha会根据事务的执行情况向omega发送相关的指令,确定是否向前重试或者向后恢复。
 ### 成功场景
-成功场景下,每个开始的事件都会有对应的结束事件。
+成功场景下,每个事务都会有开始和有对应的结束事件。
 
 ![Successful Scenario](static_files/successful_scenario.png)
 
@@ -28,7 +29,19 @@ omega是微服务中内嵌的一个agent。当服务收到请求时,omega会
 
 ![Exception Scenario](static_files/exception_scenario.png)
 
-### 超时场景
+### 超时场景 (需要调整)
 超时场景下,已超时的事件会被alpha的定期扫描器检测出来,与此同时,该超时事务对应的全局事务也会被中断。
 
 ![Timeout Scenario](static_files/timeout_scenario.png)
+
+## TCC 具体处理流程
+TCC(try-confirm-cancel)与Saga事务处理方式相比多了一个Try方法。事务调用的发起方来根据事务的执行情况协调各方相关各方进行提交事务或者回滚事务。
+### 成功场景
+成功场景下, 每个事务都会有开始和对应的结束事件
+
+![Successful Scenario](static_files/successful_scenario_TCC.png)
+
+### 异常场景
+异常场景下,事务发起方会向alpha上报异常事件,然后alpha会向该全局事务的其它已完成的子事务发送补偿指令,确保最终所有的子事务要么都成功,要么都回滚。
+
+![Exception Scenario](static_files/exception_scenario_TCC.png)
diff --git a/docs/static_files/exception_scenario_TCC.png b/docs/static_files/exception_scenario_TCC.png
new file mode 100644
index 0000000..4753558
Binary files /dev/null and b/docs/static_files/exception_scenario_TCC.png differ
diff --git a/docs/static_files/successful_scenario_TCC.png b/docs/static_files/successful_scenario_TCC.png
new file mode 100644
index 0000000..dc44f35
Binary files /dev/null and b/docs/static_files/successful_scenario_TCC.png differ