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

Vladimir Steshin edited comment on IGNITE-20837 at 11/14/23 11:13 AM:
----------------------------------------------------------------------

We have old wierd limitation on Partition Awareness fot the thin clients if 
cache has a node filter:


{code:java}
public class ClientCachePartitionsRequest extends ClientRequest {
    /**
     * @param ccfg Cache configuration.
     * @param withCustomMappings {@code true} to verify a non-default affinity 
function also.
     * @return True if cache is applicable for partition awareness optimisation.
     */
    private static boolean isApplicable(CacheConfiguration<?, ?> ccfg, boolean 
withCustomMappings) {
        // Partition could be extracted only from PARTITIONED caches.
        if (ccfg.getCacheMode() != CacheMode.PARTITIONED)
            return false;

        IgnitePredicate<?> filter = ccfg.getNodeFilter();
        boolean hasNodeFilter = filter != null && !(filter instanceof 
CacheConfiguration.IgniteAllNodesPredicate);

        // We cannot be sure that two caches are co-located if custom node 
filter is present.
        // Note that technically we may try to compare two filters. However, 
this adds unnecessary complexity
        // and potential deserialization issues.
        if (hasNodeFilter)
            return false;

        return withCustomMappings || isDefaultMapping(ccfg);
    }
}
{code}

It should work with node filter too.


was (Author: vladsz83):
We have old wierd limitation on Partition Awareness in thin clients if cache 
has a node filter:


{code:java}
public class ClientCachePartitionsRequest extends ClientRequest {
    /**
     * @param ccfg Cache configuration.
     * @param withCustomMappings {@code true} to verify a non-default affinity 
function also.
     * @return True if cache is applicable for partition awareness optimisation.
     */
    private static boolean isApplicable(CacheConfiguration<?, ?> ccfg, boolean 
withCustomMappings) {
        // Partition could be extracted only from PARTITIONED caches.
        if (ccfg.getCacheMode() != CacheMode.PARTITIONED)
            return false;

        IgnitePredicate<?> filter = ccfg.getNodeFilter();
        boolean hasNodeFilter = filter != null && !(filter instanceof 
CacheConfiguration.IgniteAllNodesPredicate);

        // We cannot be sure that two caches are co-located if custom node 
filter is present.
        // Note that technically we may try to compare two filters. However, 
this adds unnecessary complexity
        // and potential deserialization issues.
        if (hasNodeFilter)
            return false;

        return withCustomMappings || isDefaultMapping(ccfg);
    }
}
{code}

It should work with node filter too.

> Thin Client Partition Awareness with a node filter
> --------------------------------------------------
>
>                 Key: IGNITE-20837
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20837
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Vladimir Steshin
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to