Repository: incubator-ignite
Updated Branches:
  refs/heads/sprint-1 bdb5ded04 -> 671d1447b


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/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 f2e564b..96dd3fc 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
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.*;
@@ -81,9 +80,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
     /** Transaction. */
     private IgniteTxLocalEx<K, V> tx;
 
-    /** Filters. */
-    private IgnitePredicate<CacheEntry<K, V>>[] filters;
-
     /** Logger. */
     private IgniteLogger log;
 
@@ -120,7 +116,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
      * @param forcePrimary If {@code true} get will be performed on primary 
node even if
      *      called on backup node.
      * @param tx Transaction.
-     * @param filters Filters.
      * @param subjId Subject ID.
      * @param taskName Task name.
      * @param deserializePortable Deserialize portable flag.
@@ -133,7 +128,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
         boolean reload,
         boolean forcePrimary,
         @Nullable IgniteTxLocalEx<K, V> tx,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filters,
         @Nullable UUID subjId,
         String taskName,
         boolean deserializePortable,
@@ -148,7 +142,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
         this.readThrough = readThrough;
         this.reload = reload;
         this.forcePrimary = forcePrimary;
-        this.filters = filters;
         this.tx = tx;
         this.subjId = subjId;
         this.taskName = taskName;
@@ -325,7 +318,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
                         subjId,
                         taskName == null ? 0 : taskName.hashCode(),
                         deserializePortable,
-                        filters,
                         expiryPlc);
 
                 final Collection<Integer> invalidParts = 
fut.invalidPartitions();
@@ -382,7 +374,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
                     readThrough,
                     reload,
                     topVer,
-                    filters,
                     subjId,
                     taskName == null ? 0 : taskName.hashCode(),
                     expiryPlc != null ? expiryPlc.forAccess() : -1L);
@@ -439,7 +430,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
                         subjId,
                         null,
                         taskName,
-                        filters,
                         expiryPlc);
 
                 ClusterNode primary = null;
@@ -465,7 +455,6 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
                                 subjId,
                                 null,
                                 taskName,
-                                filters,
                                 expiryPlc);
 
                             // Entry was not in memory or in swap, so we 
remove it from cache.
@@ -528,7 +517,7 @@ public final class GridNearGetFuture<K, V> extends 
GridCompoundIdentityFuture<Ma
                     // Don't add reader if transaction acquires lock anyway to 
avoid deadlock.
                     boolean addRdr = tx == null || tx.optimistic();
 
-                    if (!addRdr && tx.readCommitted() && 
!tx.writeSet().contains(key))
+                    if (!addRdr && tx.readCommitted() && 
!tx.writeSet().contains(cctx.txKey(key)))
                         addRdr = true;
 
                     LinkedHashMap<K, Boolean> old = mappings.get(primary);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
index 966b952..cee13c2 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetRequest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.lang.*;
@@ -64,16 +63,9 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
     @GridDirectMap(keyType = byte[].class, valueType = boolean.class)
     private LinkedHashMap<byte[], Boolean> keyBytes;
 
-    /** Filter bytes. */
-    private byte[][] filterBytes;
-
     /** Topology version. */
     private long topVer;
 
-    /** Filters. */
-    @GridDirectTransient
-    private IgnitePredicate<CacheEntry<K, V>>[] filter;
-
     /** Subject ID. */
     @GridDirectVersion(1)
     private UUID subjId;
@@ -101,7 +93,6 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
      * @param readThrough Read through flag.
      * @param reload Reload flag.
      * @param topVer Topology version.
-     * @param filter Filter.
      * @param subjId Subject ID.
      * @param taskNameHash Task name hash.
      * @param accessTtl New TTL to set after entry is accessed, -1 to leave 
unchanged.
@@ -115,7 +106,6 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
         boolean readThrough,
         boolean reload,
         long topVer,
-        IgnitePredicate<CacheEntry<K, V>>[] filter,
         UUID subjId,
         int taskNameHash,
         long accessTtl
@@ -133,7 +123,6 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
         this.readThrough = readThrough;
         this.reload = reload;
         this.topVer = topVer;
-        this.filter = filter;
         this.subjId = subjId;
         this.taskNameHash = taskNameHash;
         this.accessTtl = accessTtl;
@@ -203,13 +192,6 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
     }
 
     /**
-     * @return Filters.
-     */
-    public IgnitePredicate<CacheEntry<K, V>>[] filter() {
-        return filter;
-    }
-
-    /**
      * @return New TTL to set after entry is accessed, -1 to leave unchanged.
      */
     public long accessTtl() {
@@ -228,9 +210,6 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
         if (keyBytes == null)
             keyBytes = marshalBooleanLinkedMap(keys, ctx);
-
-        if (filterBytes == null)
-            filterBytes = marshalFilter(filter, ctx);
     }
 
     /**
@@ -243,9 +222,6 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
         if (keys == null)
             keys = unmarshalBooleanLinkedMap(keyBytes, ctx, ldr);
-
-        if (filter == null && filterBytes != null)
-            filter = unmarshalFilter(filterBytes, ctx, ldr);
     }
 
     /** {@inheritDoc} */
@@ -271,9 +247,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
         _clone.reload = reload;
         _clone.readThrough = readThrough;
         _clone.keyBytes = keyBytes;
-        _clone.filterBytes = filterBytes;
         _clone.topVer = topVer;
-        _clone.filter = filter;
         _clone.subjId = subjId;
         _clone.taskNameHash = taskNameHash;
         _clone.accessTtl = accessTtl;
@@ -302,39 +276,12 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
                 commState.idx++;
 
             case 4:
-                if (filterBytes != null) {
-                    if (commState.it == null) {
-                        if (!commState.putInt(filterBytes.length))
-                            return false;
-
-                        commState.it = arrayIterator(filterBytes);
-                    }
-
-                    while (commState.it.hasNext() || commState.cur != NULL) {
-                        if (commState.cur == NULL)
-                            commState.cur = commState.it.next();
-
-                        if (!commState.putByteArray((byte[])commState.cur))
-                            return false;
-
-                        commState.cur = NULL;
-                    }
-
-                    commState.it = null;
-                } else {
-                    if (!commState.putInt(-1))
-                        return false;
-                }
-
-                commState.idx++;
-
-            case 5:
                 if (!commState.putGridUuid(futId))
                     return false;
 
                 commState.idx++;
 
-            case 6:
+            case 5:
                 if (keyBytes != null) {
                     if (commState.it == null) {
                         if (!commState.putInt(keyBytes.size()))
@@ -372,43 +319,43 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 7:
+            case 6:
                 if (!commState.putGridUuid(miniId))
                     return false;
 
                 commState.idx++;
 
-            case 8:
+            case 7:
                 if (!commState.putBoolean(readThrough))
                     return false;
 
                 commState.idx++;
 
-            case 9:
+            case 8:
                 if (!commState.putBoolean(reload))
                     return false;
 
                 commState.idx++;
 
-            case 10:
+            case 9:
                 if (!commState.putLong(topVer))
                     return false;
 
                 commState.idx++;
 
-            case 11:
+            case 10:
                 if (!commState.putCacheVersion(ver))
                     return false;
 
                 commState.idx++;
 
-            case 12:
+            case 11:
                 if (!commState.putUuid(subjId))
                     return false;
 
                 commState.idx++;
 
-            case 13:
+            case 12:
                 if (!commState.putInt(taskNameHash))
                     return false;
 
@@ -437,35 +384,6 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
                 commState.idx++;
 
             case 4:
-                if (commState.readSize == -1) {
-                    if (buf.remaining() < 4)
-                        return false;
-
-                    commState.readSize = commState.getInt();
-                }
-
-                if (commState.readSize >= 0) {
-                    if (filterBytes == null)
-                        filterBytes = new byte[commState.readSize][];
-
-                    for (int i = commState.readItems; i < commState.readSize; 
i++) {
-                        byte[] _val = commState.getByteArray();
-
-                        if (_val == BYTE_ARR_NOT_READ)
-                            return false;
-
-                        filterBytes[i] = (byte[])_val;
-
-                        commState.readItems++;
-                    }
-                }
-
-                commState.readSize = -1;
-                commState.readItems = 0;
-
-                commState.idx++;
-
-            case 5:
                 IgniteUuid futId0 = commState.getGridUuid();
 
                 if (futId0 == GRID_UUID_NOT_READ)
@@ -475,7 +393,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 6:
+            case 5:
                 if (commState.readSize == -1) {
                     if (buf.remaining() < 4)
                         return false;
@@ -517,7 +435,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 7:
+            case 6:
                 IgniteUuid miniId0 = commState.getGridUuid();
 
                 if (miniId0 == GRID_UUID_NOT_READ)
@@ -527,7 +445,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 8:
+            case 7:
                 if (buf.remaining() < 1)
                     return false;
 
@@ -535,7 +453,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 9:
+            case 8:
                 if (buf.remaining() < 1)
                     return false;
 
@@ -543,7 +461,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 10:
+            case 9:
                 if (buf.remaining() < 8)
                     return false;
 
@@ -551,7 +469,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 11:
+            case 10:
                 GridCacheVersion ver0 = commState.getCacheVersion();
 
                 if (ver0 == CACHE_VER_NOT_READ)
@@ -561,7 +479,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 12:
+            case 11:
                 UUID subjId0 = commState.getUuid();
 
                 if (subjId0 == UUID_NOT_READ)
@@ -571,7 +489,7 @@ public class GridNearGetRequest<K, V> extends 
GridCacheMessage<K, V> implements
 
                 commState.idx++;
 
-            case 13:
+            case 12:
                 if (buf.remaining() < 4)
                     return false;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
----------------------------------------------------------------------
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 9942e68..418906d 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
@@ -99,8 +99,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
         @Nullable final GridCacheEntryEx<K, V> entry,
         @Nullable UUID subjId,
         String taskName,
-        final boolean deserializePortable,
-        @Nullable final IgnitePredicate<CacheEntry<K, V>>[] filter
+        final boolean deserializePortable
     ) {
         ctx.denyOnFlag(LOCAL);
         ctx.checkSecurity(GridSecurityPermission.CACHE_READ);
@@ -113,7 +112,7 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
         if (tx != null && !tx.implicit() && !skipTx) {
             return asyncOp(tx, new AsyncOp<Map<K, V>>(keys) {
                 @Override public IgniteFuture<Map<K, V>> 
op(IgniteTxLocalAdapter<K, V> tx) {
-                    return ctx.wrapCloneMap(tx.getAllAsync(ctx, keys, entry, 
deserializePortable, filter));
+                    return ctx.wrapCloneMap(tx.getAllAsync(ctx, keys, entry, 
deserializePortable));
                 }
             });
         }
@@ -126,7 +125,6 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
             keys,
             false,
             forcePrimary,
-            filter,
             subjId,
             taskName,
             deserializePortable,
@@ -137,7 +135,6 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
      * @param tx Transaction.
      * @param keys Keys to load.
      * @param readThrough Read through flag.
-     * @param filter Filter.
      * @param deserializePortable Deserialize portable flag.
      * @param expiryPlc Expiry policy.
      * @return Future.
@@ -145,7 +142,6 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
     IgniteFuture<Map<K, V>> txLoadAsync(GridNearTxLocal<K, V> tx,
         @Nullable Collection<? extends K> keys,
         boolean readThrough,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter,
         boolean deserializePortable,
         @Nullable IgniteCacheExpiryPolicy expiryPlc) {
         assert tx != null;
@@ -156,7 +152,6 @@ public class GridNearTransactionalCache<K, V> extends 
GridNearCacheAdapter<K, V>
             false,
             false,
             tx,
-            filter,
             CU.subjectId(tx, ctx.shared()),
             tx.resolveTaskName(),
             deserializePortable,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index f790bee..e9fefd0 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -289,7 +289,6 @@ public class GridNearTxLocal<K, V> extends 
GridDhtTxLocalAdapter<K, V> {
             return cacheCtx.nearTx().txLoadAsync(this,
                 keys,
                 readThrough,
-                CU.<K, V>empty(),
                 deserializePortable,
                 accessPolicy(cacheCtx, keys)).chain(new C1<IgniteFuture<Map<K, 
V>>, Boolean>() {
                 @Override public Boolean apply(IgniteFuture<Map<K, V>> f) {
@@ -320,7 +319,6 @@ public class GridNearTxLocal<K, V> extends 
GridDhtTxLocalAdapter<K, V> {
                 CU.subjectId(this, cctx),
                 resolveTaskName(),
                 deserializePortable,
-                null,
                 accessPolicy(cacheCtx, keys)).chain(new C1<IgniteFuture<Map<K, 
V>>, Boolean>() {
                     @Override public Boolean apply(IgniteFuture<Map<K, V>> f) {
                         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
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 f7d0e0a..f45f0a1 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
@@ -466,14 +466,12 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
     /** {@inheritDoc} */
 
     @SuppressWarnings("unchecked")
-    @Override @Nullable public V get(K key, boolean deserializePortable,
-        @Nullable IgnitePredicate<CacheEntry<K, V>> filter) throws 
IgniteCheckedException {
+    @Override @Nullable public V get(K key, boolean deserializePortable) 
throws IgniteCheckedException {
         ctx.denyOnFlag(LOCAL);
 
         String taskName = ctx.kernalContext().job().currentTaskName();
 
         Map<K, V> m = getAllInternal(Collections.singleton(key),
-            filter != null ? new IgnitePredicate[]{filter} : null,
             ctx.isSwapOrOffheapEnabled(),
             ctx.readThrough(),
             ctx.hasFlag(CLONE),
@@ -485,15 +483,13 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public final Map<K, V> getAll(Collection<? extends K> keys, 
boolean deserializePortable,
-        IgnitePredicate<CacheEntry<K, V>> filter)
+    @Override public final Map<K, V> getAll(Collection<? extends K> keys, 
boolean deserializePortable)
         throws IgniteCheckedException {
         ctx.denyOnFlag(LOCAL);
 
         String taskName = ctx.kernalContext().job().currentTaskName();
 
         return getAllInternal(keys,
-            filter != null ? new IgnitePredicate[]{filter} : null,
             ctx.isSwapOrOffheapEnabled(),
             ctx.readThrough(),
             ctx.hasFlag(CLONE),
@@ -511,8 +507,7 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
         @Nullable final GridCacheEntryEx<K, V> entry,
         @Nullable UUID subjId,
         final String taskName,
-        final boolean deserializePortable,
-        @Nullable final IgnitePredicate<CacheEntry<K, V>>[] filter
+        final boolean deserializePortable
     ) {
         ctx.denyOnFlag(LOCAL);
 
@@ -522,7 +517,7 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
 
         return asyncOp(new Callable<Map<K, V>>() {
             @Override public Map<K, V> call() throws Exception {
-                return getAllInternal(keys, filter, swapOrOffheap, 
storeEnabled, clone, taskName, deserializePortable);
+                return getAllInternal(keys, swapOrOffheap, storeEnabled, 
clone, taskName, deserializePortable);
             }
         });
     }
@@ -531,7 +526,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
      * Entry point to all public API get methods.
      *
      * @param keys Keys to remove.
-     * @param filter Filter.
      * @param swapOrOffheap {@code True} if swap of off-heap storage are 
enabled.
      * @param storeEnabled Store enabled flag.
      * @param clone {@code True} if returned values should be cloned.
@@ -542,7 +536,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
      */
     @SuppressWarnings("ConstantConditions")
     private Map<K, V> getAllInternal(@Nullable Collection<? extends K> keys,
-        @Nullable IgnitePredicate<CacheEntry<K, V>>[] filter,
         boolean swapOrOffheap,
         boolean storeEnabled,
         boolean clone,
@@ -593,7 +586,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
                             subjId,
                             null,
                             taskName,
-                            filter,
                             expiry);
 
                         if (v != null)
@@ -639,7 +631,7 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
             return map;
         }
 
-        return getAllAsync(keys, true, null, false, subjId, taskName, 
deserializePortable, false, expiry, filter).get();
+        return getAllAsync(keys, true, null, false, subjId, taskName, 
deserializePortable, false, expiry).get();
     }
 
     /** {@inheritDoc} */
@@ -980,7 +972,7 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
      * @param filter Optional filter.
      * @param subjId Subject ID.
      * @param taskName Task name.
-     * @throws 
org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException 
If update failed.
+     * @throws CachePartialUpdateCheckedException If update failed.
      * @return Results map for invoke operation.
      */
     @SuppressWarnings({"ForLoopReplaceableByForEach", "unchecked"})
@@ -1056,7 +1048,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
                             subjId,
                             entryProcessor,
                             taskName,
-                            CU.<K, V>empty(),
                             null);
 
                         CacheInvokeEntry<K, V> invokeEntry = new 
CacheInvokeEntry<>(entry.key(), old);
@@ -1157,7 +1148,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
                                 subjId,
                                 null,
                                 taskName,
-                                CU.<K, V>empty(),
                                 null);
 
                             val = 
ctx.config().getInterceptor().onBeforePut(entry.key(), old, val);
@@ -1188,7 +1178,6 @@ public class GridLocalAtomicCache<K, V> extends 
GridCacheAdapter<K, V> {
                                 subjId,
                                 null,
                                 taskName,
-                                CU.<K, V>empty(),
                                 null);
 
                             IgniteBiTuple<Boolean, ?> interceptorRes = 
ctx.config().getInterceptor().onBeforeRemove(

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index b14d45d..3ca44b7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1206,7 +1206,6 @@ public abstract class IgniteTxAdapter<K, V> extends 
GridMetadataAwareAdapter
                         /*subjId*/subjId,
                         /**closure name */recordEvt ? 
F.first(txEntry.entryProcessors()).get1() : null,
                         resolveTaskName(),
-                        CU.<K, V>empty(),
                         null);
 
                 boolean modified = false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 0ff9627..54e778e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -804,10 +804,10 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                                                 resolveTaskName());
                                     }
                                     else if (op == RELOAD) {
-                                        cached.innerReload(CU.<K, V>empty());
+                                        cached.innerReload();
 
                                         if (nearCached != null)
-                                            nearCached.innerReload(CU.<K, 
V>empty());
+                                            nearCached.innerReload();
                                     }
                                     else if (op == READ) {
                                         ExpiryPolicy expiry = txEntry.expiry();
@@ -1025,7 +1025,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
 
     /**
      * Checks if there is a cached or swapped value for
-     * {@link #getAllAsync(GridCacheContext, Collection, GridCacheEntryEx, 
boolean, IgnitePredicate[])} method.
+     * {@link #getAllAsync(GridCacheContext, Collection, GridCacheEntryEx, 
boolean)} method.
      *
      * @param cacheCtx Cache context.
      * @param keys Key to enlist.
@@ -1035,7 +1035,6 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
      * @param missed Map of missed keys.
      * @param keysCnt Keys count (to avoid call to {@code Collection.size()}).
      * @param deserializePortable Deserialize portable flag.
-     * @param filter Filter to test.
      * @throws IgniteCheckedException If failed.
      * @return Enlisted keys.
      */
@@ -1048,8 +1047,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
         Map<K, V> map,
         Map<K, GridCacheVersion> missed,
         int keysCnt,
-        boolean deserializePortable,
-        IgnitePredicate<CacheEntry<K, V>>[] filter) throws 
IgniteCheckedException {
+        boolean deserializePortable) throws IgniteCheckedException {
         assert !F.isEmpty(keys);
         assert keysCnt == keys.size();
         assert cached == null || F.first(keys).equals(cached.key());
@@ -1081,75 +1079,72 @@ public abstract class IgniteTxLocalAdapter<K, V> 
extends IgniteTxAdapter<K, V>
 
             // Either non-read-committed or there was a previous write.
             if (txEntry != null) {
-                if (cacheCtx.isAll(txEntry.cached(), filter)) {
-                    V val = txEntry.value();
+                V val = txEntry.value();
 
-                    // Read value from locked entry in group-lock transaction 
as well.
-                    if (txEntry.hasValue()) {
-                        if (!F.isEmpty(txEntry.entryProcessors()))
-                            val = txEntry.applyEntryProcessors(val);
+                // Read value from locked entry in group-lock transaction as 
well.
+                if (txEntry.hasValue()) {
+                    if (!F.isEmpty(txEntry.entryProcessors()))
+                        val = txEntry.applyEntryProcessors(val);
 
-                        if (val != null) {
-                            V val0 = val;
+                    if (val != null) {
+                        V val0 = val;
 
-                            if (cacheCtx.portableEnabled())
-                                val0 = (V)cacheCtx.unwrapPortableIfNeeded(val, 
!deserializePortable);
+                        if (cacheCtx.portableEnabled())
+                            val0 = (V)cacheCtx.unwrapPortableIfNeeded(val, 
!deserializePortable);
 
-                            map.put(key, val0);
-                        }
+                        map.put(key, val0);
                     }
-                    else {
-                        assert txEntry.op() == TRANSFORM || (groupLock() && 
!txEntry.groupLockEntry());
+                }
+                else {
+                    assert txEntry.op() == TRANSFORM || (groupLock() && 
!txEntry.groupLockEntry());
 
-                        while (true) {
-                            try {
-                                Object transformClo =
-                                    (txEntry.op() == TRANSFORM  && 
cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_READ)) ?
-                                        F.first(txEntry.entryProcessors()) : 
null;
-
-                                val = txEntry.cached().innerGet(this,
-                                    /*swap*/true,
-                                    /*read-through*/false,
-                                    /*fail fast*/true,
-                                    /*unmarshal*/true,
-                                    /*metrics*/true,
-                                    /*event*/true,
-                                    /*temporary*/false,
-                                    CU.subjectId(this, cctx),
-                                    transformClo,
-                                    resolveTaskName(),
-                                    filter,
-                                    null);
-
-                                if (val != null) {
-                                    if (!readCommitted())
-                                        txEntry.readValue(val);
+                    while (true) {
+                        try {
+                            Object transformClo =
+                                (txEntry.op() == TRANSFORM  && 
cctx.gridEvents().isRecordable(EVT_CACHE_OBJECT_READ)) ?
+                                    F.first(txEntry.entryProcessors()) : null;
 
-                                    if (!F.isEmpty(txEntry.entryProcessors()))
-                                        val = 
txEntry.applyEntryProcessors(val);
+                            val = txEntry.cached().innerGet(this,
+                                /*swap*/true,
+                                /*read-through*/false,
+                                /*fail fast*/true,
+                                /*unmarshal*/true,
+                                /*metrics*/true,
+                                /*event*/true,
+                                /*temporary*/false,
+                                CU.subjectId(this, cctx),
+                                transformClo,
+                                resolveTaskName(),
+                                null);
 
-                                    V val0 = val;
+                            if (val != null) {
+                                if (!readCommitted())
+                                    txEntry.readValue(val);
 
-                                    if (cacheCtx.portableEnabled())
-                                        val0 = 
(V)cacheCtx.unwrapPortableIfNeeded(val, !deserializePortable);
+                                if (!F.isEmpty(txEntry.entryProcessors()))
+                                    val = txEntry.applyEntryProcessors(val);
 
-                                    map.put(key, val0);
-                                }
-                                else
-                                    missed.put(key, 
txEntry.cached().version());
+                                V val0 = val;
 
-                                break;
-                            }
-                            catch (GridCacheFilterFailedException e) {
-                                if (log.isDebugEnabled())
-                                    log.debug("Filter validation failed for 
entry: " + txEntry);
+                                if (cacheCtx.portableEnabled())
+                                    val0 = 
(V)cacheCtx.unwrapPortableIfNeeded(val, !deserializePortable);
 
-                                if (!readCommitted())
-                                    txEntry.readValue(e.<V>value());
-                            }
-                            catch (GridCacheEntryRemovedException ignored) {
-                                txEntry.cached(entryEx(cacheCtx, 
txEntry.txKey(), topVer), txEntry.keyBytes());
+                                map.put(key, val0);
                             }
+                            else
+                                missed.put(key, txEntry.cached().version());
+
+                            break;
+                        }
+                        catch (GridCacheFilterFailedException e) {
+                            if (log.isDebugEnabled())
+                                log.debug("Filter validation failed for entry: 
" + txEntry);
+
+                            if (!readCommitted())
+                                txEntry.readValue(e.<V>value());
+                        }
+                        catch (GridCacheEntryRemovedException ignored) {
+                            txEntry.cached(entryEx(cacheCtx, txEntry.txKey(), 
topVer), txEntry.keyBytes());
                         }
                     }
                 }
@@ -1194,7 +1189,6 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                                 CU.subjectId(this, cctx),
                                 null,
                                 resolveTaskName(),
-                                filter,
                                 accessPlc);
 
                             if (val != null) {
@@ -1219,7 +1213,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                                 null,
                                 entry,
                                 expiryPlc,
-                                filter,
+                                null,
                                 true,
                                 -1L,
                                 -1L,
@@ -1307,14 +1301,13 @@ public abstract class IgniteTxLocalAdapter<K, V> 
extends IgniteTxAdapter<K, V>
 
     /**
      * Loads all missed keys for
-     * {@link #getAllAsync(GridCacheContext, Collection, GridCacheEntryEx, 
boolean, IgnitePredicate[])} method.
+     * {@link #getAllAsync(GridCacheContext, Collection, GridCacheEntryEx, 
boolean)} method.
      *
      * @param cacheCtx Cache context.
      * @param map Return map.
      * @param missedMap Missed keys.
      * @param redos Keys to retry.
      * @param deserializePortable Deserialize portable flag.
-     * @param filter Filter.
      * @return Loaded key-value pairs.
      */
     private IgniteFuture<Map<K, V>> checkMissed(
@@ -1322,8 +1315,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
         final Map<K, V> map,
         final Map<K, GridCacheVersion> missedMap,
         @Nullable final Collection<K> redos,
-        final boolean deserializePortable,
-        final IgnitePredicate<CacheEntry<K, V>>[] filter
+        final boolean deserializePortable
     ) {
         assert redos != null || pessimistic();
 
@@ -1386,36 +1378,32 @@ public abstract class IgniteTxLocalAdapter<K, V> 
extends IgniteTxAdapter<K, V>
                         GridCacheEntryEx<K, V> e = txEntry == null ? 
entryEx(cacheCtx, txKey) : txEntry.cached();
 
                         try {
-                            boolean pass = cacheCtx.isAll(e, filter);
-
                             // Must initialize to true since even if filter 
didn't pass,
                             // we still record the transaction value.
-                            boolean set = true;
+                            boolean set;
 
-                            if (pass) {
-                                try {
-                                    set = e.versionedValue(val, ver, nextVer);
-                                }
-                                catch (GridCacheEntryRemovedException ignore) {
-                                    if (log.isDebugEnabled())
-                                        log.debug("Got removed entry in 
transaction getAll method " +
-                                            "(will try again): " + e);
+                            try {
+                                set = e.versionedValue(val, ver, nextVer);
+                            }
+                            catch (GridCacheEntryRemovedException ignore) {
+                                if (log.isDebugEnabled())
+                                    log.debug("Got removed entry in 
transaction getAll method " +
+                                        "(will try again): " + e);
 
-                                    if (pessimistic() && !readCommitted() && 
!isRollbackOnly() &&
-                                        (!groupLock() || F.eq(e.key(), 
groupLockKey()))) {
-                                        U.error(log, "Inconsistent transaction 
state (entry got removed while " +
-                                            "holding lock) [entry=" + e + ", 
tx=" + IgniteTxLocalAdapter.this + "]");
+                                if (pessimistic() && !readCommitted() && 
!isRollbackOnly() &&
+                                    (!groupLock() || F.eq(e.key(), 
groupLockKey()))) {
+                                    U.error(log, "Inconsistent transaction 
state (entry got removed while " +
+                                        "holding lock) [entry=" + e + ", tx=" 
+ IgniteTxLocalAdapter.this + "]");
 
-                                        setRollbackOnly();
+                                    setRollbackOnly();
 
-                                        return;
-                                    }
+                                    return;
+                                }
 
-                                    if (txEntry != null)
-                                        txEntry.cached(entryEx(cacheCtx, 
txKey), txEntry.keyBytes());
+                                if (txEntry != null)
+                                    txEntry.cached(entryEx(cacheCtx, txKey), 
txEntry.keyBytes());
 
-                                    continue; // While loop.
-                                }
+                                continue; // While loop.
                             }
 
                             // In pessimistic mode, we should always be able 
to set.
@@ -1424,27 +1412,16 @@ public abstract class IgniteTxLocalAdapter<K, V> 
extends IgniteTxAdapter<K, V>
                             if (readCommitted() || groupLock()) {
                                 cacheCtx.evicts().touch(e, topologyVersion());
 
-                                if (pass && visibleVal != null)
+                                if (visibleVal != null)
                                     map.put(key, visibleVal);
                             }
                             else {
                                 assert txEntry != null;
 
-                                if (set || F.isEmptyOrNulls(filter)) {
-                                    txEntry.setAndMarkValid(val);
+                                txEntry.setAndMarkValid(val);
 
-                                    if (pass && visibleVal != null)
-                                        map.put(key, visibleVal);
-                                }
-                                else {
-                                    assert !pessimistic() : "Pessimistic 
transaction should not have to redo gets: " +
-                                        this;
-
-                                    if (log.isDebugEnabled())
-                                        log.debug("Failed to set versioned 
value for entry (will redo): " + e);
-
-                                    redos.add(key);
-                                }
+                                if (visibleVal != null)
+                                    map.put(key, visibleVal);
                             }
 
                             loaded.add(key);
@@ -1506,8 +1483,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
         final GridCacheContext<K, V> cacheCtx,
         Collection<? extends K> keys,
         @Nullable GridCacheEntryEx<K, V> cached,
-        final boolean deserializePortable,
-        final IgnitePredicate<CacheEntry<K, V>>[] filter) {
+        final boolean deserializePortable) {
         if (F.isEmpty(keys))
             return new GridFinishedFuture<>(cctx.kernalContext(), 
Collections.<K, V>emptyMap());
 
@@ -1535,8 +1511,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                 retMap,
                 missed,
                 keysCnt,
-                deserializePortable,
-                filter);
+                deserializePortable);
 
             if (single && missed.isEmpty())
                 return new GridFinishedFuture<>(cctx.kernalContext(), retMap);
@@ -1596,7 +1571,6 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                                         
CU.subjectId(IgniteTxLocalAdapter.this, cctx),
                                         transformClo,
                                         resolveTaskName(),
-                                        filter,
                                         null);
 
                                     // If value is in cache and passed the 
filter.
@@ -1645,7 +1619,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                         }
 
                         if (!missed.isEmpty() && (cacheCtx.isReplicated() || 
cacheCtx.isLocal()))
-                            return checkMissed(cacheCtx, retMap, missed, null, 
deserializePortable, filter);
+                            return checkMissed(cacheCtx, retMap, missed, null, 
deserializePortable);
 
                         return new GridFinishedFuture<>(cctx.kernalContext(), 
Collections.<K, V>emptyMap());
                     }
@@ -1704,7 +1678,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                     return new GridEmbeddedFuture<>(
                         cctx.kernalContext(),
                         // First future.
-                        checkMissed(cacheCtx, retMap, missed, redos, 
deserializePortable, filter),
+                        checkMissed(cacheCtx, retMap, missed, redos, 
deserializePortable),
                         // Closure that returns another future, based on 
result from first.
                         new PMC<Map<K, V>>() {
                             @Override public IgniteFuture<Map<K, V>> 
postMiss(Map<K, V> map) {
@@ -1716,7 +1690,7 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                                     log.debug("Starting to future-recursively 
get values for keys: " + redos);
 
                                 // Future recursion.
-                                return getAllAsync(cacheCtx, redos, null, 
deserializePortable, filter);
+                                return getAllAsync(cacheCtx, redos, null, 
deserializePortable);
                             }
                         },
                         // Finalize.
@@ -1974,7 +1948,6 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                                         CU.subjectId(this, cctx),
                                         entryProcessor,
                                         resolveTaskName(),
-                                        CU.<K, V>empty(),
                                         null);
                                 }
                                 catch (GridCacheFilterFailedException e) {
@@ -2302,7 +2275,6 @@ public abstract class IgniteTxLocalAdapter<K, V> extends 
IgniteTxAdapter<K, V>
                                         CU.subjectId(this, cctx),
                                         null,
                                         resolveTaskName(),
-                                        CU.<K, V>empty(),
                                         null);
                             }
                             catch (GridCacheFilterFailedException e) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
index 22bf372..7cd0ff9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalEx.java
@@ -67,15 +67,13 @@ public interface IgniteTxLocalEx<K, V> extends 
IgniteTxEx<K, V> {
      * @param cached Cached entry if this method is called from entry wrapper.
      *      Cached entry is passed if and only if there is only one key in 
collection of keys.
      * @param deserializePortable Deserialize portable flag.
-     * @param filter Entry filter.
      * @return Future for this get.
      */
     public IgniteFuture<Map<K, V>> getAllAsync(
         GridCacheContext<K, V> cacheCtx,
         Collection<? extends K> keys,
         @Nullable GridCacheEntryEx<K, V> cached,
-        boolean deserializePortable,
-        IgnitePredicate<CacheEntry<K, V>>[] filter);
+        boolean deserializePortable);
 
     /**
      * @param cacheCtx Cache context.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java
index 3ac8227..4cb7813 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxProxyImpl.java
@@ -102,6 +102,13 @@ public class IgniteTxProxyImpl<K, V> implements 
IgniteTxProxy, Externalizable {
         }
     }
 
+    /**
+     * @return Proxied transaction.
+     */
+    public IgniteTxEx<K, V> tx() {
+        return tx;
+    }
+
     /** {@inheritDoc} */
     @Override public IgniteUuid xid() {
         return tx.xid();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index cffcf6e..a52eca9 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -412,13 +412,12 @@ public class GridCacheTestEntryEx<K, V> extends 
GridMetadataAwareAdapter impleme
         UUID subjId,
         Object transformClo,
         String taskName,
-        IgnitePredicate<CacheEntry<K, V>>[] filter,
         @Nullable IgniteCacheExpiryPolicy expiryPlc) {
         return val;
     }
 
     /** @inheritDoc */
-    @Override public V innerReload(IgnitePredicate<CacheEntry<K, V>>[] filter) 
{
+    @Override public V innerReload() {
         return val;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java
new file mode 100644
index 0000000..28d2c08
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheContainsKeyAbstractSelfTest.java
@@ -0,0 +1,125 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.transactions.*;
+import org.apache.ignite.spi.communication.tcp.*;
+import org.apache.ignite.transactions.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+
+/**
+ * Tests various scenarios for {@code containsKey()} method.
+ */
+public abstract class IgniteCacheContainsKeyAbstractSelfTest extends 
GridCacheAbstractSelfTest {
+    /**
+     * @return Number of grids to start.
+     */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        cache(0).removeAll();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
+
+        commSpi.setSharedMemoryPort(-1);
+
+        cfg.setCommunicationSpi(commSpi);
+
+        TransactionsConfiguration tcfg = new TransactionsConfiguration();
+
+        tcfg.setTxSerializableEnabled(true);
+
+        cfg.setTransactionsConfiguration(tcfg);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) 
throws Exception {
+        CacheConfiguration ccfg = super.cacheConfiguration(gridName);
+
+        ccfg.setBackups(1);
+
+        return ccfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDistributedContains() throws Exception {
+        String key = "1";
+
+        cache(0).put(key, 1);
+
+        for (int i = 0; i < gridCount(); i++)
+            assertTrue("Invalid result on grid: " + i, 
cache(i).containsKey(key));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testContainsInTx() throws Exception {
+        if (atomicityMode() == TRANSACTIONAL) {
+            String key = "1";
+
+            for (int i = 0; i < gridCount(); i++)
+                assertFalse("Invalid result on grid: " + i, 
cache(i).containsKey(key));
+
+            GridCache<String, Integer> cache = cache(0);
+
+            for (IgniteTxConcurrency conc : IgniteTxConcurrency.values()) {
+                for (IgniteTxIsolation iso : IgniteTxIsolation.values()) {
+                    try (IgniteTx tx = grid(0).transactions().txStart(conc, 
iso)) {
+                        assertFalse("Invalid result on grid inside tx", 
cache.containsKey(key));
+
+                        assertFalse("Key was enlisted to transaction: " + tx, 
txContainsKey(tx, key));
+
+                        cache.put(key, 1);
+
+                        assertTrue("Invalid result on grid inside tx", 
cache.containsKey(key));
+
+                        // Do not commit.
+                    }
+
+                    for (int i = 0; i < gridCount(); i++)
+                        assertFalse("Invalid result on grid: " + i, 
cache(i).containsKey(key));
+                }
+            }
+        }
+    }
+
+    /**
+     * Checks if transaction has given key enlisted.
+     *
+     * @param tx Transaction to check.
+     * @param key Key to check.
+     * @return {@code True} if key was enlisted.
+     */
+    private boolean txContainsKey(IgniteTx tx, String key) {
+        IgniteTxProxyImpl<String, Integer> proxy = (IgniteTxProxyImpl<String, 
Integer>)tx;
+
+        IgniteTxEx<String, Integer> txEx = proxy.tx();
+
+        IgniteTxEntry entry = txEx.entry(context(0).txKey(key));
+
+        return entry != null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
index fee7183..7633d8c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
@@ -265,7 +265,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest 
extends GridCommonAbstractT
             waitForLocalEvent(grid(primary).events(), nodeEvent(primary.id()), 
EVT_CACHE_ENTRY_EVICTED);
 
         // Get value on other node, it should be loaded to near cache.
-        assertEquals(val, nearOther.get(key, true, null));
+        assertEquals(val, nearOther.get(key, true));
 
         entryPrimary = dhtPrimary.peekExx(key);
         entryBackup = dhtBackup.peekExx(key);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a03fee32/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheContainsKeyColocatedSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheContainsKeyColocatedSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheContainsKeyColocatedSelfTest.java
new file mode 100644
index 0000000..96f83f6
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheContainsKeyColocatedSelfTest.java
@@ -0,0 +1,28 @@
+/* @java.file.header */
+
+/*  _________        _____ __________________        _____
+ *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
+ *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
+ *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
+ *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
+ */
+
+package org.apache.ignite.internal.processors.cache.distributed.dht;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+/**
+ *
+ */
+public class IgniteCacheContainsKeyColocatedSelfTest extends 
IgniteCacheContainsKeyAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheDistributionMode distributionMode() {
+        return CacheDistributionMode.PARTITIONED_ONLY;
+    }
+}

Reply via email to