3 Replies Latest reply on Jan 24, 2013 10:48 PM by Ges George

    FileCache store not writing entries, init, start called and no obvious attempt to create buckets or write files.

    Megan Woods Newbie

      Hi Folks, happy new year etc.

       

      I am not seeing entries written to the file system during a cache.put(), stepping through the code during startup the init() and start() methods of the FileCacheStore are called.

       

      When I put an entry into this cache, FileCacheStrore.loadBucket() is called which returns null as there are no bucket files to load.

       

      Brake points on other methods in FileCacheStore are not being triggered, so I can only assume the writing of entries happens elsewhere.

       

      My understanding is that is passivation is set false then the following will occur "When passivation is disabled, whenever an element is modified, added or removed, then that modification is persisted in the backend store via the cache loader."

       

      The problem is that I am just not seeing this persistence in the FileCacheStore and in the directory "./tmpdir", there is a sub directory for the cache but no files are created.

       

      If any one has any suggestions please let know, I am assuming the issue is with my configuration.

       

      I have tried the following with 5.1.6.FINAL and 5.2.0.Beta6.

       

       

      Cheers Megan Woods

       

       

            final String location = "./tmpdir/";

             File f = new File(location);

             f.mkdirs();

             System.out.println(f.getCanonicalPath());

              ConfigurationBuilder confBuild = new ConfigurationBuilder();

              confBuild.loaders()

                      .passivation(false).shared(false).preload(true)

                      .addFileCacheStore()

                      .fsyncMode(FileCacheStoreConfigurationBuilder.FsyncMode.DEFAULT)

                      .fetchPersistentState(true)

                      .purgerThreads(3)

                      .purgeSynchronously(true)

                      .ignoreModifications(false)

                      .purgeOnStartup(false)

                      .location(location)

                      .async()

                      .enabled(true)

                      .flushLockTimeout(15000)

                      .threadPoolSize(5)

                      .singletonStore()

                      .enabled(true)

                      .pushStateWhenCoordinator(true)

                      .pushStateTimeout(20000);

       

               DefaultCacheManager dcm = new DefaultCacheManager(confBuild.build());

               dcm.start();

               Cache ch = dcm.getCache(CacheProviderConstants.RUNTIME_CACHE);

       

              ch.addListener(new InfiniSpanListener());

              ch.start();

       

               for (int t = 0; t < 10; t++) {

                  ch.put(UUID.randomUUID(), "The cat sat on the mat");

              }

       

              dcm.stop();

        • 1. Re: FileCache store not writing entries, init, start called and no obvious attempt to create buckets or write files.
          Manik Surtani Master

          Looks like you've configured the cache store to persist asynchronously (see the .async() part of your config).  Try commenting this bit out and you should see the cache store persisting with every put().

           

          Your test is pretty short, so the asynchronous persistence thread probably hasn't had time to catch up. 

          • 3. Re: FileCache store not writing entries, init, start called and no obvious attempt to create buckets or write files.
            Ges George Newbie

            Hi,

             

            I seem to have a similar problem with the FileCacheStore where I do not see any files persisted to the file system. I'm using the latest release - 5.2.0.CR2. Here is what I'm trying.

             

             

                public static void main(String[] args) throws IOException, InterruptedException {

                    final DefaultCacheManager defaultCacheManager = cacheConfiguration();

                    defaultCacheManager.start();

             

             

                    final Cache<String, String> infinispanTest = defaultCacheManager.getCache("infinispanCache", true);

                    infinispanTest.start();

             

             

                    writeToCache(infinispanTest);

                    infinispanTest.stop();

                    defaultCacheManager.stop();

             

             

                }

             

             

                static void writeToCache(Cache<String, String> cache) {

                    final String keyPrefix = "key";

                    final String valuePrefix = "value";

             

             

                    for (int i = 0; i < 1000; i++) {

                        cache.put(keyPrefix + i, valuePrefix + i);

                    }

                }

             

             

                static DefaultCacheManager cacheConfiguration() throws IOException {

                    final ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

                    final SingletonStoreConfigurationBuilder<FileCacheStoreConfigurationBuilder> builder = configurationBuilder.loaders()

                            .passivation(false).shared(false).preload(true)

                            .addFileCacheStore()

                            .fsyncMode(FileCacheStoreConfigurationBuilder.FsyncMode.PER_WRITE)

                            .fetchPersistentState(true)

                            .purgerThreads(3)

                            .purgeSynchronously(true)

                            .ignoreModifications(false)

                            .purgeOnStartup(false)

                            .location("C:/Temp/test/")

                            .singletonStore()

                            .enabled(true);

                    final DefaultCacheManager defaultCacheManager = new DefaultCacheManager(builder.build());

                    return defaultCacheManager;

                }

             

             

            Appreciate your help in resolving this.