IGNITE-10355 Tx rollback failure on put operations with caches whose topology 
fails validation - Fixes #5453.

Signed-off-by: Ivan Rakov <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bf75ef22
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bf75ef22
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bf75ef22

Branch: refs/heads/ignite-10044
Commit: bf75ef22d194c84c5cef99f5f28be221a4a468a8
Parents: d267236
Author: Dmitriy Sorokin <[email protected]>
Authored: Thu Dec 6 17:43:27 2018 +0300
Committer: Ivan Rakov <[email protected]>
Committed: Thu Dec 6 17:43:27 2018 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheUtils.java        |  2 +-
 .../cache/distributed/near/GridNearTxLocal.java | 21 +++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bf75ef22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 12b6566..ebc1d11 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1317,7 +1317,7 @@ public class GridCacheUtils {
 
         if (e instanceof CachePartialUpdateCheckedException)
             return new 
CachePartialUpdateException((CachePartialUpdateCheckedException)e);
-        else if (e instanceof ClusterTopologyServerNotFoundException)
+        else if (e.hasCause(ClusterTopologyServerNotFoundException.class))
             return new CacheServerNotFoundException(e.getMessage(), e);
         else if (e instanceof SchemaOperationException)
             return new CacheException(e.getMessage(), e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bf75ef22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index 9f1f86d..ef74de4 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -3917,16 +3917,23 @@ public class GridNearTxLocal extends 
GridDhtTxLocalAdapter implements GridTimeou
                 fut.listen(new 
IgniteInClosure<IgniteInternalFuture<IgniteInternalTx>>() {
                     @Override public void 
apply(IgniteInternalFuture<IgniteInternalTx> fut0) {
                         if (FINISH_FUT_UPD.compareAndSet(tx, fut, 
rollbackFut)) {
-                            if (tx.state() == COMMITTED) {
-                                if (log.isDebugEnabled())
-                                    log.debug("Failed to rollback, transaction 
is already committed: " + tx);
+                            switch (tx.state()) {
+                                case COMMITTED:
+                                    if (log.isDebugEnabled())
+                                        log.debug("Failed to rollback, 
transaction is already committed: " + tx);
+
+                                    // Fall-through.
 
-                                rollbackFut.forceFinish();
+                                case ROLLED_BACK:
+                                    rollbackFut.forceFinish();
+
+                                    assert rollbackFut.isDone() : rollbackFut;
+
+                                    break;
 
-                                assert rollbackFut.isDone() : rollbackFut;
+                                default: // First finish attempt was 
unsuccessful. Try again.
+                                    rollbackFut.finish(false, clearThreadMap, 
onTimeout);
                             }
-                            else // First finish attempt was unsuccessful. Try 
again.
-                                rollbackFut.finish(false, clearThreadMap, 
onTimeout);
                         }
                         else {
                             finishFut.listen(new 
IgniteInClosure<IgniteInternalFuture<IgniteInternalTx>>() {

Reply via email to