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

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_r218005683
 
 

 ##########
 File path: 
alpha/alpha-server/src/main/java/org/apache/servicecomb/saga/alpha/server/TxEventEnvelopeRepository.java
 ##########
 @@ -110,10 +111,65 @@
       + "    AND t4.localTxId = t.localTxId "
       + "    AND t4.type = 'TxStartedEvent' ) = 0 "
       + "ORDER BY t.surrogateId ASC")
-  List<TxEvent> findFirstByTypeAndSurrogateIdGreaterThan(String type, long 
surrogateId, Pageable pageable);
+  List<TxEvent> findFirstByTypeAndSurrogateIdGreaterThan(String type, long 
surrogateId,
+      Pageable pageable);
 
   Optional<TxEvent> findFirstByTypeAndSurrogateIdGreaterThan(String type, long 
surrogateId);
 
+  @Query("SELECT t FROM TxEvent t "
+      + "WHERE t.type = 'TxEndedEvent' AND NOT EXISTS ( "
+      + "  SELECT t1.globalTxId FROM TxEvent t1 "
+      + "  WHERE t1.globalTxId = t.globalTxId "
+      + "    AND t1.type = 'TxStartedEvent' AND NOT EXISTS ( "
+      + "    SELECT t2.globalTxId FROM TxEvent t2 "
+      + "    WHERE t2.globalTxId = t1.globalTxId "
+      + "      AND t2.localTxId = t1.localTxId "
+      + "      AND t2.creationTime > t1.creationTime)) AND EXISTS ( "
+      + "  SELECT t3.globalTxId FROM TxEvent t3 "
+      + "  WHERE t3.globalTxId = t.globalTxId "
+      + "  AND t3.type = 'TxAbortedEvent' AND NOT EXISTS ( "
+      + "    SELECT t4.globalTxId FROM TxEvent t4 "
+      + "    WHERE t4.globalTxId = t3.globalTxId "
+      + "      AND t4.localTxId = t3.localTxId "
+      + "      AND t4.creationTime > t3.creationTime)) AND NOT EXISTS ( "
+      + "  SELECT t5.globalTxId FROM TxEvent t5 "
+      + "  WHERE t5.globalTxId = t.globalTxId "
+      + "    AND t5.localTxId = t.localTxId "
+      + "    AND t5.type = 'TxCompensatedEvent') AND NOT EXISTS ( "
+      + "   SELECT c FROM Command c "
+      + "   WHERE c.globalTxId = t.globalTxId "
+      + "    AND c.localTxId = t.localTxId ) ")
+  List<TxEvent> findNeedToCompensateTxs();
 
 Review comment:
   for the try logic. if a transaction is nested,if this sub transaction is not 
done ,it must have a tx_start_event with no other event behind.
   if a transaction is not nested.is's lasted tx event must be aborted.

----------------------------------------------------------------
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