You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (Jira)" <ji...@apache.org> on 2021/11/22 15:28:00 UTC

[jira] [Commented] (IGNITE-15960) Ignite#getOrCreateNearCache appears to be broken?

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

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

* getOrCreateNearCache starts a near cache on a client node. It starts a near cache only on that specific client node. It does not work on server nodes.
* CacheConfiguration.NearConfiguration property defines a near cache on the server side. It starts on all server nodes. Once started, it cannot be changed or removed.

We should at least document this better, both in Javadoc and on the website. I'm not sure how to improve this API.

> 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)