Andrey Aleksandrov created IGNITE-8629:
------------------------------------------

             Summary: There is no documentation about what on which node Ignite 
Predicate will be executed during service/cache deploying with NodeFilter
                 Key: IGNITE-8629
                 URL: https://issues.apache.org/jira/browse/IGNITE-8629
             Project: Ignite
          Issue Type: Task
          Components: documentation
    Affects Versions: 2.4
            Reporter: Andrey Aleksandrov
             Fix For: 2.6


In documentation we could see that:

[https://apacheignite.readme.io/docs/service-grid#section-node-filter-based-deployment]

This approach is based on a filtering predicate that gets called on every node 
at the time Ignite Service engine determines a set of possible candidates for 
the Ignite Service deployment. 

Looks like it's not correct because in Ignite 2.4 next code:


{code:java}
Ignite ignite = IgnitionEx.start("examples/config/example-ignite.xml", 
"ignite-1");
Ignite ignite2 = IgnitionEx.start("examples/config/example-ignite.xml", 
"ignite-2");

// Deploy services only on server nodes.
ignite2.services().deploy(new ServiceConfiguration()
    .setMaxPerNodeCount(1)
    .setNodeFilter(new IgnitePredicate<ClusterNode>() {
        @IgniteInstanceResource Ignite filterIgnite;

        @Override public boolean apply(ClusterNode node) {
            System.out.println("Is local node: " + node.isLocal());
            System.out.println("ignite: " + (isNull(filterIgnite) ? null : 
filterIgnite.name()));
            return true;
        }
    })
    .setName("my-service")
    .setService(new SimpleMapServiceImpl<>())
);

{code}
Will be executed only on "ignite-1"


{code:java}
Is local node: true
ignite: ignite-1
Is local node: false
ignite: ignite-1
Service was initialized: my-service
Is local node: true
ignite: ignite-1
Is local node: false
ignite: ignite-1
Service was initialized: my-service
Executing distributed service: my-service
Executing distributed service: my-service
Is local node: true
ignite: ignite-1
Is local node: false
ignite: ignite-1
{code}
Looks like ignite-1 is the coordinator node in this case. But this behavior is 
different from described in the documentation.

Also, this should be described in case of the cache deployment:
{code:java}
Ignite ignite = IgnitionEx.start("examples/config/example-ignite.xml", 
"ignite-1");
Ignite ignite2 = IgnitionEx.start("examples/config/example-ignite.xml", 
"ignite-2");

// Deploy services only on server nodes.
ignite2.services().deploy(new ServiceConfiguration()
    .setMaxPerNodeCount(1)
    .setNodeFilter(new IgnitePredicate<ClusterNode>() {
        Ignite filterIgnite;

        @Override public boolean apply(ClusterNode node) {
            System.out.println("Is local node: " + node.isLocal());
            System.out.println("ignite: " + (isNull(filterIgnite) ? null : 
filterIgnite.name()));
            return true;
        }

        @IgniteInstanceResource
        void setFilterIgnite(Ignite filterIgnite) {
            this.filterIgnite = filterIgnite;
        }
    })
    .setName("my-service")
    .setService(new SimpleMapServiceImpl<>())
);

{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to