Willem Jiang created SCB-1481:
---------------------------------

             Summary: TCC findTimeoutGlobalTx should time-out event into 
consideration.
                 Key: SCB-1481
                 URL: https://issues.apache.org/jira/browse/SCB-1481
             Project: Apache ServiceComb
          Issue Type: Bug
            Reporter: Willem Jiang


We will get the exception like 
TCC:java.sql.SQLIntegrityConstraintViolationException:Duplicate entry key

GlobalTxEventRepository:line 37
{code}
  @Query(value = "SELECT t FROM GlobalTxEvent AS t WHERE t.creationTime < ?1 
and t.txType = ?2 order by t.creationTime asc")
  Optional<List<GlobalTxEvent>> findTimeoutGlobalTx(Date deadLine, String 
txType, Pageable pageable);
{code}
We should skip the "END_TIMEOUT", like
{code}
    @Query(value = "SELECT t FROM GlobalTxEvent AS t WHERE t.creationTime < ?1 
and t.txType = ?2 "
            + "AND NOT EXISTS(select 1 from GlobalTxEvent b where 
b.txType='END_TIMEOUT' AND b.globalTxId=t.globalTxId) order by t.creationTime 
asc")
    Optional<List<GlobalTxEvent>> findTimeoutGlobalTx(Date deadLine, String 
txType, Pageable pageable);
{code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to