Re: Cannot recreate cache after cache.destroy()

2016-09-22 Thread vkulichenko
Hi Alex,

You're right. I created a ticket for this issue:
https://issues.apache.org/jira/browse/IGNITE-3957

-Val



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


Re: Cannot recreate cache after cache.destroy()

2016-09-16 Thread aosmakoff
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 cache =
igniteNode.cache("workspace");
WorkspaceDao workspaceDao = new WorkspaceDaoImpl(cache);
Long workspaceId = 1L;
List> 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.


Re: Cannot recreate cache after cache.destroy()

2016-09-06 Thread aosmakoff
Val, the suggested workaround did work. This tells me though that somewhere
in your copy constructor for CacheConfiguration you are using a *shallow*
copy of the statefull content. 
Thanks for your help,
Alex  



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


Re: Cannot recreate cache after cache.destroy()

2016-08-30 Thread vkulichenko
Hi,

I noticed that you're reusing the CacheConfiguration when you recreate the
cache:

CacheConfiguration cacheCfg = new
CacheConfiguration(cache.getConfiguration(CacheConfiguration.class));

This looks suspicious and can be the reason for the issue. Please try to
create brand new configuration each time.

-Val



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


Re: Cannot recreate cache after cache.destroy()

2016-08-28 Thread aosmakoff
org.apache.ignite.cache.CachePartialUpdateException: Failed to update keys
(retry update if possible).:
[au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aede9edc,
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aedf92dd,
 
..
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aedeb923,
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aedf9e20]
at
org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1608)
at
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.cacheException(IgniteCacheProxy.java:1931)
at
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.putAll(IgniteCacheProxy.java:1181)
at
au.com.macquarie.rmg.aggengine.service.workspace.dao.WorkspaceDaoImpl.insertItems(WorkspaceDaoImpl.java:34)
at
au.com.macquarie.rmg.gims.ApplicationTriggerTest.testItemSearch(ApplicationTriggerTest.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: class
org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException:
Failed to update keys (retry update if possible).:
[au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aede9edc,
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aedf92dd,
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aede8fd8,
 
.
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aedeb923,
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey@aedf9e20]
at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$UpdateState.addFailedKeys(GridNearAtomicUpdateFuture.java:1241)
at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture$UpdateState.onResult(GridNearAtomicUpdateFuture.java:661)
at
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateFuture.onResult(GridNearAtomicUpdateFuture.java:344)
at

Re: Cannot recreate cache after cache.destroy()

2016-08-25 Thread vkulichenko
Hi,

Please provide the whole trace.

-Val



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