IGNITE-8968 Fixed failure not being rethrown from rebalance closure - Fixes 
#4338.

Signed-off-by: Alexey Goncharuk <alexey.goncha...@gmail.com>


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

Branch: refs/heads/ignite-8446
Commit: 47e6f9995d4f6d90b59770c35f77363f907efba1
Parents: 713a428
Author: pvinokurov <vinokurov.pa...@gmail.com>
Authored: Mon Jul 23 18:25:21 2018 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Mon Jul 23 18:26:31 2018 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheUtils.java        |  3 +++
 .../distributed/near/GridNearGetFuture.java     | 27 +++++++++++++-------
 2 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/47e6f999/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 91e9816..6b1e42d 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
@@ -80,6 +80,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.processors.query.QueryUtils;
 import 
org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import 
org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
+import org.apache.ignite.internal.util.lang.GridClosureException;
 import org.apache.ignite.internal.util.lang.IgniteInClosureX;
 import org.apache.ignite.internal.util.typedef.C1;
 import org.apache.ignite.internal.util.typedef.CI1;
@@ -1753,6 +1754,8 @@ public class GridCacheUtils {
                     }
                     catch (IgniteCheckedException e) {
                         U.error(log, "Error saving backup value: " + entry, e);
+
+                        throw new GridClosureException(e);
                     }
                     catch (GridDhtInvalidPartitionException ignored) {
                         break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/47e6f999/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index b35f524..e530750 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -993,10 +993,7 @@ public final class GridNearGetFuture<K, V> extends 
CacheDistributedGetFutureAdap
                         }
                     }), F.t(node, keys), topVer);
 
-                    postProcessResult(res);
-
-                    // It is critical to call onDone after adding futures to 
compound list.
-                    onDone(loadEntries(node.id(), keys.keySet(), 
res.entries(), savedEntries, topVer));
+                    postProcessResultAndDone(res);
 
                     return;
                 }
@@ -1016,18 +1013,30 @@ public final class GridNearGetFuture<K, V> extends 
CacheDistributedGetFutureAdap
                             }
                         }), F.t(node, keys), readyTopVer);
 
-                        postProcessResult(res);
-
-                        // It is critical to call onDone after adding futures 
to compound list.
-                        onDone(loadEntries(node.id(), keys.keySet(), 
res.entries(), savedEntries, topVer));
+                        postProcessResultAndDone(res);
                     }
                 });
             }
-            else {
+            else
+                postProcessResultAndDone(res);
+
+        }
+
+        /**
+         * Post processes result and done future.
+         *
+         * @param res Response.
+         */
+        private void postProcessResultAndDone(final GridNearGetResponse res){
+            try {
                 postProcessResult(res);
 
+                // It is critical to call onDone after adding futures to 
compound list.
                 onDone(loadEntries(node.id(), keys.keySet(), res.entries(), 
savedEntries, topVer));
             }
+            catch (Exception ex) {
+                onDone(ex);
+            }
         }
 
         /**

Reply via email to