Hi all.

It seems one method uses affinity:

 cctx.affinity().primaryPartitions(n.id(), topologyVersion());

other uses topology API.

cctx.topology().owners(part, topVer)

Are these two fully consistent?

On Tue, Dec 6, 2016 at 4:58 PM, Alper Tekinalp <al...@evam.com> wrote:

> Hi all.
>
> We have 2 servers and a cache X. On both servers a method is running
> reqularly and run a ScanQurey on that cache. We get partitions for that
> query via
>
> ignite.affinity(cacheName).primaryPartitions(ignite.cluster().localNode())
>
> and run the query on each partitions. When cache has been destroyed by
> master server on second server we get:
>
> javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException:
> null
>         at org.apache.ignite.internal.processors.cache.
> IgniteCacheProxy.query(IgniteCacheProxy.java:740)
>         at com.intellica.evam.engine.event.future.FutureEventWorker.
> processFutureEvents(FutureEventWorker.java:117)
>         at com.intellica.evam.engine.event.future.FutureEventWorker.run(
> FutureEventWorker.java:66)
> Caused by: class org.apache.ignite.IgniteCheckedException: null
>         at org.apache.ignite.internal.processors.query.GridQueryProcessor.
> executeQuery(GridQueryProcessor.java:1693)
>         at org.apache.ignite.internal.processors.cache.
> IgniteCacheProxy.query(IgniteCacheProxy.java:494)
>         at org.apache.ignite.internal.processors.cache.
> IgniteCacheProxy.query(IgniteCacheProxy.java:732)
>         ... 2 more
> Caused by: java.lang.NullPointerException
>         at org.apache.ignite.internal.processors.cache.query.
> GridCacheQueryAdapter$ScanQueryFallbackClosableIterator.init(
> GridCacheQueryAdapter.java:712)
>         at org.apache.ignite.internal.processors.cache.query.
> GridCacheQueryAdapter$ScanQueryFallbackClosableIterator.<init>(
> GridCacheQueryAdapter.java:677)
>         at org.apache.ignite.internal.processors.cache.query.
> GridCacheQueryAdapter$ScanQueryFallbackClosableIterator.<init>(
> GridCacheQueryAdapter.java:628)
>         at org.apache.ignite.internal.processors.cache.query.
> GridCacheQueryAdapter.executeScanQuery(GridCacheQueryAdapter.java:548)
>         at org.apache.ignite.internal.processors.cache.
> IgniteCacheProxy$2.applyx(IgniteCacheProxy.java:497)
>         at org.apache.ignite.internal.processors.cache.
> IgniteCacheProxy$2.applyx(IgniteCacheProxy.java:495)
>         at org.apache.ignite.internal.util.lang.IgniteOutClosureX.
> apply(IgniteOutClosureX.java:36)
>         at org.apache.ignite.internal.processors.query.GridQueryProcessor.
> executeQuery(GridQueryProcessor.java:1670)
>         ... 4 more
>
> for a while until cache is closed on that server too.
>
> The corresponding line is:
>
> 710:            final ClusterNode node = nodes.poll();
> 711:
> 712:            if (*node*.isLocal()) {
>
> Obviously node is null. nodes is a dequeue fill by following method:
>
>         private Queue<ClusterNode> fallbacks(AffinityTopologyVersion
> topVer) {
>             Deque<ClusterNode> fallbacks = new LinkedList<>();
>             Collection<ClusterNode> owners = new HashSet<>();
>
>             for (ClusterNode node : cctx.topology().owners(part, topVer)) {
>                 if (node.isLocal())
>                     fallbacks.addFirst(node);
>                 else
>                     fallbacks.add(node);
>
>                 owners.add(node);
>             }
>
>             for (ClusterNode node : cctx.topology().moving(part)) {
>                 if (!owners.contains(node))
>                     fallbacks.add(node);
>             }
>
>             return fallbacks;
>         }
>
> There errors occurs before cache closed on second server. So checking if
> cache closed is not enough.
>
> Why when we take partitions for local node we get some partitions but
> ignite cant find any owner for that partition?
> Is our method for getting partitions wrong?
> Is there any way to avoid that?
>
> Best regards.
> --
> Alper Tekinalp
>
> Software Developer
> Evam Streaming Analytics
>
> Atatürk Mah. Turgut Özal Bulv.
> Gardenya 5 Plaza K:6 Ataşehir
> 34758 İSTANBUL
>
> Tel:  +90 216 455 01 53 Fax: +90 216 455 01 54
> www.evam.com.tr
> <http://www.evam.com>
>



-- 
Alper Tekinalp

Software Developer
Evam Streaming Analytics

Atatürk Mah. Turgut Özal Bulv.
Gardenya 5 Plaza K:6 Ataşehir
34758 İSTANBUL

Tel:  +90 216 455 01 53 Fax: +90 216 455 01 54
www.evam.com.tr
<http://www.evam.com>

Reply via email to