This is an automated email from the ASF dual-hosted git repository.

alexpl 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 d783edc9a18 IGNITE-20837 Thin client: Fix partition awareness with 
node filter - Fixes #11039.
d783edc9a18 is described below

commit d783edc9a188c2a13d78eebc912abd82b95a10bf
Author: Vladimir Steshin <[email protected]>
AuthorDate: Fri Nov 24 10:24:05 2023 +0300

    IGNITE-20837 Thin client: Fix partition awareness with node filter - Fixes 
#11039.
    
    Signed-off-by: Aleksey Plekhanov <[email protected]>
---
 .../client/cache/ClientCachePartitionsRequest.java |  10 -
 .../internal/util/collection/BitSetIntSet.java     |  19 ++
 .../internal/util/collection/ImmutableIntSet.java  |  16 ++
 .../ThinClientAbstractPartitionAwarenessTest.java  |  22 +-
 ...ClientPartitionAwarenessStableTopologyTest.java | 243 ++++++++++++++++++++-
 ...ientPartitionAwarenessUnstableTopologyTest.java |  24 +-
 6 files changed, 314 insertions(+), 20 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java
index 35740da13c6..44c8dfe265b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/client/cache/ClientCachePartitionsRequest.java
@@ -41,7 +41,6 @@ import 
org.apache.ignite.internal.processors.platform.client.ClientRequest;
 import org.apache.ignite.internal.processors.platform.client.ClientResponse;
 import org.apache.ignite.internal.util.lang.gridfunc.NotContainsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.lang.IgnitePredicate;
 import org.jetbrains.annotations.Nullable;
 import static java.util.Optional.ofNullable;
 import static 
org.apache.ignite.internal.processors.query.QueryUtils.isCustomAffinityMapper;
@@ -187,15 +186,6 @@ public class ClientCachePartitionsRequest extends 
ClientRequest {
         if (ccfg.getCacheMode() != CacheMode.PARTITIONED)
             return false;
 
-        IgnitePredicate<?> filter = ccfg.getNodeFilter();
-        boolean hasNodeFilter = filter != null && !(filter instanceof 
CacheConfiguration.IgniteAllNodesPredicate);
-
-        // We cannot be sure that two caches are co-located if custom node 
filter is present.
-        // Note that technically we may try to compare two filters. However, 
this adds unnecessary complexity
-        // and potential deserialization issues.
-        if (hasNodeFilter)
-            return false;
-
         return withCustomMappings || isDefaultMapping(ccfg);
     }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/collection/BitSetIntSet.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/util/collection/BitSetIntSet.java
index 12e8075789c..a63573bbdc7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/collection/BitSetIntSet.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/collection/BitSetIntSet.java
@@ -20,6 +20,7 @@ import java.util.BitSet;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
+import java.util.Objects;
 import org.apache.ignite.internal.util.GridSerializableCollection;
 import org.jetbrains.annotations.NotNull;
 
@@ -223,4 +224,22 @@ public class BitSetIntSet extends 
GridSerializableCollection<Integer> implements
 
         size = 0;
     }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return Objects.hashCode(bitSet);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        BitSetIntSet o0 = (BitSetIntSet)o;
+
+        return size == o0.size && bitSet.equals(o0.bitSet);
+    }
 }
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/collection/ImmutableIntSet.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/util/collection/ImmutableIntSet.java
index 2ce971ab599..f952d489525 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/collection/ImmutableIntSet.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/collection/ImmutableIntSet.java
@@ -106,6 +106,22 @@ public class ImmutableIntSet implements IntSet {
         return delegate.toString();
     }
 
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o)
+            return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        return delegate.equals(((ImmutableIntSet)o).delegate);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        return delegate.hashCode();
+    }
+
     /** {@inheritDoc} */
     @NotNull @Override public Iterator<Integer> iterator() {
         return new Iterator<Integer>() {
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientAbstractPartitionAwarenessTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientAbstractPartitionAwarenessTest.java
index 0d0a2eadb54..93dc575d8cc 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientAbstractPartitionAwarenessTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientAbstractPartitionAwarenessTest.java
@@ -41,6 +41,7 @@ import 
org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
@@ -70,6 +71,9 @@ public abstract class 
ThinClientAbstractPartitionAwarenessTest extends GridCommo
     /** Name of a partitioned cache with 1 backups. */
     protected static final String PART_CACHE_1_BACKUPS_NAME = 
"partitioned_1_backup_cache";
 
+    /** Name of a partitioned cache with 1 backups and a node filter. */
+    protected static final String PART_CACHE_1_BACKUPS_NF_NAME = 
"partitioned_1_backup_nodeFilter_cache";
+
     /** Name of a partitioned cache with 3 backups. */
     protected static final String PART_CACHE_3_BACKUPS_NAME = 
"partitioned_3_backup_cache";
 
@@ -125,7 +129,13 @@ public abstract class 
ThinClientAbstractPartitionAwarenessTest extends GridCommo
                 .setCacheMode(CacheMode.PARTITIONED)
                 .setBackups(3);
 
-        return cfg.setCacheConfiguration(ccfg0, ccfg1, ccfg2, ccfg3, ccfg4, 
ccfg5);
+        CacheConfiguration ccfg6 = new CacheConfiguration<>()
+            .setName(PART_CACHE_1_BACKUPS_NF_NAME)
+            .setCacheMode(CacheMode.PARTITIONED)
+            .setNodeFilter(new ConsistentIdNodeFilter())
+            .setBackups(1);
+
+        return cfg.setCacheConfiguration(ccfg0, ccfg1, ccfg2, ccfg3, ccfg4, 
ccfg5, ccfg6);
     }
 
     /** {@inheritDoc} */
@@ -389,4 +399,14 @@ public abstract class 
ThinClientAbstractPartitionAwarenessTest extends GridCommo
             return cfg.getAddresses().toString();
         }
     }
+
+    /**
+     * Excludes node if its consistent id ends with 'Test1'.
+     */
+    protected static final class ConsistentIdNodeFilter implements 
IgnitePredicate<ClusterNode> {
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return !node.consistentId().toString().endsWith("Test1");
+        }
+    }
 }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessStableTopologyTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessStableTopologyTest.java
index 5e66be9f6c5..7e7144ffb28 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessStableTopologyTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessStableTopologyTest.java
@@ -17,8 +17,12 @@
 
 package org.apache.ignite.internal.client.thin;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import org.apache.ignite.IgniteCheckedException;
@@ -34,7 +38,9 @@ import org.apache.ignite.client.ClientCollectionConfiguration;
 import org.apache.ignite.client.ClientIgniteSet;
 import org.apache.ignite.client.ClientPartitionAwarenessMapper;
 import org.apache.ignite.client.ClientPartitionAwarenessMapperFactory;
+import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.AtomicConfiguration;
+import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.ClientConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
@@ -42,7 +48,9 @@ import 
org.apache.ignite.internal.processors.datastructures.GridCacheAtomicLongE
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
 
 import static java.util.Arrays.asList;
@@ -190,6 +198,189 @@ public class 
ThinClientPartitionAwarenessStableTopologyTest extends ThinClientAb
         testApplicableCache(PART_CACHE_1_BACKUPS_NAME, i -> i);
     }
 
+    /**
+     * Test partition awareness for cache with a node filter.
+     */
+    @Test
+    public void testPartitionedWithNodeFilter() throws Exception {
+        
doTestCachesWithEqualAffinities(Arrays.asList(PART_CACHE_1_BACKUPS_NF_NAME), 
null);
+    }
+
+    /**
+     * Test partition awareness for caches with the same cache group, the same 
and equal node filters.
+     * Tests that equal partitions mappings are grouped in single 
ClientCachePartitionAwarenessGroup.
+     * Expects only one {@link ClientOperation#CACHE_PARTITIONS}.
+     */
+    @Test
+    public void testCacheGroupWithNodeFilter() throws Exception {
+        CacheConfiguration<?, ?> c1 = new 
CacheConfiguration<>(grid(0).cachex(PART_CACHE_1_BACKUPS_NF_NAME).configuration())
+            .setName("groupWithNodeFilter1")
+            .setGroupName("filteredGrp");
+
+        CacheConfiguration<?, ?> c2 = new 
CacheConfiguration<>(c1).setName("groupWithNodeFilter2");
+
+        // Cache with node filter equal to the filter of cache 
PART_CACHE_1_BACKUPS_NF_NAME.
+        CacheConfiguration<?, ?> c3 = new CacheConfiguration<>(c1)
+            .setName("cacheWithEqualNodeFilter")
+            .setGroupName(null)
+            .setNodeFilter(new ConsistentIdNodeFilter1());
+
+        
doTestCachesWithEqualAffinities(Collections.singletonList(PART_CACHE_1_BACKUPS_NF_NAME),
 Arrays.asList(c1, c2, c3));
+    }
+
+    /**
+     * Test partition awareness for caches with equal affinity.
+     * Tests equal partitions mappings are grouped in single 
ClientCachePartitionAwarenessGroup.
+     */
+    @Test
+    public void testPartitionedWithNodeFilter1() throws Exception {
+        doTestCachesWithEqualAffinities(Arrays.asList(PART_CACHE_NAME, 
PART_CACHE_1_BACKUPS_NAME, PART_CACHE_3_BACKUPS_NAME), null);
+    }
+
+    /**
+     * Test affinity awareness for the caches {@code cacheToUse} and {@code 
cachesToCreate}. Requires equal affinities.
+     * Expects strictly single {@link ClientOperation#CACHE_PARTITIONS} is 
invoked once for all the caches.
+     *
+     * @param cacheToUse Existing caches to test.
+     * @param cachesToCreate Caches to create for the test. Are removed after.
+     */
+    private void doTestCachesWithEqualAffinities(
+        @Nullable Collection<String> cacheToUse,
+        @Nullable Collection<CacheConfiguration<?, ?>> cachesToCreate
+    ) throws Exception {
+        assert !F.isEmpty(cacheToUse) || !F.isEmpty(cachesToCreate);
+
+        ArrayList<CacheConfiguration<?, ?>> cachesToTest = new ArrayList<>();
+
+        if (!F.isEmpty(cachesToCreate)) {
+            for (CacheConfiguration<?, ?> ccfg : cachesToCreate)
+                grid(0).createCache(ccfg);
+
+            cachesToTest.addAll(cachesToCreate);
+
+            awaitPartitionMapExchange();
+        }
+
+        try {
+            reinitClientToAllServers();
+
+            if (!F.isEmpty(cacheToUse)) {
+                for (String cacheName : cacheToUse)
+                    
cachesToTest.add(grid(0).context().cache().cacheConfiguration(cacheName));
+            }
+
+            AtomicBoolean firstCall = new AtomicBoolean(true);
+
+            for (CacheConfiguration<?, ?> ccfg : cachesToTest) {
+                log.info("Testing cache '" + ccfg.getName() + "'...");
+
+                testApplicableCache(ccfg.getName(), i -> i, 
firstCall.getAndSet(false));
+            }
+        }
+        finally {
+            if (!F.isEmpty(cachesToCreate)) {
+                for (CacheConfiguration<?, ?> ccfg : cachesToCreate)
+                    grid(0).destroyCache(ccfg.getName());
+
+                awaitPartitionMapExchange();
+            }
+        }
+    }
+
+    /**
+     * Tests grouping of caches affinities mappings in 
ClientCachePartitionAwarenessGroup.
+     */
+    @Test
+    public void testGroupingOfVariousAffinities() throws Exception {
+        reinitClientToAllServers();
+
+        client.cache(PART_CACHE_1_BACKUPS_NF_NAME).get(0);
+
+        assertOpOnChannel(null, ClientOperation.CACHE_PARTITIONS);
+        assertOpOnChannel(null, ClientOperation.CACHE_GET);
+
+        // New operation with differend affinity.
+        client.cache(PART_CACHE_NAME).get(0);
+
+        assertOpOnChannel(null, ClientOperation.CACHE_PARTITIONS);
+        assertOpOnChannel(null, ClientOperation.CACHE_GET);
+
+        // New operation with the same affinity.
+        client.cache(PART_CACHE_3_BACKUPS_NAME).get(0);
+
+        assertOpOnChannel(null, ClientOperation.CACHE_GET);
+
+        // New operation with the same affinity.
+        client.cache(PART_CACHE_1_BACKUPS_NAME).get(0);
+
+        assertOpOnChannel(null, ClientOperation.CACHE_GET);
+
+        // New operation with differend affinity.
+        client.cache(PART_CUSTOM_AFFINITY_CACHE_NAME).get(0);
+
+        assertOpOnChannel(null, ClientOperation.CACHE_PARTITIONS);
+        assertOpOnChannel(null, ClientOperation.CACHE_GET);
+    }
+
+    /**
+     * Tests that equal affinities mappings with node filters are included in 
single ClientCachePartitionAwarenessGroup
+     * and no additional {@link ClientOperation#CACHE_PARTITIONS} request is 
required.
+     */
+    @Test
+    public void testGroupingOfEqualAffinities() throws Exception {
+        // Cache with the same node filter as of cache 
PART_CACHE_1_BACKUPS_NF_NAME.
+        CacheConfiguration<?, ?> ccfg1 = new 
CacheConfiguration<>(grid(0).cachex(PART_CACHE_1_BACKUPS_NF_NAME).configuration())
+            .setName("cacheWithTheSameNodeFilter");
+
+        // Cache with node filter equal to the filter of cache 
PART_CACHE_1_BACKUPS_NF_NAME.
+        CacheConfiguration<?, ?> ccfg2 = new CacheConfiguration<>(ccfg1)
+            .setName("cacheWithEqualNodeFilter")
+            .setNodeFilter(new ConsistentIdNodeFilter1());
+
+        // Cache with different node filter.
+        CacheConfiguration<?, ?> ccfg3 = new CacheConfiguration<>(ccfg1)
+            .setName("cacheWithOtherNodeFilter")
+            .setNodeFilter(new ConsistentIdNodeFilter2());
+
+        try {
+            ignite(0).createCache(ccfg1);
+            ignite(0).createCache(ccfg2);
+            ignite(0).createCache(ccfg3);
+
+            awaitPartitionMapExchange();
+
+            reinitClientToAllServers();
+
+            client.cache(PART_CACHE_1_BACKUPS_NF_NAME).get(0);
+
+            assertOpOnChannel(null, ClientOperation.CACHE_PARTITIONS);
+            assertOpOnChannel(null, ClientOperation.CACHE_GET);
+
+            // The same affinity mapping.
+            client.cache(ccfg1.getName()).get(0);
+
+            assertOpOnChannel(null, ClientOperation.CACHE_GET);
+
+            // Other affinity mapping but equal to the previous.
+            client.cache(ccfg2.getName()).get(0);
+
+            assertOpOnChannel(null, ClientOperation.CACHE_GET);
+
+            // Different node filter, Different affinity.
+            client.cache(ccfg3.getName()).get(0);
+
+            assertOpOnChannel(null, ClientOperation.CACHE_PARTITIONS);
+            assertOpOnChannel(null, ClientOperation.CACHE_GET);
+        }
+        finally {
+            ignite(0).destroyCache(ccfg1.getName());
+            ignite(0).destroyCache(ccfg2.getName());
+            ignite(0).destroyCache(ccfg3.getName());
+
+            awaitPartitionMapExchange();
+        }
+    }
+
     /**
      * Test affinity awareness for all applicable operation types for 
partitioned cache with 3 backups.
      */
@@ -409,6 +600,19 @@ public class 
ThinClientPartitionAwarenessStableTopologyTest extends ThinClientAb
      * @param keyFactory Key factory function.
      */
     private void testApplicableCache(String cacheName, Function<Integer, 
Object> keyFactory) throws Exception {
+        testApplicableCache(cacheName, keyFactory, true);
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @param keyFactory Key factory function.
+     * @param partitionsRequestExpected If {@code true}, awaits {@link 
ClientOperation#CACHE_PARTITIONS} first.
+     */
+    private void testApplicableCache(
+        String cacheName,
+        Function<Integer, Object> keyFactory,
+        boolean partitionsRequestExpected
+    ) throws Exception {
         ClientCache<Object, Object> clientCache = client.cache(cacheName);
         IgniteInternalCache<Object, Object> igniteCache = 
grid(0).context().cache().cache(cacheName);
 
@@ -416,7 +620,9 @@ public class ThinClientPartitionAwarenessStableTopologyTest 
extends ThinClientAb
 
         TestTcpClientChannel opCh = affinityChannel(keyFactory.apply(0), 
igniteCache);
 
-        assertOpOnChannel(null, ClientOperation.CACHE_PARTITIONS);
+        if (partitionsRequestExpected)
+            assertOpOnChannel(null, ClientOperation.CACHE_PARTITIONS);
+
         assertOpOnChannel(opCh, ClientOperation.CACHE_PUT);
 
         for (int i = 1; i < KEY_CNT; i++) {
@@ -503,4 +709,39 @@ public class 
ThinClientPartitionAwarenessStableTopologyTest extends ThinClientAb
             assertOpOnChannel(opCh, ClientOperation.CACHE_CLEAR_KEY);
         }
     }
+
+    /** */
+    private void reinitClientToAllServers() throws Exception {
+        client.close();
+
+        Arrays.fill(channels, null);
+
+        initClient(getClientConfiguration(0, 1, 2), 0, 1, 2);
+
+        awaitChannelsInit(0, 1, 2);
+    }
+
+    /**
+     * Excludes node if its consistent id ends with 'Test1'. The same as 
{@link ConsistentIdNodeFilter}. We do not
+     * use one parametrized filter because we validate node filters equality 
for a cache group only by their
+     * classes.
+     */
+    protected static final class ConsistentIdNodeFilter1 implements 
IgnitePredicate<ClusterNode> {
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return !node.consistentId().toString().endsWith("Test1");
+        }
+    }
+
+    /**
+     * Excludes node if its consistent id ends with 'Test2'. Similar to {@link 
ConsistentIdNodeFilter} and
+     * {@link ConsistentIdNodeFilter1}. We do not use one parametrized filter 
because we validate node filters
+     * equality for a cache group only by their classes.
+     */
+    protected static final class ConsistentIdNodeFilter2 implements 
IgnitePredicate<ClusterNode> {
+        /** {@inheritDoc} */
+        @Override public boolean apply(ClusterNode node) {
+            return !node.consistentId().toString().endsWith("Test2");
+        }
+    }
 }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessUnstableTopologyTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessUnstableTopologyTest.java
index a413d627a57..d2ba0e7e9a1 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessUnstableTopologyTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/client/thin/ThinClientPartitionAwarenessUnstableTopologyTest.java
@@ -55,10 +55,18 @@ public class 
ThinClientPartitionAwarenessUnstableTopologyTest extends ThinClient
     @Parameterized.Parameter
     public boolean sslEnabled;
 
+    /** */
+    @Parameterized.Parameter(1)
+    public String cacheName;
+
     /** @return Test parameters. */
-    @Parameterized.Parameters(name = "sslEnabled={0}")
+    @Parameterized.Parameters(name = "sslEnabled={0},cache={1}")
     public static Collection<?> parameters() {
-        return Arrays.asList(new Object[][] {{false}, {true}});
+        return Arrays.asList(new Object[][] {
+            {false, PART_CACHE_NAME},
+            {false, PART_CACHE_1_BACKUPS_NF_NAME},
+            {true, PART_CACHE_NAME}
+        });
     }
 
     /** {@inheritDoc} */
@@ -116,13 +124,13 @@ public class 
ThinClientPartitionAwarenessUnstableTopologyTest extends ThinClient
         awaitPartitionMapExchange();
 
         // Send non-affinity request to detect topology change.
-        ClientCache<Object, Object> cache = 
client.getOrCreateCache(PART_CACHE_NAME);
+        ClientCache<Object, Object> cache = client.getOrCreateCache(cacheName);
 
         awaitChannelsInit(3);
 
         assertOpOnChannel(null, ClientOperation.CACHE_GET_OR_CREATE_WITH_NAME);
 
-        Integer key = primaryKey(grid(3).cache(PART_CACHE_NAME));
+        Integer key = primaryKey(grid(3).cache(cacheName));
 
         assertNotNull("Not found key for node 3", key);
 
@@ -187,9 +195,9 @@ public class 
ThinClientPartitionAwarenessUnstableTopologyTest extends ThinClient
         channels[disconnectNodeIdx] = null;
 
         // Send request to disconnected node.
-        ClientCache<Object, Object> cache = client.cache(PART_CACHE_NAME);
+        ClientCache<Object, Object> cache = client.cache(cacheName);
 
-        Integer key = 
primaryKey(grid(disconnectNodeIdx).cache(PART_CACHE_NAME));
+        Integer key = primaryKey(grid(disconnectNodeIdx).cache(cacheName));
 
         assertNotNull("Not found key for node " + disconnectNodeIdx, key);
 
@@ -246,8 +254,8 @@ public class 
ThinClientPartitionAwarenessUnstableTopologyTest extends ThinClient
      * @param partReq Next operation should request partitions map.
      */
     private void testPartitionAwareness(boolean partReq) {
-        ClientCache<Object, Object> clientCache = 
client.cache(PART_CACHE_NAME);
-        IgniteInternalCache<Object, Object> igniteCache = 
grid(0).context().cache().cache(PART_CACHE_NAME);
+        ClientCache<Object, Object> clientCache = client.cache(cacheName);
+        IgniteInternalCache<Object, Object> igniteCache = 
grid(0).context().cache().cache(cacheName);
 
         for (int i = 0; i < KEY_CNT; i++) {
             TestTcpClientChannel opCh = affinityChannel(i, igniteCache);

Reply via email to