You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2017/04/14 12:26:18 UTC
ignite git commit: IGNITE-4915: Removed deprecated
AffinityNodeHashResolver interface.
Repository: ignite
Updated Branches:
refs/heads/master e7f348879 -> 7d90c06f9
IGNITE-4915: Removed deprecated AffinityNodeHashResolver interface.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7d90c06f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7d90c06f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7d90c06f
Branch: refs/heads/master
Commit: 7d90c06f9449d9c263283ff777a13a8245f67035
Parents: e7f3488
Author: devozerov <vo...@gridgain.com>
Authored: Fri Apr 14 15:26:05 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Apr 14 15:26:05 2017 +0300
----------------------------------------------------------------------
.../AffinityNodeAddressHashResolver.java | 44 --------
.../affinity/AffinityNodeHashResolver.java | 47 ---------
.../affinity/AffinityNodeIdHashResolver.java | 45 --------
.../rendezvous/RendezvousAffinityFunction.java | 51 +---------
.../processors/cache/GridCacheAttributes.java | 16 ---
.../processors/cache/GridCacheProcessor.java | 44 +-------
.../resources/META-INF/classnames.properties | 3 -
...ndezvousAffinityFunctionSimpleBenchmark.java | 48 +--------
...idCacheConfigurationConsistencySelfTest.java | 14 ---
...rtitionedAffinityHashIdResolverSelfTest.java | 102 -------------------
.../testsuites/IgniteCacheTestSuite2.java | 2 -
11 files changed, 5 insertions(+), 411 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeAddressHashResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeAddressHashResolver.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeAddressHashResolver.java
deleted file mode 100644
index 4ff54ff..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeAddressHashResolver.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.affinity;
-
-import java.io.Serializable;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Node hash resolver which uses {@link ClusterNode#consistentId()} as alternate hash value.
- *
- * @deprecated Use {@link IgniteConfiguration#setConsistentId(Serializable)} instead.
- */
-@Deprecated
-public class AffinityNodeAddressHashResolver implements AffinityNodeHashResolver {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** {@inheritDoc} */
- @Override public Object resolve(ClusterNode node) {
- return node.consistentId();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(AffinityNodeAddressHashResolver.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeHashResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeHashResolver.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeHashResolver.java
deleted file mode 100644
index fb5b039..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeHashResolver.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.affinity;
-
-import java.io.Serializable;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.IgniteConfiguration;
-
-/**
- * Resolver which is used to provide node hash value for affinity function.
- * <p>
- * Node IDs constantly change when nodes get restarted, which causes affinity mapping to change between restarts,
- * and hence causing redundant repartitioning. Providing an alternate node hash value, which survives node restarts,
- * will help to map keys to the same nodes whenever possible.
- * <p>
- * Note that on case clients exist they will query this object from the server and use it for affinity calculation.
- * Therefore you must ensure that server and clients can marshal and unmarshal this object in binary format,
- * i.e. all parties have object class(es) configured as binary.
- *
- * @deprecated Use {@link IgniteConfiguration#setConsistentId(Serializable)} instead.
- */
-@Deprecated
-public interface AffinityNodeHashResolver extends Serializable {
- /**
- * Resolve alternate hash value for the given Grid node.
- *
- * @param node Grid node.
- * @return Resolved hash ID.
- */
- @Deprecated
- public Object resolve(ClusterNode node);
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeIdHashResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeIdHashResolver.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeIdHashResolver.java
deleted file mode 100644
index a204a6d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/AffinityNodeIdHashResolver.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.cache.affinity;
-
-import java.io.Serializable;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Node hash resolver which uses generated node ID as node hash value. As new node ID is generated
- * on each node start, this resolver do not provide ability to map keys to the same nodes after restart.
- *
- * @deprecated Use {@link IgniteConfiguration#setConsistentId(Serializable)} instead.
- */
-@Deprecated
-public class AffinityNodeIdHashResolver implements AffinityNodeHashResolver {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** {@inheritDoc} */
- @Override public Object resolve(ClusterNode node) {
- return node.id();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(AffinityNodeIdHashResolver.class, this);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
index 59f3aed..0be9878 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
@@ -35,10 +35,8 @@ import java.util.UUID;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
-import org.apache.ignite.cache.affinity.AffinityNodeHashResolver;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.processors.cache.GridCacheUtils;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.A;
@@ -101,9 +99,6 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
* is primary). */
private IgniteBiPredicate<ClusterNode, List<ClusterNode>> affinityBackupFilter;
- /** Hash ID resolver. */
- private AffinityNodeHashResolver hashIdRslvr = null;
-
/** Logger instance. */
@LoggerResource
private transient IgniteLogger log;
@@ -214,45 +209,6 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
}
/**
- * Gets hash ID resolver for nodes. This resolver is used to provide
- * alternate hash ID, other than node ID.
- * <p>
- * Node IDs constantly change when nodes get restarted, which causes them to
- * be placed on different locations in the hash ring, and hence causing
- * repartitioning. Providing an alternate hash ID, which survives node restarts,
- * puts node on the same location on the hash ring, hence minimizing required
- * repartitioning.
- *
- * @return Hash ID resolver.
- */
- @Deprecated
- public AffinityNodeHashResolver getHashIdResolver() {
- return hashIdRslvr;
- }
-
- /**
- * Sets hash ID resolver for nodes. This resolver is used to provide
- * alternate hash ID, other than node ID.
- * <p>
- * Node IDs constantly change when nodes get restarted, which causes them to
- * be placed on different locations in the hash ring, and hence causing
- * repartitioning. Providing an alternate hash ID, which survives node restarts,
- * puts node on the same location on the hash ring, hence minimizing required
- * repartitioning.
- *
- * @param hashIdRslvr Hash ID resolver.
- *
- * @deprecated Use {@link IgniteConfiguration#setConsistentId(Serializable)} instead.
- * @return {@code this} for chaining.
- */
- @Deprecated
- public RendezvousAffinityFunction setHashIdResolver(AffinityNodeHashResolver hashIdRslvr) {
- this.hashIdRslvr = hashIdRslvr;
-
- return this;
- }
-
- /**
* Gets optional backup filter. If not {@code null}, backups will be selected
* from all nodes that pass this filter. First node passed to this filter is primary node,
* and second node is a node being tested.
@@ -346,10 +302,7 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
* @return Node hash.
*/
public Object resolveNodeHash(ClusterNode node) {
- if (hashIdRslvr != null)
- return hashIdRslvr.resolve(node);
- else
- return node.consistentId();
+ return node.consistentId();
}
/**
@@ -552,7 +505,6 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(parts);
out.writeBoolean(exclNeighbors);
- out.writeObject(hashIdRslvr);
out.writeObject(backupFilter);
}
@@ -562,7 +514,6 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
setPartitions(in.readInt());
exclNeighbors = in.readBoolean();
- hashIdRslvr = (AffinityNodeHashResolver)in.readObject();
backupFilter = (IgniteBiPredicate<ClusterNode, ClusterNode>)in.readObject();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
index 292ea4a..1caf60d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
@@ -146,22 +146,6 @@ public class GridCacheAttributes implements Serializable {
}
/**
- * @return Affinity hash ID resolver class name.
- */
- public String affinityHashIdResolverClassName() {
- AffinityFunction aff = ccfg.getAffinity();
-
- if (aff instanceof RendezvousAffinityFunction) {
- if (((RendezvousAffinityFunction) aff).getHashIdResolver() == null)
- return null;
-
- return className(((RendezvousAffinityFunction) aff).getHashIdResolver());
- }
-
- return null;
- }
-
- /**
* @return Eviction filter class name.
*/
public String evictionFilterClassName() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 7c7d45f..8799fbb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -49,7 +49,6 @@ import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
-import org.apache.ignite.cache.affinity.AffinityNodeAddressHashResolver;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.store.CacheStore;
import org.apache.ignite.cache.store.CacheStoreSessionListener;
@@ -243,15 +242,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (cfg.getCacheMode() == PARTITIONED) {
RendezvousAffinityFunction aff = new RendezvousAffinityFunction();
- aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
-
cfg.setAffinity(aff);
}
else if (cfg.getCacheMode() == REPLICATED) {
RendezvousAffinityFunction aff = new RendezvousAffinityFunction(false, 512);
- aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
-
cfg.setAffinity(aff);
cfg.setBackups(Integer.MAX_VALUE);
@@ -260,15 +255,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
cfg.setAffinity(new LocalAffinityFunction());
}
else {
- if (cfg.getCacheMode() != LOCAL) {
- if (cfg.getAffinity() instanceof RendezvousAffinityFunction) {
- RendezvousAffinityFunction aff = (RendezvousAffinityFunction)cfg.getAffinity();
-
- if (aff.getHashIdResolver() == null)
- aff.setHashIdResolver(new AffinityNodeAddressHashResolver());
- }
- }
- else if (cfg.getCacheMode() == LOCAL && !(cfg.getAffinity() instanceof LocalAffinityFunction)) {
+ if (cfg.getCacheMode() == LOCAL && !(cfg.getAffinity() instanceof LocalAffinityFunction)) {
cfg.setAffinity(new LocalAffinityFunction());
U.warn(log, "AffinityFunction configuration parameter will be ignored for local cache" +
@@ -3213,19 +3200,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
Object topNodeHashObj = aff.resolveNodeHash(topNode);
if (nodeHashObj.hashCode() == topNodeHashObj.hashCode()) {
- String hashIdRslvrName = "";
-
- if (aff.getHashIdResolver() != null)
- hashIdRslvrName = ", hashIdResolverClass=" +
- aff.getHashIdResolver().getClass().getName();
-
String errMsg = "Failed to add node to topology because it has the same hash code for " +
"partitioned affinity as one of existing nodes [cacheName=" +
- U.maskName(cfg.getName()) + hashIdRslvrName + ", existingNodeId=" + topNode.id() + ']';
+ U.maskName(cfg.getName()) + ", existingNodeId=" + topNode.id() + ']';
String sndMsg = "Failed to add node to topology because it has the same hash code for " +
"partitioned affinity as one of existing nodes [cacheName=" +
- U.maskName(cfg.getName()) + hashIdRslvrName + ", existingNodeId=" + topNode.id() + ']';
+ U.maskName(cfg.getName()) + ", existingNodeId=" + topNode.id() + ']';
return new IgniteNodeValidationResult(topNode.id(), errMsg, sndMsg);
}
@@ -3337,25 +3318,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "affinityKeyBackups",
"Affinity key backups", locAttr.affinityKeyBackups(),
rmtAttr.affinityKeyBackups(), true);
-
- String locHashIdResolver = locAttr.affinityHashIdResolverClassName();
- String rmtHashIdResolver = rmtAttr.affinityHashIdResolverClassName();
- String defHashIdResolver = AffinityNodeAddressHashResolver.class.getName();
-
- if (!((locHashIdResolver == null && rmtHashIdResolver == null) ||
- (locHashIdResolver == null && rmtHashIdResolver.equals(defHashIdResolver)) ||
- (rmtHashIdResolver == null && locHashIdResolver.equals(defHashIdResolver)))) {
-
- CU.checkAttributeMismatch(log, rmtAttr.cacheName(), rmt, "cacheAffinity.hashIdResolver",
- "Partitioned cache affinity hash ID resolver class",
- locHashIdResolver, rmtHashIdResolver, true);
- }
-
- if (locHashIdResolver == null &&
- (rmtHashIdResolver != null && rmtHashIdResolver.equals(defHashIdResolver))) {
- U.warn(log, "Set " + RendezvousAffinityFunction.class + " with " + defHashIdResolver +
- " to CacheConfiguration to start node [cacheName=" + rmtAttr.cacheName() + "]");
- }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 18584c5..93e5a8e 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -52,9 +52,6 @@ org.apache.ignite.cache.QueryIndexType
org.apache.ignite.cache.affinity.AffinityFunction
org.apache.ignite.cache.affinity.AffinityKey
org.apache.ignite.cache.affinity.AffinityKeyMapper
-org.apache.ignite.cache.affinity.AffinityNodeAddressHashResolver
-org.apache.ignite.cache.affinity.AffinityNodeHashResolver
-org.apache.ignite.cache.affinity.AffinityNodeIdHashResolver
org.apache.ignite.cache.affinity.AffinityUuid
org.apache.ignite.cache.affinity.fair.FairAffinityFunction
org.apache.ignite.cache.affinity.fair.FairAffinityFunction$1
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java
index 16f8e97..0d47676 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunctionSimpleBenchmark.java
@@ -32,10 +32,8 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.affinity.AffinityFunction;
import org.apache.ignite.cache.affinity.AffinityFunctionContext;
-import org.apache.ignite.cache.affinity.AffinityNodeHashResolver;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.events.DiscoveryEvent;
import org.apache.ignite.events.EventType;
import org.apache.ignite.internal.IgniteNodeAttributes;
@@ -653,9 +651,6 @@ public class RendezvousAffinityFunctionSimpleBenchmark extends GridCommonAbstrac
* is primary). */
private IgniteBiPredicate<ClusterNode, List<ClusterNode>> affinityBackupFilter;
- /** Hash ID resolver. */
- private AffinityNodeHashResolver hashIdRslvr = null;
-
/** Ignite instance. */
@IgniteInstanceResource
private Ignite ignite;
@@ -765,42 +760,6 @@ public class RendezvousAffinityFunctionSimpleBenchmark extends GridCommonAbstrac
}
/**
- * Gets hash ID resolver for nodes. This resolver is used to provide
- * alternate hash ID, other than node ID.
- * <p>
- * Node IDs constantly change when nodes get restarted, which causes them to
- * be placed on different locations in the hash ring, and hence causing
- * repartitioning. Providing an alternate hash ID, which survives node restarts,
- * puts node on the same location on the hash ring, hence minimizing required
- * repartitioning.
- *
- * @return Hash ID resolver.
- */
- @Deprecated
- public AffinityNodeHashResolver getHashIdResolver() {
- return hashIdRslvr;
- }
-
- /**
- * Sets hash ID resolver for nodes. This resolver is used to provide
- * alternate hash ID, other than node ID.
- * <p>
- * Node IDs constantly change when nodes get restarted, which causes them to
- * be placed on different locations in the hash ring, and hence causing
- * repartitioning. Providing an alternate hash ID, which survives node restarts,
- * puts node on the same location on the hash ring, hence minimizing required
- * repartitioning.
- *
- * @param hashIdRslvr Hash ID resolver.
- *
- * @deprecated Use {@link IgniteConfiguration#setConsistentId(Serializable)} instead.
- */
- @Deprecated
- public void setHashIdResolver(AffinityNodeHashResolver hashIdRslvr) {
- this.hashIdRslvr = hashIdRslvr;
- }
-
- /**
* Gets optional backup filter. If not {@code null}, backups will be selected
* from all nodes that pass this filter. First node passed to this filter is primary node,
* and second node is a node being tested.
@@ -886,10 +845,7 @@ public class RendezvousAffinityFunctionSimpleBenchmark extends GridCommonAbstrac
* @return Node hash.
*/
public Object resolveNodeHash(ClusterNode node) {
- if (hashIdRslvr != null)
- return hashIdRslvr.resolve(node);
- else
- return node.consistentId();
+ return node.consistentId();
}
/**
@@ -1070,7 +1026,6 @@ public class RendezvousAffinityFunctionSimpleBenchmark extends GridCommonAbstrac
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(parts);
out.writeBoolean(exclNeighbors);
- out.writeObject(hashIdRslvr);
out.writeObject(backupFilter);
}
@@ -1079,7 +1034,6 @@ public class RendezvousAffinityFunctionSimpleBenchmark extends GridCommonAbstrac
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
parts = in.readInt();
exclNeighbors = in.readBoolean();
- hashIdRslvr = (AffinityNodeHashResolver)in.readObject();
backupFilter = (IgniteBiPredicate<ClusterNode, ClusterNode>)in.readObject();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index 59a5ebb..6a153b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -26,7 +26,6 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheInterceptorAdapter;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.affinity.AffinityFunction;
-import org.apache.ignite.cache.affinity.AffinityNodeIdHashResolver;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
import org.apache.ignite.cache.eviction.EvictionFilter;
import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
@@ -537,19 +536,6 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
return startGrid(2);
}
}, IgniteCheckedException.class, "Affinity partitions count mismatch");
-
- // Different hash ID resolver.
- RendezvousAffinityFunction aff0 = new RendezvousAffinityFunction(false, 100);
-
- aff0.setHashIdResolver(new AffinityNodeIdHashResolver());
-
- aff = aff0;
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- return startGrid(2);
- }
- }, IgniteCheckedException.class, "Partitioned cache affinity hash ID resolver class mismatch");
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityHashIdResolverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityHashIdResolverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityHashIdResolverSelfTest.java
deleted file mode 100644
index 9a2b126..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityHashIdResolverSelfTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.distributed.near;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.affinity.AffinityNodeHashResolver;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.cluster.ClusterNode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-
-/**
- * Partitioned affinity hash ID resolver self test.
- */
-public class GridCachePartitionedAffinityHashIdResolverSelfTest extends GridCommonAbstractTest {
- /** Shared IP finder. */
- private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
- /** Hash ID resolver. */
- private AffinityNodeHashResolver rslvr;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- RendezvousAffinityFunction aff = new RendezvousAffinityFunction();
-
- aff.setHashIdResolver(rslvr);
-
- CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
- cacheCfg.setCacheMode(PARTITIONED);
- cacheCfg.setAffinity(aff);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(ipFinder);
-
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setCacheConfiguration(cacheCfg);
- cfg.setDiscoverySpi(disco);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
- }
-
- /**
- * Test when there is duplicate hash IDs.
- *
- * @throws Exception If failed.
- */
- public void testDuplicateId() throws Exception {
- rslvr = new BogusHashResolver();
-
- startGrid(0);
-
- GridTestUtils.assertThrows(log, new Callable<Object>() {
- @Override public Object call() throws Exception {
- startGrid(1);
-
- return null;
- }
- }, IgniteCheckedException.class, "Failed to start manager: GridManagerAdapter [enabled=true, name=" +
- "org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]");
- }
-
- /**
- *
- */
- private static class BogusHashResolver implements AffinityNodeHashResolver {
- /** {@inheritDoc} */
- @Override public Object resolve(ClusterNode node) {
- return 1;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/7d90c06f/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index b94b464..e9cf028 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -86,7 +86,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNea
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearReaderPreloadSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearReadersSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCacheNearTxForceKeyTest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedAffinityHashIdResolverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedAffinitySelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedAtomicGetAndTransformStoreSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedBasicApiTest;
@@ -225,7 +224,6 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(GridCachePartitionedTopologyChangeSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedPreloadEventsSelfTest.class));
suite.addTest(new TestSuite(GridCachePartitionedUnloadEventsSelfTest.class));
- suite.addTest(new TestSuite(GridCachePartitionedAffinityHashIdResolverSelfTest.class));
suite.addTest(new TestSuite(GridCacheColocatedOptimisticTransactionSelfTest.class));
suite.addTestSuite(GridCacheAtomicMessageCountSelfTest.class);
suite.addTest(new TestSuite(GridCacheNearPartitionedClearSelfTest.class));