Hi All,
We are seeing an issue with calculating size of few caches in our
application, only when there
are more than one server node is started at the same time.
As part of startup routine, we have a custom load routine to load data to
cache, and once load is successfully complete, then cache size is
calculated.
Below is the error observed in the log when the size() method is invoked:
{"eventTime" : "Oct 20 2017 10:50:25.698 AM PDT", "thread" :
"CacheExecutor-3", "level" : "ERROR", "class" : "com.service.CacheManager",
"method" : "lambda$doLoad$146", "message" : ""}
java.lang.ClassCastException: org.apache.ignite.lang.IgniteBiTuple cannot be
cast to java.lang.Integer
at
java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:210)
at
java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at
java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at
java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.IntPipeline.reduce(IntPipeline.java:456)
at java.util.stream.IntPipeline.sum(IntPipeline.java:414)
at com.cache.RangeCache.size(RangeCache.java:369)
public int size() {
return((IgniteCache<Object, Entity>)cache)
.query(new ScanQuery<Object, Entity>(),
(entry) ->
((CompositeEntity)entry.getValue()).size())
.getAll()
.stream()
.mapToInt(Integer::intValue)
.sum();
}
Note: Entity is a custom interface for cache entities, and
CompositeEntity
implements Entity.
Please let us know if there if you find any issue with above method of
calculating cache size.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/