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
commit 099d347d5103058638bee6c0dd16b8f3e95c1360 Author: Eric Lee <dagang...@huawei.com> AuthorDate: Thu Feb 8 15:45:34 2018 +0800 SCB-330 add design document Signed-off-by: Eric Lee <dagang...@huawei.com> --- docs/design.md | 31 ++++++++++++++++++++++ docs/static_files/exception_scenario.png | Bin 0 -> 49821 bytes docs/static_files/inter-service_communication.png | Bin 0 -> 18719 bytes docs/static_files/omega_internal.png | Bin 0 -> 22521 bytes docs/static_files/successful_scenario.png | Bin 0 -> 47326 bytes docs/static_files/timeout_scenario.png | Bin 0 -> 44045 bytes 6 files changed, 31 insertions(+) diff --git a/docs/design.md b/docs/design.md new file mode 100644 index 0000000..625cb95 --- /dev/null +++ b/docs/design.md @@ -0,0 +1,31 @@ +# Saga Pack Design +## Overview +Pack contains two components: *alpha* and *omega*. Alpha is the pack leader and backed by database to make sure transaction events stored permanently while omega is the pack worker and embeded inside services to intercept incoming/outgoing requests and report events to alpha. + +![Pack Architecture](static_files/pack.png) + +## Omega Internal +Omega plays as an embeded agent inside services. When a request arrives, omega intercepts its header and retrieve the global transaction id as its global transaction id and retrieve the local transaction id as its parent transaction id. In pre-process phase, a transaction started event will be recorded in alpha. In post-process phase, a transaction ended event will be recorded in alpha to mark the end of the sub-transaction. + +![Omega Internal](static_files/omega_internal.png) + +## Inter-Service Communication +The process of Inter-Service Communication is similiar to [Zipkin](https://github.com/openzipkin/zipkin)'s. In the producer side, omega intercepts the transaction ids from request to retrieve the transaction context. In the consumer side, omega inject the transaction ids into request to pass the transaction context. Sub-transactions can chain as a single global transaction by co-operating producers and consumers. + +![Inter-Service Communication](static_files/inter-service_communication.png) + +## Workflow +### Successful Scenario +In a successful scenario, all started events will have a corresponding ended event. + +![Successful Scenario](static_files/successful_scenario.png) + +### Exception Scenario +In an exception scenario, omega inside the abnormal service will report an aborted event to alpha. Apha will then send compensate commands to the completed events within the global transaction to make suer all sub-transactions are either completed or rollbacked. + +![Exception Scenario](static_files/exception_scenario.png) + +### Timeout Scenario +In timeout scenario, timeouted events will be detected by alpha's periodly scanner and abort the corresponding global transaction. + +![Timeout Scenario](static_files/timeout_scenario.png) diff --git a/docs/static_files/exception_scenario.png b/docs/static_files/exception_scenario.png new file mode 100644 index 0000000..a8738ba Binary files /dev/null and b/docs/static_files/exception_scenario.png differ diff --git a/docs/static_files/inter-service_communication.png b/docs/static_files/inter-service_communication.png new file mode 100644 index 0000000..11d8dff Binary files /dev/null and b/docs/static_files/inter-service_communication.png differ diff --git a/docs/static_files/omega_internal.png b/docs/static_files/omega_internal.png new file mode 100644 index 0000000..1f130a2 Binary files /dev/null and b/docs/static_files/omega_internal.png differ diff --git a/docs/static_files/successful_scenario.png b/docs/static_files/successful_scenario.png new file mode 100644 index 0000000..5dd8850 Binary files /dev/null and b/docs/static_files/successful_scenario.png differ diff --git a/docs/static_files/timeout_scenario.png b/docs/static_files/timeout_scenario.png new file mode 100644 index 0000000..998cfcf Binary files /dev/null and b/docs/static_files/timeout_scenario.png differ -- To stop receiving notification emails like this one, please contact ningji...@apache.org.