Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-8912

SoftIndexFileStore does not fail gracefully if max node size exceeds 32767

    Details

      Description

      The following unit test just puts lots of entries into the cache and restarts the cache repeatedly.

      It succeeds if maxNodeSize is set to anything up to 32777, but runs into a deadlock from 32778 upwards. If going even higher it doesn't run into a deadlock anymore, but throws an IllegalArgumentException instead.

      As a workaround one can delete the index. But the problem resurfaces after the next restart.

      import java.util.concurrent.TimeUnit;
      import java.util.stream.IntStream;
      
      import org.infinispan.Cache;
      import org.infinispan.configuration.cache.Configuration;
      import org.infinispan.configuration.cache.ConfigurationBuilder;
      import org.infinispan.manager.DefaultCacheManager;
      import org.infinispan.manager.EmbeddedCacheManager;
      import org.infinispan.persistence.sifs.configuration.SoftIndexFileStoreConfigurationBuilder;
      import org.junit.After;
      import org.junit.Before;
      import org.junit.Rule;
      import org.junit.Test;
      import org.junit.rules.Timeout;
      
      public class SifsLargeNodeTest {
      
          private EmbeddedCacheManager cacheManager;
      
          @Rule
          public Timeout timeout = new Timeout(15, TimeUnit.SECONDS);
      
          private static Configuration createConfig(String location, int maxNodeSizeInBytes) {
              return new ConfigurationBuilder()
                      .persistence().addStore(SoftIndexFileStoreConfigurationBuilder.class)
                      .dataLocation(location + "/data").indexLocation(location + "/index")
                      .maxNodeSize(maxNodeSizeInBytes)
                      .preload(false).purgeOnStartup(false)
                      .build();
          }
      
          @Before
          public void setUp() {
              cacheManager = new DefaultCacheManager();
          }
      
          @After
          public void tearDown() {
              cacheManager.stop();
          }
      
          @Test
          public void testLoad() {
              int maxNodeSizeInBytes = 32780; // Note: Anything up to 32777 works fine
              String cacheName = "sifslargenodetestcache";
              Configuration cfg = createConfig(cacheName, maxNodeSizeInBytes);
      
              int numberOfRuns = 10;
              int valuesToPutPerRun = 10000;
              for (int run = 0; run < numberOfRuns; run++) {
                  System.out.println("RUN " + run);
                  cacheManager.defineConfiguration(cacheName, cfg);
                  Cache<Integer, String> testCacheBeforeReduction = cacheManager.getCache(cacheName);
                  IntStream.range(run * valuesToPutPerRun, (run + 1) * valuesToPutPerRun)
                          .forEach(i -> testCacheBeforeReduction.put(i, Integer.toString(i)));
                  cacheManager.stop();
                  cacheManager = new DefaultCacheManager();
              }
          }
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                rvansa Radim Vansa
                Reporter:
                apabst Andreas Pabst
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: