[ https://issues.apache.org/jira/browse/IGNITE-9878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16844036#comment-16844036 ]
Valentin Kulichenko commented on IGNITE-9878: --------------------------------------------- I don't think it's a bug, because these exceptions are thrown on a server node. If you want to have a near cache on server node, you need to define `NearCacheConfiguration` as part of `CacheConfiguration`, and not provide one in `getOrCreateCache`. Said that, behavior looks correct to me, although there is a definite usability issue. Exceptions have to be clearer, and we might even think about revisiting this API for future major versions. > Failed to start near cache after second call of getOrCreateCache > ---------------------------------------------------------------- > > Key: IGNITE-9878 > URL: https://issues.apache.org/jira/browse/IGNITE-9878 > Project: Ignite > Issue Type: Bug > Components: cache > Affects Versions: 2.6 > Reporter: Roman Guseinov > Assignee: Roman Guseinov > Priority: Major > Attachments: NearCacheIssueReproducer.java > > > Repeated call of `Ignite.getOrCreateCache(CacheConfiguration<K, V> cacheCfg, > NearCacheConfiguration<K, V> nearCfg)` lead the following exception: > {code:java} > javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: > Failed to start near cache (local node is an affinity node for cache): > ignite-test-near-rep > at > org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1305) > at > org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2995) > at > org.apache.ignite.reproducers.cache.NearCacheIssueReproducer.testRepeatedGetOrCreateCache(NearCacheIssueReproducer.java:24) > Caused by: class org.apache.ignite.IgniteCheckedException: Failed to start > near cache (local node is an affinity node for cache): ignite-test-near-rep > at > org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheChangeRequest(GridCacheProcessor.java:5235) > at > org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:3621) > at > org.apache.ignite.internal.processors.cache.GridCacheProcessor.dynamicStartCache(GridCacheProcessor.java:3560) > at > org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2983) > ... 23 more > {code} > Also, if a cache is specified in the IgniteConfiguration, > `Ignite#getOrCreateNearCache` will fail with the following exception: > {code:java} > javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: > Failed to start near cache (a cache with the same name without near cache is > already started) > at > org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1305) > at > org.apache.ignite.internal.IgniteKernal.getOrCreateNearCache(IgniteKernal.java:3072) > at > org.apache.ignite.reproducers.cache.NearCacheIssueReproducer.testGetOrCreateNearCache(NearCacheIssueReproducer.java:32) > Caused by: class org.apache.ignite.IgniteCheckedException: Failed to start > near cache (a cache with the same name without near cache is already started) > at > org.apache.ignite.internal.IgniteKernal.checkNearCacheStarted(IgniteKernal.java:3085) > at > org.apache.ignite.internal.IgniteKernal.getOrCreateNearCache(IgniteKernal.java:3067) > ... 23 more > {code} > The test is attached [^NearCacheIssueReproducer.java]. The workaround is to > put near cache config into cache configuration > `CacheConfiguration.setNearConfiguration`. -- This message was sent by Atlassian JIRA (v7.6.3#76005)