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

ASF GitHub Bot commented on SCB-915:
------------------------------------

oliugian commented on a change in pull request #299: SCB-915:saga alpha event 
scanner optimization
URL: 
https://github.com/apache/incubator-servicecomb-saga/pull/299#discussion_r217998661
 
 

 ##########
 File path: 
alpha/alpha-core/src/main/java/org/apache/servicecomb/saga/alpha/core/PushBackOmegaCallback.java
 ##########
 @@ -18,41 +18,56 @@
 package org.apache.servicecomb.saga.alpha.core;
 
 import java.lang.invoke.MethodHandles;
+import java.util.*;
 import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.stream.Collectors;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static java.util.Collections.emptyMap;
+
 public class PushBackOmegaCallback implements OmegaCallback {
+
   private static final Logger LOG = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
-  private final BlockingQueue<Runnable> pendingCompensations;
-  private final OmegaCallback underlying;
+  private final Map<String, Map<String, OmegaCallback>> callbacks;
+  private final ExecutorService compensateExecutor;
 
-  public PushBackOmegaCallback(BlockingQueue<Runnable> pendingCompensations, 
OmegaCallback underlying) {
-    this.pendingCompensations = pendingCompensations;
-    this.underlying = underlying;
+  public PushBackOmegaCallback(Map<String, Map<String, OmegaCallback>> 
callbacks,
+      ExecutorService compensateExecutor) {
+    this.callbacks = callbacks;
+    this.compensateExecutor = compensateExecutor;
   }
 
   @Override
-  public void compensate(TxEvent event) {
-    try {
-      underlying.compensate(event);
-    } catch (Exception e) {
-      logError(event, e);
-      pendingCompensations.offer(() -> compensate(event));
-    }
+  public List<TxEvent> compensateAllEvents(List<TxEvent> txEvents) {
+    List<Future<List<TxEvent>>> futures = new ArrayList<>();
+    List<TxEvent> result = new ArrayList<>();
+    Set<String> services = new HashSet<>();
 
 Review comment:
   filter all events with service name . and create threads to compensate event 
with the same service name .

----------------------------------------------------------------
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:
[email protected]


> saga alpha event scanner optimization
> -------------------------------------
>
>                 Key: SCB-915
>                 URL: https://issues.apache.org/jira/browse/SCB-915
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>            Reporter: FuChenGeng
>            Assignee: FuChenGeng
>            Priority: Major
>
> 1.the compensate logic for retry scenarios is not perfect, in some place it 
> do not considering retry scenarios.
> 2.do one compensation in one event scanner cycle,it mean that if there are 
> 1000 aborted event, it will cost at lest 500s to compensate it. And it has 
> some bugs like
> [https://github.com/apache/incubator-servicecomb-saga/issues/253]
> 3.all hot and cold data are in the same table



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

Reply via email to