You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sk...@apache.org on 2020/12/23 08:42:03 UTC
[ignite] branch master updated: IGNITE-13870 Removed obsolete
GridCacheAdapter#validateCacheKey. Fixes #8586
This is an automated email from the ASF dual-hosted git repository.
sk0x50 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 7efae7a IGNITE-13870 Removed obsolete GridCacheAdapter#validateCacheKey. Fixes #8586
7efae7a is described below
commit 7efae7a6a572d81ac778e263d84dc49b3f89259e
Author: Alexander Lapin <la...@gmail.com>
AuthorDate: Wed Dec 23 11:41:12 2020 +0300
IGNITE-13870 Removed obsolete GridCacheAdapter#validateCacheKey. Fixes #8586
Signed-off-by: Slava Koptilin <sl...@gmail.com>
---
.../org/apache/ignite/IgniteSystemProperties.java | 3 +
.../processors/cache/GridCacheAdapter.java | 137 --------------
.../internal/processors/cache/GridCacheUtils.java | 16 --
.../distributed/dht/atomic/GridDhtAtomicCache.java | 27 ---
.../dht/colocated/GridDhtColocatedCache.java | 6 -
.../distributed/near/GridNearAtomicCache.java | 3 -
.../distributed/near/GridNearCacheAdapter.java | 7 -
.../near/GridNearTransactionalCache.java | 3 -
.../cache/local/atomic/GridLocalAtomicCache.java | 18 --
.../GridCacheKeyCheckNearEnabledSelfTest.java | 30 ---
.../cache/GridCacheKeyCheckSelfTest.java | 209 ---------------------
.../processors/cache/GridCacheUtilsSelfTest.java | 199 --------------------
.../ignite/testsuites/IgniteCacheTestSuite.java | 5 -
.../ignite/testsuites/IgniteUtilSelfTestSuite.java | 2 -
14 files changed, 3 insertions(+), 662 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index 0035f1b..94f1536 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -677,7 +677,10 @@ public final class IgniteSystemProperties {
/**
* Flag indicating whether validation of keys put to cache should be disabled.
+ *
+ * @deprecated Since 2.10 Obsolete because of common use of binary marshaller.
*/
+ @Deprecated
@SystemProperty("Disables validation of keys put to cache")
public static final String IGNITE_CACHE_KEY_VALIDATION_DISABLED = "IGNITE_CACHE_KEY_VALIDATION_DISABLED";
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 0fe7e44..ff80d43 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -160,7 +160,6 @@ import org.apache.ignite.transactions.TransactionIsolation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_KEY_VALIDATION_DISABLED;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_RETRIES_COUNT;
import static org.apache.ignite.internal.GridClosureCallMode.BROADCAST;
import static org.apache.ignite.internal.processors.cache.CacheOperationContext.DFLT_ALLOW_ATOMIC_OPS_IN_TX;
@@ -255,9 +254,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
};
- /** */
- protected boolean keyCheck = !Boolean.getBoolean(IGNITE_CACHE_KEY_VALIDATION_DISABLED);
-
/** Last asynchronous future. */
protected ThreadLocal<FutureHolder> lastFut = new ThreadLocal<FutureHolder>() {
@Override protected FutureHolder initialValue() {
@@ -362,10 +358,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
init();
aff = new GridCacheAffinityImpl<>(ctx);
-
- // The check of methods 'equals' and 'hashCode' that they had been overrode isn't required, since BinaryMarshaller doesn't use them.
- if (keyCheck && ctx.binaryMarshaller())
- keyCheck = false;
}
/**
@@ -843,9 +835,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
throws IgniteCheckedException {
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
ctx.checkSecurity(SecurityPermission.CACHE_READ);
PeekModes modes = parsePeekModes(peekModes, false);
@@ -2004,9 +1993,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
) {
ctx.checkSecurity(SecurityPermission.CACHE_READ);
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.GET);
return getAllAsync0(ctx.cacheKeysView(keys),
@@ -2496,9 +2482,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
A.notNull(key, "key", val, "val");
- if (keyCheck)
- validateCacheKey(key);
-
V prevVal = getAndPut0(key, val, filter);
if (statsEnabled)
@@ -2552,9 +2535,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
A.notNull(key, "key", val, "val");
- if (keyCheck)
- validateCacheKey(key);
-
IgniteInternalFuture<V> fut = getAndPutAsync0(key, val, filter);
if (statsEnabled)
@@ -2613,9 +2593,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
A.notNull(key, "key", val, "val");
- if (keyCheck)
- validateCacheKey(key);
-
boolean stored = put0(key, val, filter);
if (statsEnabled && stored)
@@ -2725,9 +2702,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
throws IgniteCheckedException {
A.notNull(key, "key", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKey(key);
-
return syncOp(new SyncOp<EntryProcessorResult<T>>(true) {
@Override public EntryProcessorResult<T> op(GridNearTxLocal tx)
throws IgniteCheckedException {
@@ -2774,9 +2748,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
final Object... args) throws IgniteCheckedException {
A.notNull(keys, "keys", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -2817,9 +2788,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
throws EntryProcessorException {
A.notNull(key, "key", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKey(key);
-
final boolean statsEnabled = ctx.statisticsEnabled();
final boolean performanceStatsEnabled = ctx.kernalContext().performanceStatistics().enabled();
@@ -2873,9 +2841,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
final Object... args) {
A.notNull(keys, "keys", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -2929,9 +2894,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
final Object... args) {
A.notNull(map, "map");
- if (keyCheck)
- validateCacheKeys(map.keySet());
-
warnIfUnordered(map, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -2980,9 +2942,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
final Object... args) throws IgniteCheckedException {
A.notNull(map, "map");
- if (keyCheck)
- validateCacheKeys(map.keySet());
-
warnIfUnordered(map, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -3023,9 +2982,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
public final IgniteInternalFuture<Boolean> putAsync(K key, V val, @Nullable CacheEntryPredicate filter) {
A.notNull(key, "key", val, "val");
- if (keyCheck)
- validateCacheKey(key);
-
final boolean statsEnabled = ctx.statisticsEnabled();
final boolean performanceStatsEnabled = ctx.kernalContext().performanceStatistics().enabled();
@@ -3136,9 +3092,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
long start = statsEnabled || performanceStatsEnabled ? System.nanoTime() : 0L;
- if (keyCheck)
- validateCacheKeys(m.keySet());
-
warnIfUnordered(m, BulkOperation.PUT);
putAll0(m);
@@ -3177,9 +3130,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
long start = statsEnabled || performanceStatsEnabled ? System.nanoTime() : 0L;
- if (keyCheck)
- validateCacheKeys(m.keySet());
-
warnIfUnordered(m, BulkOperation.PUT);
IgniteInternalFuture<?> fut = putAllAsync0(m);
@@ -3222,9 +3172,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
V prevVal = getAndRemove0(key);
if (statsEnabled)
@@ -3282,9 +3229,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
IgniteInternalFuture<V> fut = getAndRemoveAsync0(key);
if (statsEnabled)
@@ -3353,9 +3297,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (F.isEmpty(keys))
return;
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.REMOVE);
removeAll0(keys);
@@ -3399,9 +3340,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
final long start = statsEnabled || performanceStatsEnabled ? System.nanoTime() : 0L;
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.REMOVE);
IgniteInternalFuture<Object> fut = removeAllAsync0(keys);
@@ -3456,9 +3394,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
boolean rmv = remove0(key, filter);
if (statsEnabled && rmv)
@@ -3518,9 +3453,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
IgniteInternalFuture<Boolean> fut = removeAsync0(key, filter);
if (statsEnabled)
@@ -3683,9 +3615,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (F.isEmpty(keys))
return true;
- if (keyCheck)
- validateCacheKeys(keys);
-
//TODO: IGNITE-9324: add explicit locks support.
MvccUtils.verifyMvccOperationSupport(ctx, "Lock");
@@ -3730,9 +3659,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
@Override public IgniteInternalFuture<Boolean> lockAsync(K key, long timeout) {
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
//TODO: IGNITE-9324: add explicit locks support.
MvccUtils.verifyMvccOperationSupport(ctx, "Lock");
@@ -3744,9 +3670,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
throws IgniteCheckedException {
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
unlockAll(Collections.singletonList(key));
}
@@ -3754,9 +3677,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
@Override public boolean isLocked(K key) {
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
while (true) {
@@ -3775,9 +3695,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
@Override public boolean isLockedByThread(K key) {
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
try {
KeyCacheObject cacheKey = ctx.toCacheKeyObject(key);
@@ -4855,9 +4772,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ctx.checkSecurity(SecurityPermission.CACHE_REMOVE);
- if (keyCheck)
- validateCacheKey(key);
-
GridCacheVersion obsoleteVer = nextVersion();
ctx.shared().database().checkpointReadLock();
@@ -4887,9 +4801,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
@Override public boolean evict(K key) {
A.notNull(key, "key");
- if (keyCheck)
- validateCacheKey(key);
-
//TODO IGNITE-7956
MvccUtils.verifyMvccOperationSupport(ctx, "Evict");
@@ -4903,9 +4814,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (F.isEmpty(keys))
return;
- if (keyCheck)
- validateCacheKey(keys);
-
//TODO IGNITE-7956
MvccUtils.verifyMvccOperationSupport(ctx, "Evict");
@@ -5267,51 +5175,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/**
- * For tests only.
- */
- public void forceKeyCheck() {
- keyCheck = true;
- }
-
- /**
- * Validates that given cache key has overridden equals and hashCode methods and
- * implements {@link Externalizable}.
- *
- * @param key Cache key.
- * @throws IllegalArgumentException If validation fails.
- */
- protected final void validateCacheKey(Object key) {
- if (keyCheck) {
- CU.validateCacheKey(key);
-
- keyCheck = false;
- }
- }
-
- /**
- * Validates that given cache keys have overridden equals and hashCode methods and
- * implement {@link Externalizable}.
- *
- * @param keys Cache keys.
- * @throws IgniteException If validation fails.
- */
- protected final void validateCacheKeys(Iterable<?> keys) {
- if (keys == null)
- return;
-
- if (keyCheck) {
- for (Object key : keys) {
- if (key == null || key instanceof GridCacheInternal)
- continue;
-
- CU.validateCacheKey(key);
-
- keyCheck = false;
- }
- }
- }
-
- /**
* Checks that given map is sorted or otherwise constant order, or processed inside deadlock-detecting transaction.
*
* Issues developer warning otherwise.
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 e260983..ff023d0 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
@@ -1052,22 +1052,6 @@ public class GridCacheUtils {
}
/**
- * Validates that cache key object has overridden equals and hashCode methods.
- * Will also check that a BinaryObject has a hash code set.
- *
- * @param key Key.
- * @throws IllegalArgumentException If equals or hashCode is not implemented.
- */
- public static void validateCacheKey(@Nullable Object key) {
- if (key == null)
- return;
-
- if (!U.overridesEqualsAndHashCode(key))
- throw new IllegalArgumentException("Cache key must override hashCode() and equals() methods: " +
- key.getClass().getName());
- }
-
- /**
* @param cacheName Cache name.
* @return {@code True} if this is utility system cache.
*/
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 1bc0e77..60c0006 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -473,9 +473,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
) {
ctx.checkSecurity(SecurityPermission.CACHE_READ);
- if (keyCheck)
- validateCacheKey(key);
-
CacheOperationContext opCtx = ctx.operationContextPerCall();
subjId = ctx.subjectIdPerCall(null, opCtx);
@@ -576,9 +573,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
if (F.isEmpty(keys))
return new GridFinishedFuture<>(Collections.<K, V>emptyMap());
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.GET);
CacheOperationContext opCtx = ctx.operationContextPerCall();
@@ -713,9 +707,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Override public IgniteInternalFuture<?> putAllConflictAsync(Map<KeyCacheObject, GridCacheDrInfo> conflictMap) {
ctx.dr().onReceiveCacheEntriesReceived(conflictMap.size());
- if (map != null && keyCheck)
- validateCacheKeys(conflictMap.keySet());
-
warnIfUnordered(conflictMap, BulkOperation.PUT);
return updateAll0(null,
@@ -828,8 +819,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Override public <T> Map<K, EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
EntryProcessor<K, V, T> entryProcessor,
Object... args) throws IgniteCheckedException {
- if (map != null && keyCheck)
- validateCacheKeys(keys);
warnIfUnordered(keys, BulkOperation.INVOKE);
@@ -857,9 +846,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
Object... args) {
A.notNull(key, "key", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKey(key);
-
final boolean statsEnabled = ctx.statisticsEnabled();
final long start = statsEnabled ? System.nanoTime() : 0L;
@@ -911,8 +897,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
@Override public <T> IgniteInternalFuture<Map<K, EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
final EntryProcessor<K, V, T> entryProcessor,
Object... args) {
- if (map != null && keyCheck)
- validateCacheKeys(keys);
warnIfUnordered(keys, BulkOperation.INVOKE);
@@ -978,9 +962,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
Object... args) throws IgniteCheckedException {
A.notNull(map, "map");
- if (keyCheck)
- validateCacheKeys(map.keySet());
-
warnIfUnordered(map, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -1010,9 +991,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
Object... args) {
A.notNull(map, "map");
- if (keyCheck)
- validateCacheKeys(map.keySet());
-
warnIfUnordered(map, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -1173,8 +1151,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
assert ctx.updatesAllowed();
- validateCacheKey(key);
-
ctx.checkSecurity(SecurityPermission.CACHE_PUT);
final GridNearAtomicAbstractUpdateFuture updateFut =
@@ -1361,9 +1337,6 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
assert keys != null || conflictMap != null;
- if (keyCheck)
- validateCacheKeys(keys);
-
ctx.checkSecurity(SecurityPermission.CACHE_REMOVE);
final CacheOperationContext opCtx = ctx.operationContextPerCall();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index a548fe91..298224a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -187,9 +187,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
final boolean needVer) {
ctx.checkSecurity(SecurityPermission.CACHE_READ);
- if (keyCheck)
- validateCacheKey(key);
-
GridNearTxLocal tx = checkCurrentTx();
final CacheOperationContext opCtx = ctx.operationContextPerCall();
@@ -328,9 +325,6 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
if (F.isEmpty(keys))
return new GridFinishedFuture<>(Collections.<K, V>emptyMap());
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.GET);
GridNearTxLocal tx = checkCurrentTx();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
index 1509c5e..8eb1e0c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java
@@ -428,9 +428,6 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> {
if (F.isEmpty(keys))
return new GridFinishedFuture<>(Collections.<K, V>emptyMap());
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.GET);
CacheOperationContext opCtx = ctx.operationContextPerCall();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
index 6e2768c..11d7898 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java
@@ -118,13 +118,6 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda
public abstract GridDhtCacheAdapter<K, V> dht();
/** {@inheritDoc} */
- @Override public void forceKeyCheck() {
- super.forceKeyCheck();
-
- dht().forceKeyCheck();
- }
-
- /** {@inheritDoc} */
@Override public void onReconnected() {
map = new GridCacheLocalConcurrentMap(
ctx,
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
index 7fe969f..bb41ac2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
@@ -130,9 +130,6 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K, V>
if (F.isEmpty(keys))
return new GridFinishedFuture<>(Collections.<K, V>emptyMap());
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.GET);
GridNearTxLocal tx = ctx.tm().threadLocalTx(ctx);
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index cde847b..982e296 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -388,9 +388,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
Map<K, V> vals = U.newHashMap(keys.size());
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.GET);
final IgniteCacheExpiryPolicy expiry = expiryPolicy(opCtx != null ? opCtx.expiry() : null);
@@ -575,9 +572,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
Object... args) throws IgniteCheckedException {
A.notNull(keys, "keys", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -620,9 +614,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
Object... args) throws EntryProcessorException {
A.notNull(key, "key", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKey(key);
-
final boolean statsEnabled = ctx.statisticsEnabled();
final long start = statsEnabled ? System.nanoTime() : 0L;
@@ -664,9 +655,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
Object... args) {
A.notNull(keys, "keys", entryProcessor, "entryProcessor");
- if (keyCheck)
- validateCacheKeys(keys);
-
warnIfUnordered(keys, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -698,9 +686,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
Object... args) throws IgniteCheckedException {
A.notNull(map, "map");
- if (keyCheck)
- validateCacheKeys(map.keySet());
-
warnIfUnordered(map, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
@@ -735,9 +720,6 @@ public class GridLocalAtomicCache<K, V> extends GridLocalCache<K, V> {
Object... args) {
A.notNull(map, "map");
- if (keyCheck)
- validateCacheKeys(map.keySet());
-
warnIfUnordered(map, BulkOperation.INVOKE);
final boolean statsEnabled = ctx.statisticsEnabled();
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckNearEnabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckNearEnabledSelfTest.java
deleted file mode 100644
index c735129..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckNearEnabledSelfTest.java
+++ /dev/null
@@ -1,30 +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;
-
-import org.apache.ignite.configuration.NearCacheConfiguration;
-
-/**
- * Tests for key check for near cache.
- */
-public class GridCacheKeyCheckNearEnabledSelfTest extends GridCacheKeyCheckSelfTest {
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return new NearCacheConfiguration();
- }
-}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java
deleted file mode 100644
index cbabcd5..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java
+++ /dev/null
@@ -1,209 +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;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.junit.Test;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
-
-/**
- * Tests for cache key check.
- */
-public class GridCacheKeyCheckSelfTest extends GridCacheAbstractSelfTest {
- /** Atomicity mode. */
- private CacheAtomicityMode atomicityMode;
-
- /** {@inheritDoc} */
- @Override protected int gridCount() {
- return 2;
- }
-
- /** {@inheritDoc} */
- @Override protected NearCacheConfiguration nearConfiguration() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setCacheConfiguration(cacheConfiguration());
-
- return cfg;
- }
-
- /**
- * @return Cache configuration.
- */
- protected CacheConfiguration cacheConfiguration() {
- CacheConfiguration cfg = defaultCacheConfiguration();
-
- cfg.setCacheMode(PARTITIONED);
- cfg.setBackups(1);
- cfg.setNearConfiguration(nearConfiguration());
- cfg.setWriteSynchronizationMode(FULL_SYNC);
- cfg.setAtomicityMode(atomicityMode);
-
- return cfg;
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGetTransactional() throws Exception {
- checkGet(TRANSACTIONAL);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testGetAtomic() throws Exception {
- checkGet(ATOMIC);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testPutTransactional() throws Exception {
- checkPut(TRANSACTIONAL);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testPutAtomic() throws Exception {
- checkPut(ATOMIC);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRemoveTransactional() throws Exception {
- checkRemove(TRANSACTIONAL);
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRemoveAtomic() throws Exception {
- checkRemove(ATOMIC);
- }
-
- /**
- * @throws Exception If failed.
- */
- private void checkGet(CacheAtomicityMode atomicityMode) throws Exception {
- this.atomicityMode = atomicityMode;
-
- try {
- IgniteCache<IncorrectCacheKey, String> cache = cache();
-
- cache.get(new IncorrectCacheKey(0));
-
- fail("Key without hashCode()/equals() was successfully retrieved from cache.");
- }
- catch (IllegalArgumentException e) {
- info("Catched expected exception: " + e.getMessage());
-
- assertTrue(e.getMessage().startsWith("Cache key must override hashCode() and equals() methods"));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- private void checkPut(CacheAtomicityMode atomicityMode) throws Exception {
- this.atomicityMode = atomicityMode;
-
- try {
- IgniteCache<IncorrectCacheKey, String> cache = cache();
-
- cache.put(new IncorrectCacheKey(0), "test_value");
-
- fail("Key without hashCode()/equals() was successfully inserted to cache.");
- }
- catch (IllegalArgumentException e) {
- info("Catched expected exception: " + e.getMessage());
-
- assertTrue(e.getMessage().startsWith("Cache key must override hashCode() and equals() methods"));
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- private void checkRemove(CacheAtomicityMode atomicityMode) throws Exception {
- this.atomicityMode = atomicityMode;
-
- try {
- IgniteCache<IncorrectCacheKey, String> cache = cache();
-
- cache.remove(new IncorrectCacheKey(0));
-
- fail("Key without hashCode()/equals() was successfully used for remove operation.");
- }
- catch (IllegalArgumentException e) {
- info("Catched expected exception: " + e.getMessage());
-
- assertTrue(e.getMessage().startsWith("Cache key must override hashCode() and equals() methods"));
- }
- }
-
- /** */
- private IgniteCache<IncorrectCacheKey, String> cache() {
- grid(0).context().cache().internalCache(DEFAULT_CACHE_NAME).forceKeyCheck();
-
- return grid(0).cache(DEFAULT_CACHE_NAME);
- }
-
- /**
- * Cache key that doesn't override hashCode()/equals().
- */
- private static final class IncorrectCacheKey {
- /** */
- private int someVal;
-
- /**
- * @param someVal Some test value.
- */
- private IncorrectCacheKey(int someVal) {
- this.someVal = someVal;
- }
-
- /**
- * @return Test value.
- */
- public int getSomeVal() {
- return someVal;
- }
- }
-}
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
deleted file mode 100644
index c51c73b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheUtilsSelfTest.java
+++ /dev/null
@@ -1,199 +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;
-
-import java.util.concurrent.Callable;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.binary.BinaryCachingMetadataHandler;
-import org.apache.ignite.internal.binary.BinaryContext;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.internal.binary.BinaryObjectImpl;
-import org.apache.ignite.internal.binary.GridBinaryMarshaller;
-import org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.internal.util.typedef.internal.CU;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.logger.NullLogger;
-import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Test;
-
-/**
- * Grid cache utils test.
- */
-public class GridCacheUtilsSelfTest extends GridCommonAbstractTest {
- /**
- * Does not override equals and hashCode.
- */
- private static class NoEqualsAndHashCode {
- }
-
- /**
- * Does not override equals.
- */
- private static class NoEquals {
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return 1;
- }
- }
-
- /**
- * Does not override hashCode.
- */
- private static class NoHashCode {
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return super.equals(obj);
- }
- }
-
- /**
- * Defines equals with different signature.
- */
- private static class WrongEquals {
- /**
- * @param obj Object.
- * @return {@code False}.
- */
- @Override public boolean equals(Object obj) {
- return false;
- }
- }
-
- /**
- * Overrides equals and hashCode.
- */
- private static class EqualsAndHashCode {
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return super.hashCode();
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return super.equals(obj);
- }
- }
-
- /**
- * Extends class which overrides equals and hashCode.
- */
- private static class ExtendsClassWithEqualsAndHashCode extends EqualsAndHashCode {
- }
-
- /**
- * Extends class which overrides equals and hashCode, overrides equals and hashCode.
- */
- private static class ExtendsClassWithEqualsAndHashCode2 extends EqualsAndHashCode {
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return super.hashCode();
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object obj) {
- return super.equals(obj);
- }
- }
-
- /**
- */
- @Test
- public void testCacheKeyValidation() throws IgniteCheckedException {
- CU.validateCacheKey("key");
-
- CU.validateCacheKey(1);
-
- CU.validateCacheKey(1L);
-
- CU.validateCacheKey(1.0);
-
- CU.validateCacheKey(new ExtendsClassWithEqualsAndHashCode());
-
- CU.validateCacheKey(new ExtendsClassWithEqualsAndHashCode2());
-
- assertThrowsForInvalidKey(new NoEqualsAndHashCode());
-
- assertThrowsForInvalidKey(new NoEquals());
-
- assertThrowsForInvalidKey(new NoHashCode());
-
- assertThrowsForInvalidKey(new WrongEquals());
-
- BinaryObjectBuilderImpl binBuilder = new BinaryObjectBuilderImpl(binaryContext(),
- EqualsAndHashCode.class.getName());
-
- BinaryObject binObj = binBuilder.build();
-
- CU.validateCacheKey(binObj);
-
- BinaryObjectBuilderImpl binBuilder2 = new BinaryObjectBuilderImpl((BinaryObjectImpl) binObj);
-
- CU.validateCacheKey(binBuilder2.build());
- }
-
- /**
- * @return Binary marshaller.
- * @throws IgniteCheckedException if failed.
- */
- private BinaryMarshaller binaryMarshaller() throws IgniteCheckedException {
- IgniteConfiguration iCfg = new IgniteConfiguration();
-
- BinaryConfiguration bCfg = new BinaryConfiguration();
-
- iCfg.setBinaryConfiguration(bCfg);
-
- BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
-
- BinaryMarshaller marsh = new BinaryMarshaller();
-
- marsh.setContext(new MarshallerContextTestImpl(null));
-
- IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
-
- return marsh;
- }
-
- /**
- * @return Binary context.
- * @throws IgniteCheckedException if failed.
- */
- private BinaryContext binaryContext() throws IgniteCheckedException {
- GridBinaryMarshaller impl = U.field(binaryMarshaller(), "impl");
-
- return impl.context();
- }
-
- /**
- * @param key Cache key.
- */
- private void assertThrowsForInvalidKey(final Object key) {
- GridTestUtils.assertThrows(log, new Callable<Void>() {
- @Override public Void call() throws Exception {
- CU.validateCacheKey(key);
-
- return null;
- }
- }, IllegalArgumentException.class, null);
- }
-}
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index f89759a..b66ffaa 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -74,8 +74,6 @@ import org.apache.ignite.internal.processors.cache.GridCacheConcurrentMapSelfTes
import org.apache.ignite.internal.processors.cache.GridCacheConfigurationConsistencySelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheConfigurationValidationSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheEntryMemorySizeSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheKeyCheckNearEnabledSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheKeyCheckSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheLeakTest;
import org.apache.ignite.internal.processors.cache.GridCacheLifecycleAwareSelfTest;
import org.apache.ignite.internal.processors.cache.GridCacheLocalTxStoreExceptionSelfTest;
@@ -371,9 +369,6 @@ public class IgniteCacheTestSuite {
GridTestUtils.addTestIfNeeded(suite, GridCacheClearLocallySelfTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridCacheConcurrentGetCacheOnClientTest.class, ignoredTests);
- GridTestUtils.addTestIfNeeded(suite, GridCacheKeyCheckNearEnabledSelfTest.class, ignoredTests);
- GridTestUtils.addTestIfNeeded(suite, GridCacheKeyCheckSelfTest.class, ignoredTests);
-
GridTestUtils.addTestIfNeeded(suite, GridCacheLeakTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridCacheMvccFlagsTest.class, ignoredTests);
GridTestUtils.addTestIfNeeded(suite, GridCacheReturnValueTransferSelfTest.class, ignoredTests);
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
index 1e110b1..6e1dd3a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteUtilSelfTestSuite.java
@@ -19,7 +19,6 @@ package org.apache.ignite.testsuites;
import org.apache.ignite.internal.IgniteVersionUtilsSelfTest;
import org.apache.ignite.internal.pagemem.impl.PageIdUtilsSelfTest;
-import org.apache.ignite.internal.processors.cache.GridCacheUtilsSelfTest;
import org.apache.ignite.internal.util.BasicRateLimiterTest;
import org.apache.ignite.internal.util.DistributedProcessCoordinatorLeftTest;
import org.apache.ignite.internal.util.GridArraysSelfTest;
@@ -93,7 +92,6 @@ import org.junit.runners.Suite;
GridThreadTest.class,
GridIntListSelfTest.class,
GridArraysSelfTest.class,
- GridCacheUtilsSelfTest.class,
IgniteExceptionRegistrySelfTest.class,
GridMessageCollectionTest.class,
WorkersControlMXBeanTest.class,