Hi Val,
We discovered that in the test above following your suggestion the cache
gets recreated and however the part swapped to the disk has not been
cleared. The file is still there after cache.destroy() gets called. The
cache swapSize does not go to 0 either. The newly created cache allows new
values but when it starts swapping to disk the file grows. Below is the test
case we've used:
        @Test
        public void testItemSearch() throws Exception {
                IgniteCache<WorkspaceItemKey, WorkspaceItem> cache =
igniteNode.cache("workspace");
                WorkspaceDao workspaceDao = new WorkspaceDaoImpl(cache);
                Long workspaceId = 1L;
                List<AbstractAuditable&lt;Long>> objects = 
createTestObjects(1000);
                workspaceDao.insertItems(workspaceId, objects); //uses 
cache.putAll();
                
                //CacheConfiguration cacheCfg = new
CacheConfiguration(cache.getConfiguration(CacheConfiguration.class));
                CacheConfiguration oldConfig =
cache.getConfiguration(CacheConfiguration.class);
                CacheConfiguration cacheCfg = new CacheConfiguration();
                cacheCfg.setName("workspace");
                
cacheCfg.setIndexedTypes(WorkspaceItemKey.class,WorkspaceItem.class);
                LruEvictionPolicy evictPlc = new LruEvictionPolicy();
                evictPlc.setMaxSize(100);
                cacheCfg.setEvictionPolicy(evictPlc);
                cacheCfg.setCacheMode(oldConfig.getCacheMode());
                cacheCfg.setAtomicityMode(oldConfig.getAtomicityMode());
                cacheCfg.setRebalanceMode(oldConfig.getRebalanceMode());
        
cacheCfg.setWriteSynchronizationMode(oldConfig.getWriteSynchronizationMode());
                cacheCfg.setBackups(oldConfig.getBackups());
                cacheCfg.setSwapEnabled(oldConfig.isSwapEnabled());
                cacheCfg.setStartSize(oldConfig.getStartSize());
                
                
                cache.destroy();
                
                cache = null;
                try {
                        cache = igniteNode.getOrCreateCache(cacheCfg);
                        System.out.println("Closed=" + cache.isClosed());
        
                        workspaceDao = new WorkspaceDaoImpl(cache);
                        workspaceDao.insertItems(workspaceId, objects); //uses 
cache.putAll();
                } catch (Exception e) {
                        e.printStackTrace();
                        throw e;
                }
                System.out.println("Inserted");
        }
  



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Cannot-recreate-cache-after-cache-destroy-tp7291p7787.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to