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-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

Cannot recreate cache after cache.destroy()

2016-08-25 Thread aosmakoff
Our use case includes clearing the cache at the end of the day and
repopulating it with new content. With a size of the cache in 1.5M records
cache.clear() works extremely slowly and we use cache.destroy(), creating a
new cache and populating it with a new content. As this works as long as all
the cache content is in memory, in case of having an EvictionPolicy defined
for the cache that specifies sizeMax and the cache content exceeds this
size, any attempt of repopulating the new cache fails with
CachePartialUpdateException: Failed to update keys

//Below is the unit test: 
IgniteCache cache =
igniteNode.cache("workspace");
WorkspaceDao workspaceDao = new WorkspaceDaoImpl(cache);
Long workspaceId = 1L;
List> objects = 
createTestObjects(100);
workspaceDao.insertItems(workspaceId, objects); //uses 
cache.putAll();

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

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) {
throw e;
}
System.out.println("Inserted");
//Cache configuration:




  
au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItemKey

au.com.macquarie.rmg.aggengine.service.workspace.domain.WorkspaceItem












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


Re: Continuous Query

2016-06-30 Thread aosmakoff
In my case the remote filters are being called and return true appropriately,
however it seems that the local listeners are not always being called. I am
trying to understand what could be going wrong, starting with ruling out a
possible misunderstanding of the framework behavior regarding events
propagation.
I will keep looking for the possible cause and will give you an update
later.




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Continuous-Query-tp5981p6032.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Continuous Query

2016-03-06 Thread aosmakoff
Hi there.I found that for Ignite V 1.5.6 and 1.5.7 Continuous query stop
working while it worked for V1.5.3.My code follows the manual:// Create new
continuous query.ContinuousQuery query = new ContinuousQuery();
query.setInitialQuery(sql); query.setRemoteFilter(new
CacheEntryEventSerializableFilter() {  public boolean
evaluate(CacheEntryEvent event) throws... {   

return satisfyCondition(event.getValue());  }   
});
query.setLocalListener(new CacheEntryUpdatedListener() {   public 
void
onUpdated(Iterable>
itrEvent)...{   
// received the value - done};  
  });
QueryCursor> items =
 
(QueryCursor>) cache.query(query);   if (items != null) {

}The same code (like above) runs in V1.5.3 propagating from the
Remote filter to the Local listener (when the condition returns TRUE) and
with 1.5.6 onward the listener is not invoked though the filter receives the
notification and return TRUE.If this is not due to the intended changes in
how the CQ gets handled, this must be a bug in the corresponding
versions.Many thanks,Alex  



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Continuous-Query-tp3383.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.