You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Dmitry Sterinzat (Jira)" <ji...@apache.org> on 2019/08/22 06:49:00 UTC

[jira] [Updated] (IGNITE-12094) Scan Query scheduled to be executed on wrong node

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

Dmitry Sterinzat updated IGNITE-12094:
--------------------------------------
    Description: 
When Scan query on Replicated cache executes from client node and topology is unstable (for example 2 new server nodes are up at the same time) it is possible to get empty result:
{code:java}
// IgniteCacheProxyImpl#projection

// here we return cluster group with random cluster node 
return ctx.kernalContext().grid().cluster().forDataNodes(ctx.name()).forRandom();{code}
 
{code:java}
// GridCacheQueryAdapter#executeScanQuery

// Affinity nodes snapshot.
Collection<ClusterNode> nodes = new ArrayList<>(nodes());
...
if (nodes.isEmpty()) {
    if (part != null && forceLocal)
        throw new IgniteCheckedException("No queryable nodes for partition " + part
            + " [forced local query=" + this + "]");

    return new GridEmptyCloseableIterator();
} 

// GridCacheQueryAdapter#nodes(final GridCacheContext<?, ?> cctx,
    @Nullable final ClusterGroup prj, @Nullable final Integer part)

    final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();

// This collection isn't contains randomly selected node because AffinityTopologyVersion is previous.
    Collection<ClusterNode> affNodes = CU.affinityNodes(cctx, topVer);
...
    return F.view(affNodes, new P1<ClusterNode>() {
        @Override public boolean apply(ClusterNode n) {
            return cctx.discovery().cacheAffinityNode(n, cctx.name()) &&
                (prj == null || prj.node(n.id()) != null) &&
                (part == null || owners.contains(n));
        }
    });
}


{code}
In our case nodes collection is empty, because node that was randomly selected isn't current topology version (cache isn't already started), so we get GridEmptyCloseableIterator (query event isn't executed).

 

  was:
When Scan query on Replicated cache executes from client node and topology is unstable (for example 2 new server nodes are up at the same time) it is possible to get empty result:

 

 
{code:java}
// IgniteCacheProxyImpl#projection

// here we return cluster group with random cluster node 
return ctx.kernalContext().grid().cluster().forDataNodes(ctx.name()).forRandom();{code}
 
{code:java}
// GridCacheQueryAdapter#executeScanQuery

// Affinity nodes snapshot.
Collection<ClusterNode> nodes = new ArrayList<>(nodes());
...
if (nodes.isEmpty()) {
    if (part != null && forceLocal)
        throw new IgniteCheckedException("No queryable nodes for partition " + part
            + " [forced local query=" + this + "]");

    return new GridEmptyCloseableIterator();
} 

// GridCacheQueryAdapter#nodes(final GridCacheContext<?, ?> cctx,
    @Nullable final ClusterGroup prj, @Nullable final Integer part)

    final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();

// This collection isn't contains randomly selected node because AffinityTopologyVersion is previous.
    Collection<ClusterNode> affNodes = CU.affinityNodes(cctx, topVer);
...
    return F.view(affNodes, new P1<ClusterNode>() {
        @Override public boolean apply(ClusterNode n) {
            return cctx.discovery().cacheAffinityNode(n, cctx.name()) &&
                (prj == null || prj.node(n.id()) != null) &&
                (part == null || owners.contains(n));
        }
    });
}


{code}
In our case nodes collection is empty, because node that was randomly selected isn't current topology version (cache isn't already started), so we get GridEmptyCloseableIterator (query event isn't executed).

 


> Scan Query scheduled to be executed on wrong node
> -------------------------------------------------
>
>                 Key: IGNITE-12094
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12094
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 2.7.5
>            Reporter: Dmitry Sterinzat
>            Priority: Major
>
> When Scan query on Replicated cache executes from client node and topology is unstable (for example 2 new server nodes are up at the same time) it is possible to get empty result:
> {code:java}
> // IgniteCacheProxyImpl#projection
> // here we return cluster group with random cluster node 
> return ctx.kernalContext().grid().cluster().forDataNodes(ctx.name()).forRandom();{code}
>  
> {code:java}
> // GridCacheQueryAdapter#executeScanQuery
> // Affinity nodes snapshot.
> Collection<ClusterNode> nodes = new ArrayList<>(nodes());
> ...
> if (nodes.isEmpty()) {
>     if (part != null && forceLocal)
>         throw new IgniteCheckedException("No queryable nodes for partition " + part
>             + " [forced local query=" + this + "]");
>     return new GridEmptyCloseableIterator();
> } 
> // GridCacheQueryAdapter#nodes(final GridCacheContext<?, ?> cctx,
>     @Nullable final ClusterGroup prj, @Nullable final Integer part)
>     final AffinityTopologyVersion topVer = cctx.affinity().affinityTopologyVersion();
> // This collection isn't contains randomly selected node because AffinityTopologyVersion is previous.
>     Collection<ClusterNode> affNodes = CU.affinityNodes(cctx, topVer);
> ...
>     return F.view(affNodes, new P1<ClusterNode>() {
>         @Override public boolean apply(ClusterNode n) {
>             return cctx.discovery().cacheAffinityNode(n, cctx.name()) &&
>                 (prj == null || prj.node(n.id()) != null) &&
>                 (part == null || owners.contains(n));
>         }
>     });
> }
> {code}
> In our case nodes collection is empty, because node that was randomly selected isn't current topology version (cache isn't already started), so we get GridEmptyCloseableIterator (query event isn't executed).
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)