You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/10/06 18:05:39 UTC
[GitHub] [ignite-3] vldpyatkov commented on a diff in pull request #1168: Ignite-17834 Fixed.
vldpyatkov commented on code in PR #1168:
URL: https://github.com/apache/ignite-3/pull/1168#discussion_r989343612
##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/impl/TransactionImpl.java:
##########
@@ -54,10 +56,13 @@ public class TransactionImpl implements InternalTransaction {
private final TxManager txManager;
/** Enlisted replication groups: replication group id -> (primary replica node, raft term). */
- private Map<String, IgniteBiTuple<ClusterNode, Long>> enlisted = new ConcurrentSkipListMap<>();
+ private final Map<String, IgniteBiTuple<ClusterNode, Long>> enlisted = new ConcurrentSkipListMap<>();
/** Enlisted operation futures in this transaction. */
- private volatile List<CompletableFuture<?>> enlistedResults = new ArrayList<>();
+ private final List<CompletableFuture<?>> enlistedResults = new ArrayList<>();
+
+ /** Guard that prevents finishing or enlisting new operations into already finished or finishing transaction. */
+ private boolean txInFinishState = false;
Review Comment:
Way do not you want to make txInFinishState to AtomicBoolean and get rid of synchronized in the finish method?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java:
##########
@@ -415,7 +415,17 @@ public CompletableFuture<T> apply(T r, Throwable e) {
throw (RuntimeException) e;
}); // Preserve failed state.
} else {
- tx0.enlistResultFuture(fut);
+ try {
+ tx0.enlistResultFuture(fut);
+ } catch (TransactionException enlistResultException) {
+ return tx0.rollbackAsync().handle((ignored, err) -> {
Review Comment:
Why are you rolling back the transaction if it is already finished?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/storage/InternalTableImpl.java:
##########
@@ -415,7 +415,17 @@ public CompletableFuture<T> apply(T r, Throwable e) {
throw (RuntimeException) e;
}); // Preserve failed state.
} else {
- tx0.enlistResultFuture(fut);
+ try {
+ tx0.enlistResultFuture(fut);
+ } catch (TransactionException enlistResultException) {
+ return tx0.rollbackAsync().handle((ignored, err) -> {
+ if (err != null) {
+ e.addSuppressed(err);
Review Comment:
e is always null here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org