[ 
https://issues.apache.org/jira/browse/IGNITE-15960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17447888#comment-17447888
 ] 

Pavel Tupitsyn commented on IGNITE-15960:
-----------------------------------------

To clarify, this is the expected use case:
1. Start a cache with a server-side near cache from a server node
2. Start a near cache for existing cache from a client node

{code}
        Ignite ignite = Ignition.start();
    
        CacheConfiguration cacheCfg = new CacheConfiguration()
                .setName("c1")
                .setNearConfiguration(new NearCacheConfiguration());
    
        ignite.createCache(cacheCfg);
    
        Ignite client = Ignition.start(new 
IgniteConfiguration().setIgniteInstanceName("client").setClientMode(true));
    
        client.getOrCreateNearCache(cacheCfg.getName(), new 
NearCacheConfiguration<>());
{code}

> Ignite#getOrCreateNearCache appears to be broken?
> -------------------------------------------------
>
>                 Key: IGNITE-15960
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15960
>             Project: Ignite
>          Issue Type: Bug
>    Affects Versions: 2.10
>            Reporter: Stephen Darlington
>            Priority: Minor
>
> I have my Ignite server running a connect a thick-client running some code.
> If I don't create any caches in advance and run this code:
> {{client.getOrCreateNearCache(CACHE_NAME, new NearCacheConfiguration<Integer, 
> Integer>()}}
> {{.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>()));}}
> The error I get is:
> {{Failed to start client cache (a cache with the given name is not started)}}
> Okay, so I create my cache in advance:
> {{client.getOrCreateCache(CACHE_NAME);}}
> {{client.getOrCreateNearCache(CACHE_NAME, new NearCacheConfiguration<Integer, 
> Integer>()}}
> {{.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>()));}}
> This time I get the following error:
> {{Failed to start near cache (a cache with the same name without near cache 
> is already started)}}
> Okay, so I'll create a cache with a near cache:
> {{client.getOrCreateCache(new CacheConfiguration<>()}}
> {{.setName(CACHE_NAME)}}
> {{.setNearConfiguration(new NearCacheConfiguration()}}
> {{.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>())));}}
> {{client.getOrCreateNearCache(CACHE_NAME, new NearCacheConfiguration<Integer, 
> Integer>()}}
> {{.setNearEvictionPolicyFactory(new LruEvictionPolicyFactory<>()));}}
> Still the same error:
> {{Failed to start near cache (a cache with the same name without near cache 
> is already started)}}
> So however the cache is created or configured, it appears not to work.
> One possibility is that it's only supposed to work on a server where the near 
> cache already exists. If so, this is not mentioned anywhere in the 
> documentation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to