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

Affinity.mapKeyToNode() method throw "ArithmeticException: / by zero" for LOCAL dinamically started cache

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      Affinity.mapKeyToNode() method throw "ArithmeticException: / by zero" for LOCAL cache.

      The following code

          public static void main(String[] args) {
              try (Ignite ignite = Ignition.start(new IgniteConfiguration())) {
                  CacheConfiguration cc = new CacheConfiguration();
      
                  cc.setCacheMode(LOCAL);
                  cc.setName("myCache");
      
                  ignite.getOrCreateCache(cc);
      
                  ignite.affinity("myCache").mapKeyToNode("myKey");
              }
          }
      

      Produce the following exception.

      Exception in thread "main" java.lang.ArithmeticException: / by zero
      	at org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityImpl.mapKeysToNodes(GridCacheAffinityImpl.java:210)
      	at org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityImpl.mapKeyToNode(GridCacheAffinityImpl.java:187)
      	at main
      

      The issue is cctx.discovery().cacheAffinityNodes(cctx.name(), topVer) returns empty nodes collection.

      If cache started on node start then there is no exception.

      Attachments

        Issue Links

          Activity

            People

              ashutak Artem Shutak
              ashutak Artem Shutak
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: