Search code examples
javagridgainignite

IgniteException: Query execution failed ScanQuery


I encounter this exception using Ignite

class org.apache.ignite.IgniteException: Query execution failed: GridCacheQueryBean [qry=GridCacheQueryAdapter [type=SCAN, clsName=null, clause=null, filter=org.apache.ignite.yardstick.cache.IgniteScanQueryBenchmark$1@5cbed480, part=null, incMeta=false, metrics=GridCacheQueryMetricsAdapter [minTime=41, maxTime=41, avgTime=41.0, execs=1, fails=1, executed=true], pageSize=1024, timeout=0, keepAll=true, incBackups=false, dedup=false, prj=null, keepPortable=false, subjId=0ae47ff7-9cc1-4b57-88cf-8453f5f21625, taskHash=0], rdc=null, trans=null]
at org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.next(GridCacheQueryFutureAdapter.java:166)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy$2.onHasNext(IgniteCacheProxy.java:406)
at org.apache.ignite.internal.util.GridCloseableIteratorAdapter.hasNextX(GridCloseableIteratorAdapter.java:53)
at org.apache.ignite.internal.util.lang.GridIteratorAdapter.hasNext(GridIteratorAdapter.java:45)
at org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:71)

And my code

 IgniteBiPredicate<Integer, Person> filter = new IgniteBiPredicate<Integer, Person>() {
        @Override
        public boolean apply(Integer key, Person p) {
            return p.getSalary() >= minSalary && p.getSalary() <= maxSalary;
        }
    };

    QueryCursor<Person> cursor = cache.query(new ScanQuery(filter));

    return cursor.getAll();

whats wrong with my code

version

ver. 1.2.0-incubating#20150616-sha1:9fb960ff 2015 Copyright(C) Apache Software Foundation


Solution

  • Your code looks correct. But did you provide the whole trace? It should have the cause which gives much more information about the reasons of the failure. You can also check remote nodes logs.

    Most likely you had some kind of serialization error. Try the following:

    • Convert your predicate to a top level class. Anonymous class has reference to the parent object, so it's possible that you're serializing something that should not be serialized.
    • Make sure that the predicate class is available on all nodes.