[
https://issues.jboss.org/browse/ISPN-4583?page=com.atlassian.jira.plugin....
]
William Burns commented on ISPN-4583:
-------------------------------------
There is an issue with the iteration process on a cache loader where it assumes it was a
CacheEntry<K, V> instead of V. The tests pass because they don't actually
iterate on the contents properly as the values are ignored because they are either found
in memory or through activation.
Distributed iterator throws ClassCastException when LevelDB cache
store contains passivated entries
---------------------------------------------------------------------------------------------------
Key: ISPN-4583
URL:
https://issues.jboss.org/browse/ISPN-4583
Project: Infinispan
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Core
Affects Versions: 7.0.0.Alpha5
Reporter: Alan Field
Assignee: William Burns
Attachments: repl-udp-no-tx-leveldb-jni.xml
This code will iterate over all of the entries in a cache to get the total size:
{code:java}
public int getTotalSize() {
log.info(getClass().getName() + ".getTotalSize() for cache " +
cache.getName());
int totalSize = 0;
EntryIterable entryIterator = null;
try {
entryIterator = cache.filterEntries(new AllEntriesFilter());
CloseableIterable ci = entryIterator.converter(new AllEntriesConverter());
Iterator iter = ci.iterator();
while (iter.hasNext()) {
iter.next();
totalSize++;
}
return totalSize;
} finally {
if (entryIterator != null) {
try {
entryIterator.close();
} catch (Exception e) {
log.error("Failed to close EntryIterable", e);
}
}
}
}
{code}
I wanted to verify that this code would also work when I was using passivation and a
cachestore. The repl-udp-no-tx-leveldb-jni.xml file defines the configuration that I am
using. I run a test that puts random data into the cache then checks the size of the
cache, but I am getting a bunch of ClassCastException exceptions during the iteration:
{noformat}
java.lang.ClassCastException: java.lang.String cannot be cast to
org.infinispan.container.entries.InternalCacheEntry
at
org.infinispan.iteration.impl.LocalEntryRetriever$MapAction.apply(LocalEntryRetriever.java:251)
at
org.infinispan.iteration.impl.LocalEntryRetriever$KeyValueActionForCacheLoaderTask.processEntry(LocalEntryRetriever.java:154)
at org.infinispan.persistence.leveldb.LevelDBStore$1.call(LevelDBStore.java:297)
at org.infinispan.persistence.leveldb.LevelDBStore$1.call(LevelDBStore.java:285)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
org.infinispan.util.concurrent.WithinThreadExecutor.execute(WithinThreadExecutor.java:22)
at
java.util.concurrent.ExecutorCompletionService.submit(ExecutorCompletionService.java:181)
at
org.infinispan.executors.ExecutorAllCompletionService.submit(ExecutorAllCompletionService.java:31)
at
org.infinispan.persistence.leveldb.LevelDBStore.submitProcessTask(LevelDBStore.java:285)
at
org.infinispan.persistence.leveldb.LevelDBStore.process(LevelDBStore.java:260)
at
org.infinispan.persistence.manager.PersistenceManagerImpl.processOnAllStores(PersistenceManagerImpl.java:438)
at
org.infinispan.persistence.manager.PersistenceManagerImpl.processOnAllStores(PersistenceManagerImpl.java:420)
at
org.infinispan.iteration.impl.LocalEntryRetriever$1.run(LocalEntryRetriever.java:217)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)