[ 
https://issues.apache.org/jira/browse/IGNITE-21266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mikhail Petrov updated IGNITE-21266:
------------------------------------
    Description: 
ClientCacheAffinityContext is susceptible to the similar problem ерфе described 
in [IGNITE-21001|https://issues.apache.org/jira/browse/IGNITE-21001].

Reproducer: 

{code:java}
/** */
public class PartitionAwarenessClusterRestartTest extends 
ThinClientAbstractPartitionAwarenessTest {
    /** */
    @Test
    public void testGroupNodesAfterClusterRestart() throws Exception {
        prepareCluster();

        initClient(getClientConfiguration(0), 0, 1);

        checkPartitionAwareness();

        stopAllGrids();

        prepareCluster();

        checkPartitionAwareness();
    }

    /** */
    private void checkPartitionAwareness() throws Exception {
        ClientCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);

        cache.put(0, 0);

        opsQueue.clear();

        for (int i = 1; i < 1000; i++) {
            cache.put(i, i);

            
assertOpOnChannel(nodeChannel(grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id()),
 ClientOperation.CACHE_PUT);
        }
    }

    /** */
    private void prepareCluster() throws Exception {
        startGrids(3);

        grid(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
    }
}

{code}


  was:
Reproducer: 


{code:java}
/** */
public class PartitionAwarenessClusterRestartTest extends 
ThinClientAbstractPartitionAwarenessTest {
    /** */
    @Test
    public void testGroupNodesAfterClusterRestart() throws Exception {
        prepareCluster();

        initClient(getClientConfiguration(0), 0, 1);

        checkPartitionAwareness();

        stopAllGrids();

        prepareCluster();

        checkPartitionAwareness();
    }

    /** */
    private void checkPartitionAwareness() throws Exception {
        ClientCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);

        cache.put(0, 0);

        opsQueue.clear();

        for (int i = 1; i < 1000; i++) {
            cache.put(i, i);

            
assertOpOnChannel(nodeChannel(grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id()),
 ClientOperation.CACHE_PUT);
        }
    }

    /** */
    private void prepareCluster() throws Exception {
        startGrids(3);

        grid(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
    }
}

{code}



> [Java Thin Client] Partition Awareness does not work after cluster restart
> --------------------------------------------------------------------------
>
>                 Key: IGNITE-21266
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21266
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Mikhail Petrov
>            Priority: Major
>              Labels: ise
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> ClientCacheAffinityContext is susceptible to the similar problem ерфе 
> described in 
> [IGNITE-21001|https://issues.apache.org/jira/browse/IGNITE-21001].
> Reproducer: 
> {code:java}
> /** */
> public class PartitionAwarenessClusterRestartTest extends 
> ThinClientAbstractPartitionAwarenessTest {
>     /** */
>     @Test
>     public void testGroupNodesAfterClusterRestart() throws Exception {
>         prepareCluster();
>         initClient(getClientConfiguration(0), 0, 1);
>         checkPartitionAwareness();
>         stopAllGrids();
>         prepareCluster();
>         checkPartitionAwareness();
>     }
>     /** */
>     private void checkPartitionAwareness() throws Exception {
>         ClientCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);
>         cache.put(0, 0);
>         opsQueue.clear();
>         for (int i = 1; i < 1000; i++) {
>             cache.put(i, i);
>             
> assertOpOnChannel(nodeChannel(grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id()),
>  ClientOperation.CACHE_PUT);
>         }
>     }
>     /** */
>     private void prepareCluster() throws Exception {
>         startGrids(3);
>         grid(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to