[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16644964#comment-16644964 ] ASF GitHub Bot commented on SCB-909: WillemJiang closed pull request #318: SCB-909 Add alpha TCC event scanner for timeout and clean up completed globaltx URL: https://github.com/apache/incubator-servicecomb-saga/pull/318 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java index bc4bc593..ad39d62f 100644 --- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java +++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java @@ -36,6 +36,7 @@ import org.apache.servicecomb.saga.alpha.core.TxTimeoutRepository; import org.apache.servicecomb.saga.alpha.server.tcc.GrpcTccEventService; import org.apache.servicecomb.saga.alpha.server.tcc.callback.TccPendingTaskRunner; +import org.apache.servicecomb.saga.alpha.server.tcc.service.TccEventScanner; import org.apache.servicecomb.saga.alpha.server.tcc.service.TccTxEventService; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.domain.EntityScan; @@ -51,6 +52,9 @@ @Value("${alpha.compensation.retry.delay:3000}") private int delay; + @Value("${alpha.tx.timeout-seconds:600}") + private int globalTxTimeoutSeconds; + @Bean Map> omegaCallbacks() { return new ConcurrentHashMap<>(); @@ -105,18 +109,30 @@ TccPendingTaskRunner tccPendingTaskRunner() { } @Bean - GrpcTccEventService grpcTccEventService(TccTxEventService tccTxEventService, TccPendingTaskRunner tccPendingTaskRunner) { -tccPendingTaskRunner.start(); -Runtime.getRuntime().addShutdownHook(new Thread(() -> tccPendingTaskRunner.shutdown())); + GrpcTccEventService grpcTccEventService(TccTxEventService tccTxEventService) { return new GrpcTccEventService(tccTxEventService); } + @Bean + TccEventScanner tccEventScanner(TccTxEventService tccTxEventService) { +return new TccEventScanner(tccTxEventService, delay, globalTxTimeoutSeconds); + } + @Bean ServerStartable serverStartable(GrpcServerConfig serverConfig, TxConsistentService txConsistentService, - Map> omegaCallbacks, GrpcTccEventService grpcTccEventService) { + Map> omegaCallbacks, GrpcTccEventService grpcTccEventService, + TccPendingTaskRunner tccPendingTaskRunner, TccEventScanner tccEventScanner) { ServerStartable bootstrap = new GrpcStartable(serverConfig, new GrpcTxEventEndpointImpl(txConsistentService, omegaCallbacks), grpcTccEventService); new Thread(bootstrap::start).start(); + +tccPendingTaskRunner.start(); +tccEventScanner.start(); +Runtime.getRuntime().addShutdownHook(new Thread(() -> { + tccPendingTaskRunner.shutdown(); + tccEventScanner.shutdown(); +})); + return bootstrap; } diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java index 1a55d198..dfd1e363 100644 --- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java +++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java @@ -18,21 +18,15 @@ package org.apache.servicecomb.saga.alpha.server.tcc.callback; import java.lang.invoke.MethodHandles; -import java.util.List; - +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.servicecomb.saga.alpha.server.tcc.jpa.GlobalTxEvent; import org.apache.servicecomb.saga.alpha.server.tcc.jpa.ParticipatedEvent; -import org.apache.servicecomb.saga.alpha.server.tcc.jpa.TccTxEvent; -import org.apache.servicecomb.saga.alpha.server.tcc.jpa.TccTxType; -import org.apache.servicecomb.saga.alpha.server.tcc.jpa.EventConverter; import org.apache.servicecomb.saga.alpha.server.tcc.service.TccTxEventRepository; import org.apache.servicecomb.saga.common.TransactionStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; - -import com.google.common.collect.Lists; @Component public class TccCallbackEngine implements CallbackEngine { @@ -46,23 +40,18 @@ @Override public boolean execute(GlobalTxEvent request) { -boolean result = true; -
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633272#comment-16633272 ] ASF GitHub Bot commented on SCB-909: coveralls edited a comment on issue #318: SCB-909 Add alpha TCC event scanner for timeout and clean up completed globaltx URL: https://github.com/apache/incubator-servicecomb-saga/pull/318#issuecomment-425653391 [![Coverage Status](https://coveralls.io/builds/19267217/badge)](https://coveralls.io/builds/19267217) Coverage increased (+0.09%) to 91.8% when pulling **585b8e59a28fe29e7860d78e8f31f9fd39fa on cherrylzhao:master** into **6a68423367bcd1acb970bfa25b36f94ca2d58980 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633042#comment-16633042 ] ASF GitHub Bot commented on SCB-909: coveralls commented on issue #318: SCB-909 Add alpha TCC event scanner for timeout and clean up completed globaltx (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/318#issuecomment-425653391 [![Coverage Status](https://coveralls.io/builds/19262677/badge)](https://coveralls.io/builds/19262677) Coverage increased (+0.4%) to 92.124% when pulling **7235686c39fc5eaecb3bb7fb6eaddee6249fb36f on cherrylzhao:master** into **6a68423367bcd1acb970bfa25b36f94ca2d58980 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633039#comment-16633039 ] ASF GitHub Bot commented on SCB-909: cherrylzhao opened a new pull request #318: SCB-909 Add alpha TCC event scanner for timeout and clean up completed globaltx (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/318 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631160#comment-16631160 ] ASF GitHub Bot commented on SCB-909: WillemJiang closed pull request #315: SCB-909 Add fail fast mechanism when all alpha is unreachable. URL: https://github.com/apache/incubator-servicecomb-saga/pull/315 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java index b8c1be2b..bc4bc593 100644 --- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java +++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/AlphaConfig.java @@ -35,6 +35,7 @@ import org.apache.servicecomb.saga.alpha.core.TxEventRepository; import org.apache.servicecomb.saga.alpha.core.TxTimeoutRepository; import org.apache.servicecomb.saga.alpha.server.tcc.GrpcTccEventService; +import org.apache.servicecomb.saga.alpha.server.tcc.callback.TccPendingTaskRunner; import org.apache.servicecomb.saga.alpha.server.tcc.service.TccTxEventService; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.domain.EntityScan; @@ -99,7 +100,14 @@ TxConsistentService txConsistentService( } @Bean - GrpcTccEventService grpcTccEventService(TccTxEventService tccTxEventService) { + TccPendingTaskRunner tccPendingTaskRunner() { +return new TccPendingTaskRunner(delay); + } + + @Bean + GrpcTccEventService grpcTccEventService(TccTxEventService tccTxEventService, TccPendingTaskRunner tccPendingTaskRunner) { +tccPendingTaskRunner.start(); +Runtime.getRuntime().addShutdownHook(new Thread(() -> tccPendingTaskRunner.shutdown())); return new GrpcTccEventService(tccTxEventService); } diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java index 64d624a2..475489dc 100644 --- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java +++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/OmegaCallbackWrapper.java @@ -17,6 +17,7 @@ package org.apache.servicecomb.saga.alpha.server.tcc.callback; +import java.util.concurrent.BlockingQueue; import org.apache.servicecomb.saga.alpha.server.tcc.jpa.ParticipatedEvent; import org.apache.servicecomb.saga.common.TransactionStatus; import org.springframework.stereotype.Component; @@ -24,14 +25,30 @@ @Component public class OmegaCallbackWrapper implements OmegaCallback { + private final BlockingQueue pendingTasks; + + public OmegaCallbackWrapper( + TccPendingTaskRunner tccPendingTaskRunner) { +this.pendingTasks = tccPendingTaskRunner.getPendingTasks(); + } + + @Override public void invoke(ParticipatedEvent event, TransactionStatus status) { -OmegaCallback omegaCallback = OmegaCallbacksRegistry.retrieve(event.getServiceName(), event.getInstanceId()); +OmegaCallback omegaCallback; +try { + omegaCallback = OmegaCallbacksRegistry.retrieve(event.getServiceName(), event.getInstanceId()); +} catch (Exception e) { + pendingTasks.offer(() -> invoke(event, status)); + throw e; +} + try { omegaCallback.invoke(event, status); -} catch (Exception ex) { +} catch (Exception e) { OmegaCallbacksRegistry.remove(event.getServiceName(), event.getInstanceId()); - throw ex; + pendingTasks.offer(() -> invoke(event, status)); + throw e; } } } diff --git a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java index 48cbdbae..1a55d198 100644 --- a/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java +++ b/alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/tcc/callback/TccCallbackEngine.java @@ -47,6 +47,7 @@ @Override public boolean execute(GlobalTxEvent request) { boolean result = true; +// TODO if tcc end event was triggered by many times, we should ensure coordinated event won't be invoke again. List events = tccTxEventRepository.findByGlobalTxIdAndTxType(request.getGlobalTxId(), TccTxType.PARTICIPATED).orElse( Lis
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16628424#comment-16628424 ] ASF GitHub Bot commented on SCB-909: coveralls edited a comment on issue #315: SCB-909 Add fail fast mechanism when all alpha is unreachable. URL: https://github.com/apache/incubator-servicecomb-saga/pull/315#issuecomment-424257835 [![Coverage Status](https://coveralls.io/builds/19196100/badge)](https://coveralls.io/builds/19196100) Coverage increased (+0.03%) to 91.622% when pulling **89842ab1bc01482191cfa3f0a6f69288d553d22f on cherrylzhao:master** into **5350a86c0e3137db50db305d2788de2b3f357960 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16628423#comment-16628423 ] ASF GitHub Bot commented on SCB-909: coveralls edited a comment on issue #315: SCB-909 Add fail fast mechanism when all alpha is unreachable. URL: https://github.com/apache/incubator-servicecomb-saga/pull/315#issuecomment-424257835 [![Coverage Status](https://coveralls.io/builds/19196100/badge)](https://coveralls.io/builds/19196100) Coverage increased (+0.03%) to 91.622% when pulling **89842ab1bc01482191cfa3f0a6f69288d553d22f on cherrylzhao:master** into **5350a86c0e3137db50db305d2788de2b3f357960 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627323#comment-16627323 ] ASF GitHub Bot commented on SCB-909: WillemJiang commented on a change in pull request #315: SCB-909 Add fail fast mechanism when all alpha is unreachable. URL: https://github.com/apache/incubator-servicecomb-saga/pull/315#discussion_r220182626 ## File path: omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/saga/SagaLoadBalancedSenderTest.java ## @@ -157,7 +157,11 @@ public void stopSendingOnInterruption() throws Exception { Thread thread = new Thread(new Runnable() { @Override public void run() { -messageSender.send(event); +try { + messageSender.send(event); +} catch (Exception ex) { + assertThat(ex.getMessage().endsWith("Failed to get reconnected sender"), is(true)); Review comment: The main thread cannot know if exception is thrown. We can keep using send code in the old way. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627322#comment-16627322 ] ASF GitHub Bot commented on SCB-909: WillemJiang commented on a change in pull request #315: SCB-909 Add fail fast mechanism when all alpha is unreachable. URL: https://github.com/apache/incubator-servicecomb-saga/pull/315#discussion_r220182626 ## File path: omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/saga/SagaLoadBalancedSenderTest.java ## @@ -157,7 +157,11 @@ public void stopSendingOnInterruption() throws Exception { Thread thread = new Thread(new Runnable() { @Override public void run() { -messageSender.send(event); +try { + messageSender.send(event); +} catch (Exception ex) { + assertThat(ex.getMessage().endsWith("Failed to get reconnected sender"), is(true)); Review comment: The main thread cannot know if exception is thrown. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16627018#comment-16627018 ] ASF GitHub Bot commented on SCB-909: coveralls commented on issue #315: SCB-909 Add fail fast mechanism when all alpha is unreachable. URL: https://github.com/apache/incubator-servicecomb-saga/pull/315#issuecomment-424257835 [![Coverage Status](https://coveralls.io/builds/19172829/badge)](https://coveralls.io/builds/19172829) Coverage increased (+0.01%) to 91.612% when pulling **71852d57fe34cfab2a61070d46dd8e9d58356396 on cherrylzhao:master** into **5350a86c0e3137db50db305d2788de2b3f357960 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16626980#comment-16626980 ] ASF GitHub Bot commented on SCB-909: cherrylzhao opened a new pull request #315: SCB-909 Add fail fast mechanism when all alpha is unreachable. URL: https://github.com/apache/incubator-servicecomb-saga/pull/315 Add fail fast mechanism when all alpha is unreachable, app can config it using omega.connection.sending.timeout This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623709#comment-16623709 ] ASF GitHub Bot commented on SCB-909: WillemJiang closed pull request #312: SCB-909 Integrate TccLoadBalance into omega-transaction URL: https://github.com/apache/incubator-servicecomb-saga/pull/312 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java b/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java index 99bff3f8..43fb8fcb 100644 --- a/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java +++ b/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java @@ -19,7 +19,6 @@ import java.util.Collections; import java.util.List; -import org.apache.servicecomb.saga.omega.connector.grpc.tcc.TccMessageSender; import org.apache.servicecomb.saga.omega.transaction.MessageDeserializer; import org.apache.servicecomb.saga.omega.transaction.MessageHandler; import org.apache.servicecomb.saga.omega.transaction.MessageSerializer; diff --git a/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/GrpcTccEventService.java b/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/GrpcTccEventService.java deleted file mode 100644 index c619584a.. --- a/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/GrpcTccEventService.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.servicecomb.saga.omega.connector.grpc; - -import org.apache.servicecomb.saga.omega.connector.grpc.tcc.GrpcCoordinateStreamObserver; -import org.apache.servicecomb.saga.omega.context.ServiceConfig; -import org.apache.servicecomb.saga.omega.transaction.AlphaResponse; -import org.apache.servicecomb.saga.omega.transaction.tcc.TccMessageHandler; -import org.apache.servicecomb.saga.omega.transaction.tcc.TccEventService; -import org.apache.servicecomb.saga.omega.transaction.tcc.events.CoordinatedEvent; -import org.apache.servicecomb.saga.omega.transaction.tcc.events.ParticipatedEvent; -import org.apache.servicecomb.saga.omega.transaction.tcc.events.TccEndedEvent; -import org.apache.servicecomb.saga.omega.transaction.tcc.events.TccStartedEvent; - -import org.apache.servicecomb.saga.pack.contract.grpc.GrpcAck; -import org.apache.servicecomb.saga.pack.contract.grpc.GrpcServiceConfig; -import org.apache.servicecomb.saga.pack.contract.grpc.GrpcTccCoordinatedEvent; -import org.apache.servicecomb.saga.pack.contract.grpc.GrpcTccParticipatedEvent; -import org.apache.servicecomb.saga.pack.contract.grpc.GrpcTccTransactionEndedEvent; -import org.apache.servicecomb.saga.pack.contract.grpc.GrpcTccTransactionStartedEvent; -import org.apache.servicecomb.saga.pack.contract.grpc.TccEventServiceGrpc; -import org.apache.servicecomb.saga.pack.contract.grpc.TccEventServiceGrpc.TccEventServiceBlockingStub; -import org.apache.servicecomb.saga.pack.contract.grpc.TccEventServiceGrpc.TccEventServiceStub; - -import io.grpc.ManagedChannel; - -public class GrpcTccEventService implements TccEventService { - private final GrpcServiceConfig serviceConfig; - private final String target; - private final TccEventServiceBlockingStub tccBlockingEventService; - private final TccEventServiceStub tccAsyncEventService; - private final GrpcCoordinateStreamObserver observer; - - public GrpcTccEventService(ServiceConfig serviceConfig, - ManagedChannel channel, - String address, - TccMessageHandler handl
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623442#comment-16623442 ] ASF GitHub Bot commented on SCB-909: coveralls edited a comment on issue #312: SCB-909 Integrate TccLoadBalance into omega-transaction URL: https://github.com/apache/incubator-servicecomb-saga/pull/312#issuecomment-423478956 [![Coverage Status](https://coveralls.io/builds/19121675/badge)](https://coveralls.io/builds/19121675) Coverage increased (+0.4%) to 91.597% when pulling **3245bb262fbc117d658319e34bff339e377b30f8 on cherrylzhao:master** into **24ca70bbfb06b0b9e4cd60dc93837ffb0e784bec on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623352#comment-16623352 ] ASF GitHub Bot commented on SCB-909: coveralls commented on issue #312: SCB-909 Integrate TccLoadBalance into omega-transaction URL: https://github.com/apache/incubator-servicecomb-saga/pull/312#issuecomment-423478956 [![Coverage Status](https://coveralls.io/builds/19120286/badge)](https://coveralls.io/builds/19120286) Coverage increased (+0.3%) to 91.538% when pulling **ec51a40eb21e52cf0e40e530cf8826d87ebe8a22 on cherrylzhao:master** into **24ca70bbfb06b0b9e4cd60dc93837ffb0e784bec on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623119#comment-16623119 ] ASF GitHub Bot commented on SCB-909: cherrylzhao opened a new pull request #312: SCB-909 Integrate TccLoadBalance to omega-transaction URL: https://github.com/apache/incubator-servicecomb-saga/pull/312 Integrate TccLoadBalance to omega-transaction && modify saga message interface. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623117#comment-16623117 ] cherrylzhao commented on SCB-909: - Please wait for a moment > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623113#comment-16623113 ] ASF GitHub Bot commented on SCB-909: WillemJiang closed pull request #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java b/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java index a8641b43..99bff3f8 100644 --- a/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java +++ b/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/AlphaClusterConfig.java @@ -19,9 +19,11 @@ import java.util.Collections; import java.util.List; +import org.apache.servicecomb.saga.omega.connector.grpc.tcc.TccMessageSender; import org.apache.servicecomb.saga.omega.transaction.MessageDeserializer; import org.apache.servicecomb.saga.omega.transaction.MessageHandler; import org.apache.servicecomb.saga.omega.transaction.MessageSerializer; +import org.apache.servicecomb.saga.omega.transaction.tcc.TccMessageHandler; public class AlphaClusterConfig { @@ -43,6 +45,8 @@ private MessageHandler messageHandler; + private TccMessageHandler tccMessageHandler; + /** * @deprecated Use {@link Builder} instead. */ @@ -65,7 +69,8 @@ private AlphaClusterConfig(List addresses, boolean enableSSL, boolean en String cert, String key, String certChain, MessageSerializer messageSerializer, MessageDeserializer messageDeserializer, - MessageHandler messageHandler) { + MessageHandler messageHandler, + TccMessageHandler tccMessageHandler) { this.addresses = addresses; this.enableSSL = enableSSL; this.enableMutualAuth = enableMutualAuth; @@ -75,6 +80,7 @@ private AlphaClusterConfig(List addresses, boolean enableSSL, boolean en this.messageSerializer = messageSerializer; this.messageDeserializer = messageDeserializer; this.messageHandler = messageHandler; +this.tccMessageHandler = tccMessageHandler; } public static Builder builder() { @@ -92,6 +98,7 @@ public static Builder builder() { private MessageSerializer messageSerializer; private MessageDeserializer messageDeserializer; private MessageHandler messageHandler; +private TccMessageHandler tccMessageHandler; public Builder addresses(List addresses) { this.addresses = addresses; @@ -138,6 +145,11 @@ public Builder messageHandler(MessageHandler messageHandler) { return this; } +public Builder tccMessageHandler(TccMessageHandler tccMessageHandler) { + this.tccMessageHandler = tccMessageHandler; + return this; +} + public AlphaClusterConfig build() { return new AlphaClusterConfig(this.addresses, @@ -148,7 +160,8 @@ public AlphaClusterConfig build() { this.certChain, this.messageSerializer, this.messageDeserializer, - messageHandler); + messageHandler, + tccMessageHandler); } } @@ -187,4 +200,8 @@ public MessageDeserializer getMessageDeserializer() { public MessageHandler getMessageHandler() { return messageHandler; } + + public TccMessageHandler getTccMessageHandler() { +return tccMessageHandler; + } } \ No newline at end of file diff --git a/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/FastestSender.java b/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/FastestSender.java new file mode 100644 index ..ed758402 --- /dev/null +++ b/omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/FastestSender.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing,
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623111#comment-16623111 ] ASF GitHub Bot commented on SCB-909: WillemJiang commented on issue #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#issuecomment-423423829 @cherrylzhao as the CI passed, I merge it first and polish the code later. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623023#comment-16623023 ] ASF GitHub Bot commented on SCB-909: coveralls edited a comment on issue #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#issuecomment-422360764 [![Coverage Status](https://coveralls.io/builds/19116607/badge)](https://coveralls.io/builds/19116607) Coverage decreased (-0.4%) to 91.856% when pulling **1e87c41e667fec52b2db49fc03e1303029685e9d on cherrylzhao:master** into **cc38fe9dca2a4c2f09d949117a61fa0ee2586a5f on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623006#comment-16623006 ] ASF GitHub Bot commented on SCB-909: cherrylzhao commented on a change in pull request #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#discussion_r219373530 ## File path: omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/tcc/GrpcCoordinateStreamObserver.java ## @@ -6,33 +6,34 @@ * (the "License"); you may not use this file except in compliance with Review comment: sorry, I haven't understand what it mean. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16623002#comment-16623002 ] ASF GitHub Bot commented on SCB-909: cherrylzhao commented on a change in pull request #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#discussion_r219373357 ## File path: omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/tcc/LoadBalanceContextBuilderTest.java ## @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.saga.omega.connector.grpc.tcc; + +import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.core.IsInstanceOf.instanceOf; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import com.google.common.collect.Lists; +import io.grpc.ManagedChannel; +import io.grpc.inprocess.InProcessServerBuilder; +import io.grpc.testing.GrpcCleanupRule; +import java.io.IOException; +import java.util.ArrayList; +import org.apache.servicecomb.saga.omega.connector.grpc.AlphaClusterConfig; +import org.apache.servicecomb.saga.omega.context.ServiceConfig; +import org.apache.servicecomb.saga.omega.transaction.tcc.CoordinateMessageHandler; +import org.apache.servicecomb.saga.omega.transaction.tcc.TccMessageHandler; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class LoadBalanceContextBuilderTest { + + @Rule + public final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule(); + + private final AlphaClusterConfig clusterConfig = mock(AlphaClusterConfig.class); + private final TccMessageHandler tccMessageHandler = mock(CoordinateMessageHandler.class); + private final String serverName = uniquify("serviceName"); + private final ServiceConfig serviceConfig = new ServiceConfig(serverName); + protected final String[] addresses = {"localhost:8080", "localhost:8090"}; + + private LoadBalanceContextBuilder tccLoadBalanceContextBuilder; + private LoadBalanceContextBuilder sagaLoadBalanceContextBuilder; + + @Before + public void setup() throws IOException { +// Create a server, add service, start, and register for automatic graceful shutdown. + grpcCleanup.register(InProcessServerBuilder.forName("localhost:8080").directExecutor().build().start()); + grpcCleanup.register(InProcessServerBuilder.forName("localhost:8090").directExecutor().build().start()); + when(clusterConfig.getAddresses()).thenReturn(Lists.newArrayList(addresses)); +when(clusterConfig.getTccMessageHandler()).thenReturn(tccMessageHandler); +tccLoadBalanceContextBuilder = +new LoadBalanceContextBuilder(TransactionType.TCC, clusterConfig, serviceConfig, 30); +sagaLoadBalanceContextBuilder = +new LoadBalanceContextBuilder(TransactionType.SAGA, clusterConfig, serviceConfig, 30); + } + + @After + public void teardown() { + } + + @Test + public void buildTccLoadBalanceContextWithoutSsl() { +when(clusterConfig.isEnableSSL()).thenReturn(false); + +LoadBalanceContext loadContext = tccLoadBalanceContextBuilder.build(); +assertThat(loadContext.getPendingTaskRunner().getReconnectDelay(), is(30)); +assertThat(loadContext.getSenders().size(), is(2)); +assertThat(loadContext.getSenders().keySet().iterator().next(), instanceOf(TccMessageSender.class)); +assertThat(loadContext.getSenders().values().iterator().next(), is(0l)); +assertThat(loadContext.getChannels().size(), is(2)); +loadContext.getSenders().keySet().iterator().next().close(); +shutdownChannels(loadContext); + } + + @Test + public void buildTccLoadBalanceContextWithSsl() { +when(clusterConfig.isEnableSSL()).thenReturn(true); + when(clusterConfig.getCert()).thenReturn(getClass().getClassLoader().getResource("client.crt").getFile()); + when(clusterConfig.getCertChain()).thenReturn(getClass().getClassLoa
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16622977#comment-16622977 ] ASF GitHub Bot commented on SCB-909: WillemJiang commented on a change in pull request #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#discussion_r219368991 ## File path: omega/omega-connector/omega-connector-grpc/src/test/java/org/apache/servicecomb/saga/omega/connector/grpc/tcc/LoadBalanceContextBuilderTest.java ## @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.saga.omega.connector.grpc.tcc; + +import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.core.IsInstanceOf.instanceOf; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import com.google.common.collect.Lists; +import io.grpc.ManagedChannel; +import io.grpc.inprocess.InProcessServerBuilder; +import io.grpc.testing.GrpcCleanupRule; +import java.io.IOException; +import java.util.ArrayList; +import org.apache.servicecomb.saga.omega.connector.grpc.AlphaClusterConfig; +import org.apache.servicecomb.saga.omega.context.ServiceConfig; +import org.apache.servicecomb.saga.omega.transaction.tcc.CoordinateMessageHandler; +import org.apache.servicecomb.saga.omega.transaction.tcc.TccMessageHandler; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +public class LoadBalanceContextBuilderTest { + + @Rule + public final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule(); + + private final AlphaClusterConfig clusterConfig = mock(AlphaClusterConfig.class); + private final TccMessageHandler tccMessageHandler = mock(CoordinateMessageHandler.class); + private final String serverName = uniquify("serviceName"); + private final ServiceConfig serviceConfig = new ServiceConfig(serverName); + protected final String[] addresses = {"localhost:8080", "localhost:8090"}; + + private LoadBalanceContextBuilder tccLoadBalanceContextBuilder; + private LoadBalanceContextBuilder sagaLoadBalanceContextBuilder; + + @Before + public void setup() throws IOException { +// Create a server, add service, start, and register for automatic graceful shutdown. + grpcCleanup.register(InProcessServerBuilder.forName("localhost:8080").directExecutor().build().start()); + grpcCleanup.register(InProcessServerBuilder.forName("localhost:8090").directExecutor().build().start()); + when(clusterConfig.getAddresses()).thenReturn(Lists.newArrayList(addresses)); +when(clusterConfig.getTccMessageHandler()).thenReturn(tccMessageHandler); +tccLoadBalanceContextBuilder = +new LoadBalanceContextBuilder(TransactionType.TCC, clusterConfig, serviceConfig, 30); +sagaLoadBalanceContextBuilder = +new LoadBalanceContextBuilder(TransactionType.SAGA, clusterConfig, serviceConfig, 30); + } + + @After + public void teardown() { + } + + @Test + public void buildTccLoadBalanceContextWithoutSsl() { +when(clusterConfig.isEnableSSL()).thenReturn(false); + +LoadBalanceContext loadContext = tccLoadBalanceContextBuilder.build(); +assertThat(loadContext.getPendingTaskRunner().getReconnectDelay(), is(30)); +assertThat(loadContext.getSenders().size(), is(2)); +assertThat(loadContext.getSenders().keySet().iterator().next(), instanceOf(TccMessageSender.class)); +assertThat(loadContext.getSenders().values().iterator().next(), is(0l)); +assertThat(loadContext.getChannels().size(), is(2)); +loadContext.getSenders().keySet().iterator().next().close(); +shutdownChannels(loadContext); + } + + @Test + public void buildTccLoadBalanceContextWithSsl() { +when(clusterConfig.isEnableSSL()).thenReturn(true); + when(clusterConfig.getCert()).thenReturn(getClass().getClassLoader().getResource("client.crt").getFile()); + when(clusterConfig.getCertChain()).thenReturn(getClass().getClassLoa
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16622976#comment-16622976 ] ASF GitHub Bot commented on SCB-909: WillemJiang commented on a change in pull request #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#discussion_r219367862 ## File path: omega/omega-connector/omega-connector-grpc/src/main/java/org/apache/servicecomb/saga/omega/connector/grpc/tcc/GrpcCoordinateStreamObserver.java ## @@ -6,33 +6,34 @@ * (the "License"); you may not use this file except in compliance with Review comment: Hi, I think You need to change the template. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16621371#comment-16621371 ] ASF GitHub Bot commented on SCB-909: coveralls edited a comment on issue #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#issuecomment-422360764 [![Coverage Status](https://coveralls.io/builds/19092822/badge)](https://coveralls.io/builds/19092822) Coverage decreased (-0.6%) to 91.654% when pulling **307950a94d6a20b7a47d9ebe08c91e5c553d653d on cherrylzhao:master** into **cc38fe9dca2a4c2f09d949117a61fa0ee2586a5f on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16618992#comment-16618992 ] ASF GitHub Bot commented on SCB-909: coveralls commented on issue #302: SCB-909 Add fault tolerance for service comb TCC (WIP) URL: https://github.com/apache/incubator-servicecomb-saga/pull/302#issuecomment-422360764 [![Coverage Status](https://coveralls.io/builds/19055524/badge)](https://coveralls.io/builds/19055524) Coverage decreased (-3.7%) to 88.57% when pulling **6f6538d8457b8736a219391b02e39d47f475f868 on cherrylzhao:master** into **21d35e0283e0ed71eeda5389d059531280f2c0cc on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-909) Add fault tolerance for service comb TCC
[ https://issues.apache.org/jira/browse/SCB-909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16618922#comment-16618922 ] ASF GitHub Bot commented on SCB-909: cherrylzhao opened a new pull request #302: SCB-909 Add fault tolerance for service comb TCC URL: https://github.com/apache/incubator-servicecomb-saga/pull/302 Add Tcc LoaderBalanceSender & refactor omega tolerance mechanics This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add fault tolerance for service comb TCC > > > Key: SCB-909 > URL: https://issues.apache.org/jira/browse/SCB-909 > Project: Apache ServiceComb > Issue Type: New Feature > Components: Saga >Affects Versions: saga-0.3.0 >Reporter: cherrylzhao >Assignee: cherrylzhao >Priority: Major > Fix For: saga-0.3.0 > > > TCC fault tolerance incude following point. > # omega can switch to another available alpha when sending message failed. > # if omega resend logic (different alpha) failed, omega can rollback local > data automatically. > # alpha do resend logic (same omega) when ACK failed, if resend failed, dirty > data can left in database, this will be handled by scanner. > # design transaction timeout mechanics, if scanner found event won't > completed within expected time, sending componsate command to omega, it has > different type compare with normal. -- This message was sent by Atlassian JIRA (v7.6.3#76005)