Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-8630

Node filter IgnitePredicate executes twice during deploying on one single node cluster

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.4
    • Fix Version/s: 2.8
    • Component/s: managed services
    • Labels:
      None

      Description

      Next code:

              Ignite ignite = IgnitionEx.start("examples/config/example-ignite.xml", "ignite-1");
      
              // Deploy services only on server nodes.
              ignite.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<>())
              );
      
      

      Produces next output:

      Is local node: true
      ignite: ignite-1
      Service was initialized: my-service
      Executing distributed service: my-service
      Is local node: true
      ignite: ignite-1

      In case if we will increase the cluster size to 2 then we will have:

      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.
      ignite.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<>())
      );
      
      

      We will get:

      Is local node: true
      ignite: ignite-1 
      Is local node: false
      ignite: ignite-1 
      Service was initialized: my-service
      Executing distributed service: my-service
      Service was initialized: my-service
      Is local node: true
      ignite: ignite-1 
      Is local node: false
      ignite: ignite-1 
      Executing distributed service: my-service
      Is local node: true
      ignite: ignite-1
      Is local node: false
      ignite: ignite-1
      

      So we have additional execution:

      Is local node: true
      ignite: ignite-1
      Is local node: false
      ignite: ignite-1

      So Ignite executes apply method several times (2 times for 1 server, 6 times for 2 servers). This behavior should be documented or fixed because at the moment it's could be unexpected for the user.

      You can see the same behaviour during deploying of the caches with nodeFilter 

        Attachments

          Activity

            People

            • Assignee:
              daradurvs Vyacheslav Daradur
              Reporter:
              aealeksandrov Andrey Aleksandrov
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: