[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-05-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16493208#comment-16493208
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang closed pull request #117: SCB-224 support retry sub-transaction
URL: https://github.com/apache/incubator-servicecomb-saga/pull/117
 
 
   

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-core/src/main/java/org/apache/servicecomb/saga/alpha/core/Command.java
 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/Command.java
index 49c17560..a58a7055 100644
--- 
a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/Command.java
+++ 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/Command.java
@@ -113,11 +113,11 @@ public String localTxId() {
 return localTxId;
   }
 
-  String parentTxId() {
+  public String parentTxId() {
 return parentTxId;
   }
 
-  String compensationMethod() {
+  public String compensationMethod() {
 return compensationMethod;
   }
 
diff --git 
a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/CommandRepository.java
 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/CommandRepository.java
index 2bbea774..25288ed6 100644
--- 
a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/CommandRepository.java
+++ 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/CommandRepository.java
@@ -21,7 +21,7 @@
 
 public interface CommandRepository {
 
-  void saveCompensationCommands(String globalTxId);
+  void saveCompensationCommands(TxEvent abortEvent);
 
   void markCommandAsDone(String globalTxId, String localTxId);
 
diff --git 
a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventScanner.java
 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventScanner.java
index 2d51a74f..c90b8df3 100644
--- 
a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventScanner.java
+++ 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventScanner.java
@@ -18,10 +18,7 @@
 package org.apache.servicecomb.saga.alpha.core;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.servicecomb.saga.common.EventType.SagaEndedEvent;
-import static org.apache.servicecomb.saga.common.EventType.TxCompensatedEvent;
-import static org.apache.servicecomb.saga.common.EventType.TxEndedEvent;
-import static org.apache.servicecomb.saga.common.EventType.TxStartedEvent;
+import static org.apache.servicecomb.saga.common.EventType.*;
 
 import java.lang.invoke.MethodHandles;
 import java.util.Date;
@@ -40,7 +37,7 @@
   private final OmegaCallback omegaCallback;
   private final int eventPollingInterval;
 
-  private long nextEndedEventId;
+  private long nextAbortedEventId;
   private long nextCompensatedEventId;
 
   public EventScanner(ScheduledExecutorService scheduler,
@@ -75,11 +72,11 @@ private void pollEvents() {
   }
 
   private void saveUncompensatedEventsToCommands() {
-
eventRepository.findFirstUncompensatedEventByIdGreaterThan(nextEndedEventId, 
TxEndedEvent.name())
+eventRepository.findByTypeAndIdGreaterThan(nextAbortedEventId, 
TxAbortedEvent.name())
 .forEach(event -> {
-  log.info("Found uncompensated event {}", event);
-  nextEndedEventId = event.id();
-  commandRepository.saveCompensationCommands(event.globalTxId());
+  log.info("Found aborted event {}", event);
+  nextAbortedEventId = event.id();
+  commandRepository.saveCompensationCommands(event);
 });
   }
 
diff --git 
a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxEvent.java
 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxEvent.java
index 1364cb79..5d50ff6c 100644
--- 
a/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxEvent.java
+++ 
b/alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/TxEvent.java
@@ -39,6 +39,8 @@
   private String type;
   private String compensationMethod;
   private byte[] payloads;
+  private int retries;
+  private String retriesMethod;
 
   private TxEvent() {
   }
@@ -68,44 +70,75 @@ public TxEvent(
 this(serviceName, instanceId, new Date(), globalTxId, localTxId, 
parentTxId, type, compensationMethod, payloads);
   }
 
-  public TxEvent(
-  String serviceName,
-  String instanceId,
-  Date creationTime,
-  String globalTxId,
-  String localTxId,
-  String parentTxId,
-  String type,
-  String compensationMethod,
+  public TxEvent(String serviceName, String instanceId, Date 

[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-05-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16493207#comment-16493207
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on issue #117: SCB-224 support retry sub-transaction
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/117#issuecomment-392689346
 
 
   The PR was merged into master branch. #138


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16457481#comment-16457481
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang closed pull request #138: SCB-224 retry sub-transaction on failure
URL: https://github.com/apache/incubator-servicecomb-saga/pull/138
 
 
   

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/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
 
b/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
index 4f2f729a..f9af438a 100644
--- 
a/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
+++ 
b/acceptance-tests/acceptance-pack/src/test/java/org/apache/servicecomb/saga/PackStepdefs.java
@@ -41,7 +41,7 @@
 import cucumber.api.java8.En;
 
 public class PackStepdefs implements En {
-  private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+  private static final Logger LOG = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   private static final String ALPHA_REST_ADDRESS = "alpha.rest.address";
   private static final String CAR_SERVICE_ADDRESS = "car.service.address";
@@ -73,7 +73,7 @@ public PackStepdefs() {
 });
 
 Given("^Install the byteman script ([A-Za-z0-9_\\.]+) to ([A-Za-z]+) 
Service$", (String script, String service) -> {
-  log.info("Install the byteman script {} to {} service", script, service);
+  LOG.info("Install the byteman script {} to {} service", script, service);
   List rules = new ArrayList<>();
   rules.add("target/test-classes/" + script);
   Submit bm = getBytemanSubmit(service);
@@ -81,7 +81,7 @@ public PackStepdefs() {
 });
 
 When("^User ([A-Za-z]+) requests to book ([0-9]+) cars and ([0-9]+) rooms 
(success|fail)$", (username, cars, rooms, result) -> {
-  log.info("Received request from user {} to book {} cars and {} rooms", 
username, cars, rooms);
+  LOG.info("Received request from user {} to book {} cars and {} rooms", 
username, cars, rooms);
 
   Response resp = given()
   .pathParam("name", username)
@@ -116,7 +116,7 @@ public PackStepdefs() {
 
   @After
   public void cleanUp() {
-log.info("Cleaning up services");
+LOG.info("Cleaning up services");
 for (String address : addresses) {
   given()
   .when()
@@ -135,7 +135,7 @@ public void cleanUp() {
   try {
 bm.deleteAllRules();
   } catch (Exception e) {
-log.warn("Fail to delete the byteman rules " + e);
+LOG.warn("Fail to delete the byteman rules " + e);
   }
 }
   }
@@ -156,7 +156,7 @@ private void dataMatches(String address, DataTable 
dataTable, Consumer {
-  log.info("Found uncompensated event {}", event);
+
eventRepository.findFirstUncompensatedEventByIdGreaterThan(nextEndedEventId, 
TxEndedEvent.name())
+.forEach(event -> {
+  LOG.info("Found uncompensated event {}", event);
   nextEndedEventId = event.id();
   commandRepository.saveCompensationCommands(event.globalTxId());
 });
@@ -104,7 +104,7 @@ private void saveUncompensatedEventsToCommands() {
   private void updateCompensatedCommands() {
 
eventRepository.findFirstCompensatedEventByIdGreaterThan(nextCompensatedEventId)
 .ifPresent(event -> {
-  log.info("Found compensated event {}", event);
+  LOG.info("Found compensated event {}", event);
   nextCompensatedEventId = event.id();
   updateCompensationStatus(event);
 });
@@ -114,13 +114,13 @@ private void deleteDuplicateSagaEndedEvents() {
 try {
   eventRepository.deleteDuplicateEvents(SagaEndedEvent.name());
 } catch (Exception e) {
-  log.warn("Failed to delete duplicate event", e);
+  LOG.warn("Failed to delete duplicate event", e);
 }
   }
 
   private void updateCompensationStatus(TxEvent event) {
 commandRepository.markCommandAsDone(event.globalTxId(), event.localTxId());
-log.info("Transaction with globalTxId {} and localTxId {} was compensated",
+LOG.info("Transaction with globalTxId {} and localTxId {} was compensated",
 event.globalTxId(),
 event.localTxId());
 
@@ -129,7 

[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16457482#comment-16457482
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-385156256
 
 
   Merged the patch into master branch.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-26 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16453655#comment-16453655
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on a change in pull request #138: SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r183574797
 
 

 ##
 File path: 
alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/TxEventEnvelopeRepository.java
 ##
 @@ -56,9 +66,13 @@
 
   @Query("SELECT DISTINCT new org.apache.servicecomb.saga.alpha.core.TxEvent("
   + "t.serviceName, t.instanceId, t.globalTxId, t.localTxId, t.parentTxId, 
"
-  + "t.type, t.compensationMethod, t.payloads"
+  + "t.type, t.compensationMethod, t.payloads "
   + ") FROM TxEvent t "
-  + "WHERE t.globalTxId = ?1 AND t.type = ?2")
+  + "WHERE t.globalTxId = ?1 AND t.type = ?2 "
 
 Review comment:
   It's a litter bit complicated, as we have retry option, the retry failed 
event is not same with the abort event. It should be easy if we introduce retry 
failed event.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16449470#comment-16449470
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16665603/badge)](https://coveralls.io/builds/16665603)
   
   Coverage increased (+0.3%) to 95.361% when pulling 
**436296b07b1bcf92aab65cd65e358feade8d77d4 on eric-lee-ltk:SCB-224** into 
**aff2719e0322c452dc52c0e90f9150ac0fb123e6 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16447243#comment-16447243
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16638398/badge)](https://coveralls.io/builds/16638398)
   
   Coverage decreased (-0.1%) to 94.877% when pulling 
**7157bd4716e0cf77720e433df9daadd0ecb65453 on eric-lee-ltk:SCB-224** into 
**aff2719e0322c452dc52c0e90f9150ac0fb123e6 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16440713#comment-16440713
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16554289/badge)](https://coveralls.io/builds/16554289)
   
   Coverage increased (+0.4%) to 95.863% when pulling 
**b8a1163824edcb73fb8e55169d7c083763b3ef5b on eric-lee-ltk:SCB-224** into 
**54ed83e0bf90a7aa364b7b5fdb32e64f3a402550 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16440712#comment-16440712
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16554289/badge)](https://coveralls.io/builds/16554289)
   
   Coverage increased (+0.4%) to 95.863% when pulling 
**b8a1163824edcb73fb8e55169d7c083763b3ef5b on eric-lee-ltk:SCB-224** into 
**54ed83e0bf90a7aa364b7b5fdb32e64f3a402550 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16440701#comment-16440701
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16554142/badge)](https://coveralls.io/builds/16554142)
   
   Coverage increased (+0.3%) to 95.76% when pulling 
**f6277558a2128470300e3dd858b3c5465498dd1d on eric-lee-ltk:SCB-224** into 
**54ed83e0bf90a7aa364b7b5fdb32e64f3a402550 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16440610#comment-16440610
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16552896/badge)](https://coveralls.io/builds/16552896)
   
   Coverage increased (+0.1%) to 95.553% when pulling 
**1dcaf49d08797899e340e2d59f38a4db64fb5461 on eric-lee-ltk:SCB-224** into 
**54ed83e0bf90a7aa364b7b5fdb32e64f3a402550 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16440590#comment-16440590
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: SCB-224 retry sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16552599/badge)](https://coveralls.io/builds/16552599)
   
   Coverage increased (+0.1%) to 95.553% when pulling 
**c3e7396f5e787afe6ecf5f6b50201b764f31128c on eric-lee-ltk:SCB-224** into 
**54ed83e0bf90a7aa364b7b5fdb32e64f3a402550 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-04-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16425184#comment-16425184
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: [WIP] SCB-224 retry sub-transaction on 
failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/16334447/badge)](https://coveralls.io/builds/16334447)
   
   Coverage increased (+0.03%) to 95.549% when pulling 
**6930930eb153ef50a246d7683ced7ecb0229374f on eric-lee-ltk:SCB-224** into 
**7de3915465f8c39b04dab1e3349c26d6b2a71e6d 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16398302#comment-16398302
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: [WIP] SCB-224 retry sub-transaction on 
failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15965898/badge)](https://coveralls.io/builds/15965898)
   
   Coverage decreased (-0.3%) to 95.031% when pulling 
**6c34c4fea081bcf804ccad880af93a7a7566cf6b on eric-lee-ltk:SCB-224** into 
**541202272bdd5f5b76daa11c7b6cf1c1a7d9a505 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396793#comment-16396793
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: [WIP] SCB-224 retry sub-transaction on 
failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15946765/badge)](https://coveralls.io/builds/15946765)
   
   Coverage increased (+0.3%) to 95.553% when pulling 
**390d5ac2829917fb651bb084270065ef51616a26 on eric-lee-ltk:SCB-224** into 
**541202272bdd5f5b76daa11c7b6cf1c1a7d9a505 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396779#comment-16396779
 ] 

ASF GitHub Bot commented on SCB-224:


eric-lee-ltk commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r174075643
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/ForwardRecovery.java
 ##
 @@ -0,0 +1,70 @@
+/*
+ * 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.transaction;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Method;
+
+import javax.transaction.InvalidTransactionException;
+
+import org.apache.servicecomb.saga.omega.context.OmegaContext;
+import org.apache.servicecomb.saga.omega.transaction.annotations.Compensable;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ForwardRecovery extends DefaultRecovery {
+  private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+  // TODO: 2018/03/10 we do not support retry with timeout yet
+  @Override
+  public Object apply(ProceedingJoinPoint joinPoint, Compensable compensable, 
CompensableInterceptor interceptor,
+  OmegaContext context, String parentTxId, int retries) throws Throwable {
+Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
+int remains = retries;
+try {
+  while (true) {
+try {
+  return super.apply(joinPoint, compensable, interceptor, context, 
parentTxId, remains);
+} catch (Throwable throwable) {
+  if (throwable instanceof InvalidTransactionException) {
+throw throwable;
+  }
+
+  remains = remains == -1 ? -1 : remains - 1;
+  if (remains == 0) {
+log.error(
+"Retried sub tx failed maximum times, global tx id: {}, local 
tx id: {}, method: {}, retried times: {}",
+context.globalTxId(), context.localTxId(), method.toString(), 
retries);
+throw throwable;
+  }
+
+  log.warn("Retrying sub tx failed, global tx id: {}, local tx id: {}, 
method: {}, remains: {}",
+  context.globalTxId(), context.localTxId(), method.toString(), 
remains);
+  Thread.sleep(compensable.retryDelayInMilliseconds());
 
 Review comment:
   Scheduler requires to implement the Callable interface to retrieve the 
return value. However, we need to construct a new instance for every execution 
to pass the paramenters. The times of execution is also hard to control. I 
guess this also introduce performance penalty.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396773#comment-16396773
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r174074224
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/RecoveryPolicyFactory.java
 ##
 @@ -0,0 +1,28 @@
+/*
+ * 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.transaction;
+
+public class RecoveryPolicyFactory {
+  private static final RecoveryPolicy defaultRecovery = new DefaultRecovery();
+
+  private static final RecoveryPolicy forwardRecovery = new ForwardRecovery();
+
+  static RecoveryPolicy getRecoveryPolicy(int retries) {
 
 Review comment:
   It depends on the RecoveryPolicy that you have,  maybe you need to add some 
comments for the DefaultRecovery. 


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396693#comment-16396693
 ] 

ASF GitHub Bot commented on SCB-224:


eric-lee-ltk commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r174047823
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/RecoveryPolicyFactory.java
 ##
 @@ -0,0 +1,28 @@
+/*
+ * 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.transaction;
+
+public class RecoveryPolicyFactory {
+  private static final RecoveryPolicy defaultRecovery = new DefaultRecovery();
+
+  private static final RecoveryPolicy forwardRecovery = new ForwardRecovery();
+
+  static RecoveryPolicy getRecoveryPolicy(int retries) {
 
 Review comment:
   Which parameter is more proper?


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16396689#comment-16396689
 ] 

ASF GitHub Bot commented on SCB-224:


eric-lee-ltk commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r174047412
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/DefaultRecovery.java
 ##
 @@ -0,0 +1,80 @@
+/*
+ * 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.transaction;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Method;
+
+import javax.transaction.InvalidTransactionException;
+
+import org.apache.servicecomb.saga.omega.context.OmegaContext;
+import org.apache.servicecomb.saga.omega.transaction.annotations.Compensable;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultRecovery implements RecoveryPolicy {
 
 Review comment:
   Not exactly. As the compensation of backward recovery is handled 
asynchronously, this place is only used to execute bussiness logic once.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16395344#comment-16395344
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r173796511
 
 

 ##
 File path: 
omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/ForwardRecoveryTest.java
 ##
 @@ -0,0 +1,154 @@
+/*
+ * 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.transaction;
+
+import static com.seanyinx.github.unit.scaffolding.AssertUtils.expectFailing;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.transaction.InvalidTransactionException;
+
+import org.apache.servicecomb.saga.common.EventType;
+import org.apache.servicecomb.saga.omega.context.IdGenerator;
+import org.apache.servicecomb.saga.omega.context.OmegaContext;
+import org.apache.servicecomb.saga.omega.transaction.annotations.Compensable;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ForwardRecoveryTest {
+  private final List messages = new ArrayList<>();
+
+  private final String globalTxId = UUID.randomUUID().toString();
+
+  private final String localTxId = UUID.randomUUID().toString();
+
+  private final String parentTxId = UUID.randomUUID().toString();
+
+  private final String newLocalTxId = UUID.randomUUID().toString();
+
+  private final RuntimeException oops = new RuntimeException("oops");
+
+  @SuppressWarnings("unchecked")
+  private final IdGenerator idGenerator = mock(IdGenerator.class);
+
+  private final OmegaContext omegaContext = new OmegaContext(idGenerator);
+
+  private final ProceedingJoinPoint joinPoint = 
mock(ProceedingJoinPoint.class);
+
+  private final MethodSignature methodSignature = mock(MethodSignature.class);
+
+  private final Compensable compensable = mock(Compensable.class);
+
+  private final MessageSender sender = e -> {
+messages.add(e);
+return new AlphaResponse(false);
+  };
+
+  private final CompensableInterceptor interceptor = new 
CompensableInterceptor(omegaContext, sender);
+
+  private final RecoveryPolicy recoveryPolicy = new ForwardRecovery();
+
+  @Before
+  public void setUp() throws Exception {
+when(idGenerator.nextId()).thenReturn(newLocalTxId);
+when(joinPoint.getSignature()).thenReturn(methodSignature);
+when(joinPoint.getTarget()).thenReturn(this);
+
+
when(methodSignature.getMethod()).thenReturn(this.getClass().getDeclaredMethod("doNothing"));
+when(compensable.compensationMethod()).thenReturn("doNothing");
+when(compensable.retries()).thenReturn(0);
+
+omegaContext.setGlobalTxId(globalTxId);
+omegaContext.setLocalTxId(localTxId);
+  }
+
+  @Test
+  public void forwardExceptionWhenGlobalTxAborted() {
+MessageSender sender = mock(MessageSender.class);
+when(sender.send(any())).thenReturn(new AlphaResponse(true));
+
+CompensableInterceptor interceptor = new 
CompensableInterceptor(omegaContext, sender);
+
+try {
+  recoveryPolicy.apply(joinPoint, compensable, interceptor, omegaContext, 
parentTxId, 0);
+  expectFailing(InvalidTransactionException.class);
+} catch (InvalidTransactionException e) {
+  assertThat(e.getMessage().contains("Abort sub transaction"), is(true));
+} catch (Throwable throwable) {
+  fail("unexpected exception throw: " + throwable);
+}
+
+verify(sender, times(1)).send(any());
+  }
+
+  @Test
+  public void throwExceptionWhenRetryReachesMaximum() throws Throwable {
+when(compensable.retries()).thenReturn(2);
+

[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16395342#comment-16395342
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r173795656
 
 

 ##
 File path: 
omega/omega-transaction/src/test/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspectTest.java
 ##
 @@ -125,37 +120,88 @@ public void restoreContextOnCompensableError() throws 
Throwable {
   }
 
   @Test
-  public void returnImmediatelyWhenReceivedRejectResponse() throws Throwable {
-MessageSender sender = mock(MessageSender.class);
-when(sender.send(any())).thenReturn(new AlphaResponse(true));
+  public void retryReachesMaximumAndForwardException() throws Throwable {
+RuntimeException oops = new RuntimeException("oops");
+when(joinPoint.proceed()).thenThrow(oops);
+when(compensable.retries()).thenReturn(3);
 
-TransactionAspect aspect = new TransactionAspect(sender, omegaContext);
 try {
   aspect.advise(joinPoint, compensable);
-  expectFailing(InvalidTransactionException.class);
-} catch (InvalidTransactionException e) {
-  System.out.println(e.getMessage());
-  assertThat(e.getMessage().contains("Abort sub transaction"), is(true));
+  expectFailing(RuntimeException.class);
+} catch (RuntimeException e) {
+  assertThat(e.getMessage(), is("oops"));
 }
 
-verify(sender, times(1)).send(any());
+assertThat(messages.size(), is(6));
+
+TxEvent startedEvent1 = messages.get(0);
+assertThat(startedEvent1.globalTxId(), is(globalTxId));
+assertThat(startedEvent1.localTxId(), is(newLocalTxId));
+assertThat(startedEvent1.parentTxId(), is(localTxId));
+assertThat(startedEvent1.type(), is(EventType.TxStartedEvent));
+assertThat(startedEvent1.retries(), is(3));
+assertThat(startedEvent1.retryMethod(), 
is(this.getClass().getDeclaredMethod("doNothing").toString()));
+
+assertThat(messages.get(1).type(), is(EventType.TxAbortedEvent));
+
+TxEvent startedEvent2 = messages.get(2);
+assertThat(startedEvent2.localTxId(), is(newLocalTxId));
+assertThat(startedEvent2.type(), is(EventType.TxStartedEvent));
+assertThat(startedEvent2.retries(), is(2));
+
+assertThat(messages.get(3).type(), is(EventType.TxAbortedEvent));
+
+TxEvent startedEvent3 = messages.get(4);
+assertThat(startedEvent3.localTxId(), is(newLocalTxId));
+assertThat(startedEvent3.type(), is(EventType.TxStartedEvent));
+assertThat(startedEvent3.retries(), is(1));
+
+assertThat(messages.get(5).type(), is(EventType.TxAbortedEvent));
+
+assertThat(omegaContext.globalTxId(), is(globalTxId));
+assertThat(omegaContext.localTxId(), is(localTxId));
   }
 
   @Test
-  public void recordRetryMethodWhenRetriesIsSet() throws Throwable {
-int retries = new Random().nextInt(Integer.MAX_VALUE - 1) + 1;
-when(compensable.retries()).thenReturn(retries);
+  public void keepRetryingTillSuccess() throws Throwable {
+RuntimeException oops = new RuntimeException("oops");
+when(joinPoint.proceed()).thenThrow(oops).thenThrow(oops).thenReturn(null);
+when(compensable.retries()).thenReturn(-1);
 
-aspect.advise(joinPoint, compensable);
+try {
+  aspect.advise(joinPoint, compensable);
+} catch (Exception e) {
 
 Review comment:
   We don't need to catch the exception here, as the JUnit test failed when the 
exception is throw.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16395345#comment-16395345
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r173800214
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/DefaultRecovery.java
 ##
 @@ -0,0 +1,80 @@
+/*
+ * 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.transaction;
+
+import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Method;
+
+import javax.transaction.InvalidTransactionException;
+
+import org.apache.servicecomb.saga.omega.context.OmegaContext;
+import org.apache.servicecomb.saga.omega.transaction.annotations.Compensable;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DefaultRecovery implements RecoveryPolicy {
 
 Review comment:
   Is it a backward recovery?


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16395343#comment-16395343
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r173799065
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/RecoveryPolicyFactory.java
 ##
 @@ -0,0 +1,28 @@
+/*
+ * 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.transaction;
+
+public class RecoveryPolicyFactory {
+  private static final RecoveryPolicy defaultRecovery = new DefaultRecovery();
+
+  private static final RecoveryPolicy forwardRecovery = new ForwardRecovery();
+
+  static RecoveryPolicy getRecoveryPolicy(int retries) {
 
 Review comment:
   How can you decide the RecoveryPolicy by using the retries parameter.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16395340#comment-16395340
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on a change in pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#discussion_r173798670
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspect.java
 ##
 @@ -33,7 +31,7 @@
 
 @Aspect
 public class TransactionAspect {
-  private static final Logger LOG = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+  private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
 Review comment:
   It's common practice to use upper case for the static constant.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16395139#comment-16395139
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: [WIP] SCB-224 retry sub-transaction on 
failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15926062/badge)](https://coveralls.io/builds/15926062)
   
   Coverage increased (+0.05%) to 95.337% when pulling 
**c1d96b209041934a277485d510025df40fc3c683 on eric-lee-ltk:SCB-224** into 
**dbac344f6e7a6e904dc6c0642c72c9539d4e5fe4 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-03-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16388789#comment-16388789
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: [WIP] SCB-224 retry sub-transaction on 
failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15827187/badge)](https://coveralls.io/builds/15827187)
   
   Coverage increased (+0.4%) to 95.699% when pulling 
**93b8ccbaec48ce2d91dcb0d740b62d3c9504242d on eric-lee-ltk:SCB-224** into 
**86cee600dd8560b2ac6b17424c130d1f5abb5739 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Assignee: Eric Lee
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-02-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16378336#comment-16378336
 ] 

ASF GitHub Bot commented on SCB-224:


coveralls commented on issue #138: [WIP] SCB-224 retry sub-transaction on 
failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368816986
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/15714689/badge)](https://coveralls.io/builds/15714689)
   
   Coverage increased (+0.3%) to 95.568% when pulling 
**c26feb1d43adb073a5b02385ea14693b37056692 on eric-lee-ltk:SCB-224** into 
**44763ae7d4930d68d12212d3164b4f50036bc076 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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-02-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16375613#comment-16375613
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on issue #138: [WIP] SCB-224 retry sub-transaction on 
failure
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/138#issuecomment-368236318
 
 
   @eric-lee-ltk  There are some build error in you commit, could you take a 
look at it?


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-02-23 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16375249#comment-16375249
 ] 

ASF GitHub Bot commented on SCB-224:


eric-lee-ltk opened a new pull request #138: [WIP] SCB-224 retry 
sub-transaction on failure
URL: https://github.com/apache/incubator-servicecomb-saga/pull/138
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   
   This PR is based on #117 


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
> Fix For: saga-0.2.0
>
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-02-08 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16356662#comment-16356662
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on issue #117: SCB-224 support retry sub-transaction
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/117#issuecomment-364043048
 
 
   @zhang2014  Could you rebase the master branch?
   


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-01-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16338573#comment-16338573
 ] 

ASF GitHub Bot commented on SCB-224:


seanyinx commented on a change in pull request #117: SCB-224 support retry 
sub-transaction
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/117#discussion_r163727595
 
 

 ##
 File path: 
alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/EventScanner.java
 ##
 @@ -75,11 +72,11 @@ private void pollEvents() {
   }
 
   private void saveUncompensatedEventsToCommands() {
-
eventRepository.findFirstUncompensatedEventByIdGreaterThan(nextEndedEventId, 
TxEndedEvent.name())
+eventRepository.findByTypeAndIdGreaterThan(nextAbortedEventId, 
TxAbortedEvent.name())
 
 Review comment:
   we can't fully depend on AbortedEvent here, since TxStartedEvent and 
TxEndedEvent of some sub transaction may arrive later, causing some events are 
not compensated.
   


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-01-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16338571#comment-16338571
 ] 

ASF GitHub Bot commented on SCB-224:


seanyinx commented on a change in pull request #117: SCB-224 support retry 
sub-transaction
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/117#discussion_r163730618
 
 

 ##
 File path: 
omega/omega-transaction/src/main/java/org/apache/servicecomb/saga/omega/transaction/TransactionAspect.java
 ##
 @@ -40,26 +40,29 @@
   private static final Logger LOG = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   private final OmegaContext context;
+  private final EventAwareInterceptor interceptor;
   private final ScheduledExecutorService executor = 
Executors.newSingleThreadScheduledExecutor();
-  private final CompensableInterceptor interceptor;
 
-  public TransactionAspect(MessageSender sender, OmegaContext context) {
+  public TransactionAspect(MessageSender messageSender, OmegaContext context) {
 this.context = context;
-this.interceptor = new CompensableInterceptor(context, sender);
+this.interceptor = new CompensableInterceptor(context,messageSender);
   }
 
   
@Around("execution(@org.apache.servicecomb.saga.omega.transaction.annotations.Compensable
 * *(..)) && @annotation(compensable)")
   Object advise(ProceedingJoinPoint joinPoint, Compensable compensable) throws 
Throwable {
 Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
 LOG.debug("Intercepting compensable method {} with context {}", 
method.toString(), context);
 
-String signature = compensationMethodSignature(joinPoint, compensable, 
method);
+Object[] args = joinPoint.getArgs();
 
 Review comment:
   retry probably needs to run synchronously instead of async. when alpha 
receives TxAbortedEvent, it needs to ask Omega to retry immediately. Or the 
transaction will fail on user service side.


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-01-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16338570#comment-16338570
 ] 

ASF GitHub Bot commented on SCB-224:


seanyinx commented on a change in pull request #117: SCB-224 support retry 
sub-transaction
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/117#discussion_r163728483
 
 

 ##
 File path: 
alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/SpringCommandRepository.java
 ##
 @@ -48,25 +46,32 @@
   }
 
   @Override
-  public void saveCompensationCommands(String globalTxId) {
-List events = eventRepository
-.findStartedEventsWithMatchingEndedButNotCompensatedEvents(globalTxId);
-
-Map commands = new LinkedHashMap<>();
-
-for (TxEvent event : events) {
-  commands.computeIfAbsent(event.localTxId(), k -> new Command(event));
-}
-
-for (Command command : commands.values()) {
-  log.info("Saving compensation command {}", command);
-  try {
-commandRepository.save(command);
-  } catch (Exception e) {
-log.warn("Failed to save some command {}", command);
+  public void saveCompensationCommands(TxEvent abortEvent) {
+Optional compensationStartedEvent =
+eventRepository.findStartedEventWithLocalTxId(abortEvent.globalTxId(), 
abortEvent.parentTxId());
+
+compensationStartedEvent.ifPresent(txEvent -> {
+  String retriesMethod = txEvent.retriesMethod();
+  long retried = retriedTimes(txEvent.globalTxId(), retriesMethod, 
txEvent.localTxId());
+
+  List compensationEvents = createRetriesTxEvent(abortEvent.id(), 
txEvent);
+
+  if (txEvent.retries() < (retried + 1)) {
+compensationEvents =
+
eventRepository.findStartedEventsWithMatchingEndedButNotCompensatedEvents(txEvent.globalTxId());
   }
-  log.info("Saved compensation command {}", command);
-}
+
+  compensationEvents.stream().map(Command::new)
 
 Review comment:
   there may be duplicate start events and they have to be filtered to avoid 
redundant compensation


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-01-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16326259#comment-16326259
 ] 

ASF GitHub Bot commented on SCB-224:


WillemJiang commented on issue #117: [WIP] SCB-224 support retry sub-transaction
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/117#issuecomment-357691737
 
 
   @zhang2014 Could you rebase the change and fix the conflict?


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>Priority: Major
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-224) [pack] retry sub-transaction on failure

2018-01-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/SCB-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16325290#comment-16325290
 ] 

ASF GitHub Bot commented on SCB-224:


zhang2014 opened a new pull request #117: [WIP] SCB-224 support retry 
sub-transaction
URL: https://github.com/apache/incubator-servicecomb-saga/pull/117
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [x] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `mvn clean install` to make sure basic checks pass. A more 
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   


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


> [pack] retry sub-transaction on failure
> ---
>
> Key: SCB-224
> URL: https://issues.apache.org/jira/browse/SCB-224
> Project: Apache ServiceComb
>  Issue Type: New Feature
>  Components: Saga
>Reporter: Yin Xiang
>
> as a user, i want to retry transaction in my service, so that it can always 
> be done eventually.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)