You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/08/01 09:27:23 UTC
[38/50] [abbrv] ignite git commit: ignite-5858 Fixed affinity
initialization on new coordinator (broken in
aeb9336b3b161ddfff73f17e41cd453409b84a16).
ignite-5858 Fixed affinity initialization on new coordinator (broken in aeb9336b3b161ddfff73f17e41cd453409b84a16).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b698bbfc
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b698bbfc
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b698bbfc
Branch: refs/heads/ignite-5757
Commit: b698bbfcaa2056b9792404aef38e427ff323bd57
Parents: 89bba2f
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jul 28 10:25:16 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jul 28 10:25:16 2017 +0300
----------------------------------------------------------------------
.../processors/cache/CacheAffinitySharedManager.java | 2 +-
.../cache/GridCachePartitionExchangeManager.java | 13 ++++++++++++-
.../dht/preloader/GridDhtPartitionsExchangeFuture.java | 10 +++++++++-
3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b698bbfc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 5a7f634..51834c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -1461,7 +1461,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
* @throws IgniteCheckedException If failed.
* @return Future completed when caches initialization is done.
*/
- private IgniteInternalFuture<?> initCoordinatorCaches(final GridDhtPartitionsExchangeFuture fut)
+ public IgniteInternalFuture<?> initCoordinatorCaches(final GridDhtPartitionsExchangeFuture fut)
throws IgniteCheckedException {
final List<IgniteInternalFuture<AffinityTopologyVersion>> futs = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b698bbfc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
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 6a7258f..f6fa833 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
@@ -1745,6 +1745,9 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
/** Busy flag used as performance optimization to stop current preloading. */
private volatile boolean busy;
+ /** */
+ private boolean crd;
+
/**
* Constructor.
*/
@@ -1940,7 +1943,15 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
lastInitializedFut = exchFut;
- exchFut.init();
+ boolean newCrd = false;
+
+ if (!crd) {
+ List<ClusterNode> srvNodes = exchFut.discoCache().serverNodes();
+
+ crd = newCrd = !srvNodes.isEmpty() && srvNodes.get(0).isLocal();
+ }
+
+ exchFut.init(newCrd);
int dumpCnt = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b698bbfc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
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 71e41b0..52a74ab 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
@@ -414,9 +414,10 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
/**
* Starts activity.
*
+ * @param newCrd {@code True} if node become coordinator on this exchange.
* @throws IgniteInterruptedCheckedException If interrupted.
*/
- public void init() throws IgniteInterruptedCheckedException {
+ public void init(boolean newCrd) throws IgniteInterruptedCheckedException {
if (isDone())
return;
@@ -489,6 +490,13 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
initCachesOnLocalJoin();
}
+ if (newCrd) {
+ IgniteInternalFuture<?> fut = cctx.affinity().initCoordinatorCaches(this);
+
+ if (fut != null)
+ fut.get();
+ }
+
exchange = CU.clientNode(discoEvt.eventNode()) ?
onClientNodeEvent(crdNode) :
onServerNodeEvent(crdNode);