You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vladimir Steshin (Jira)" <ji...@apache.org> on 2023/11/13 12:29:00 UTC

[jira] [Comment Edited] (IGNITE-20837) Partition awareness with node filter

    [ 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/13/23 12:28 PM:
----------------------------------------------------------------------

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.


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


{code:java}
    /**
     * @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.

> Partition awareness with 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)