You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dg...@apache.org on 2019/02/11 09:52:13 UTC
[ignite] branch master updated: IGNITE-11276: Solve NPE problem,
uses exchCtx from parent if state is merged. mergeWith sets inside
mux - Fixes #6072.
This is an automated email from the ASF dual-hosted git repository.
dgovorukhin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new cca4491 IGNITE-11276: Solve NPE problem, uses exchCtx from parent if state is merged. mergeWith sets inside mux - Fixes #6072.
cca4491 is described below
commit cca4491ff794eb5398ae56a7d05fc804bee8d827
Author: mstepachev <ma...@gmail.com>
AuthorDate: Mon Feb 11 12:51:44 2019 +0300
IGNITE-11276: Solve NPE problem, uses exchCtx from parent if state is merged. mergeWith sets inside mux - Fixes #6072.
Signed-off-by: Dmitriy Govorukhin <dm...@gmail.com>
---
.../cache/GridCachePartitionExchangeManager.java | 2 +-
.../preloader/GridDhtPartitionsExchangeFuture.java | 25 +++++++++++++++++++---
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 08762a9..d8ec478 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -2627,7 +2627,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
GridDhtPartitionsExchangeFuture fut0 = (GridDhtPartitionsExchangeFuture)task;
if (resVer.compareTo(fut0.initialVersion()) >= 0) {
- fut0.finishMerged(resVer);
+ fut0.finishMerged(resVer, exchFut);
futQ.remove(fut0);
}
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 170d7e5..343ad3f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -475,7 +475,22 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
*/
assert exchangeDone() : "Should not be called before exchange is finished";
- return isDone() ? result() : exchCtx.events().topologyVersion();
+ if (isDone())
+ return result();
+
+ final ExchangeContext exchCtx0;
+
+ synchronized (mux) {
+ if (state == ExchangeLocalState.MERGED) {
+ assert mergedWith != null;
+
+ exchCtx0 = mergedWith.exchCtx;
+ }
+ else
+ exchCtx0 = exchCtx;
+ }
+
+ return exchCtx0.events().topologyVersion();
}
/**
@@ -2031,9 +2046,13 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
/**
* Finish merged future to allow GridCachePartitionExchangeManager.ExchangeFutureSet cleanup.
*/
- public void finishMerged(AffinityTopologyVersion resVer) {
+ public void finishMerged(AffinityTopologyVersion resVer, GridDhtPartitionsExchangeFuture exchFut) {
synchronized (mux) {
- if (state == null) state = ExchangeLocalState.MERGED;
+ if (state == null) {
+ state = ExchangeLocalState.MERGED;
+
+ mergedWith = exchFut;
+ }
}
done.set(true);