You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a compensable method (retries = 2), its rollback method would not be called when the program encounter some errors.
I guess that there is a problem on script which is response for finding uncompensation method out.
Code:
private void saveUncompensatedEventsToCommands() {
eventRepository.findFirstUncompensatedEventByIdGreaterThan(nextEndedEventId, TxEndedEvent.name())
.forEach(event -> {
LOG.info("Found uncompensated event {}", event);
nextEndedEventId = event.id();
commandRepository.saveCompensationCommands(event.globalTxId());
});
}
@Override
public List<TxEvent> findFirstUncompensatedEventByIdGreaterThan(long id, String type) {
return eventRepo.findFirstByTypeAndSurrogateIdGreaterThan(type, id, SINGLE_TX_EVENT_REQUEST);
}
// script for finding uncompensation out
@Query("SELECT t FROM TxEvent t "
+ "WHERE t.type = ?1 AND t.surrogateId > ?2 AND EXISTS ( "
+ " SELECT t1.globalTxId FROM TxEvent t1 "
+ " WHERE t1.globalTxId = t.globalTxId "
+ " AND t1.type = 'TxAbortedEvent' AND NOT EXISTS ( "
+ " SELECT t2.globalTxId FROM TxEvent t2 "
+ " WHERE t2.globalTxId = t1.globalTxId "
+ " AND t2.localTxId = t1.localTxId "
+ " AND t2.type = 'TxStartedEvent' "
+ " AND t2.creationTime > t1.creationTime)) AND NOT EXISTS ( "
+ " SELECT t3.globalTxId FROM TxEvent t3 "
+ " WHERE t3.globalTxId = t.globalTxId "
+ " AND t3.localTxId = t.localTxId "
+ " AND t3.type = 'TxCompensatedEvent') AND ( "
+ " SELECT MIN(t4.retries) FROM TxEvent t4 "
+ " WHERE t4.globalTxId = t.globalTxId "
+ " AND t4.localTxId = t.localTxId "
+ " AND t4.type = 'TxStartedEvent' ) = 0 "
+ "ORDER BY t.surrogateId ASC")
List<TxEvent> findFirstByTypeAndSurrogateIdGreaterThan(String type, long surrogateId, Pageable pageable);
formative script:
This script told us what it's invalid to rollback a compensable method of enabled retry, because the value of retries attribute must be greater than naught in its last condition.
Please point them out when I make some mistakes. Thank you!
The text was updated successfully, but these errors were encountered:
Thx for pointing that out. It's a little bit complex to cover the retry user case without introduce the retry event. I just create JIRA for it, we will rewrite this part shortly.
I wrote a compensable method (retries = 2), its rollback method would not be called when the program encounter some errors.
I guess that there is a problem on script which is response for finding uncompensation method out.
Code:
formative script:
This script told us what it's invalid to rollback a compensable method of enabled retry, because the value of retries attribute must be greater than naught in its last condition.
Please point them out when I make some mistakes. Thank you!
The text was updated successfully, but these errors were encountered: