Can we use pagination while fetching the complete cache data..
I am using below method for fetching complete Cache data, but it is taking
too much time :
ScanQuery<String, [CacheObject]> scanQuery = new ScanQuery<String,
[CacheObject]>()
QueryCursor<javax.cache.Cache.Entry<String, [CacheObject]>> cursor =
cache.query(scanQuery);
I tired using below method also, but i am getting exception:
QueryCursor<Cache.Entry<Integer, [CacheObject]>> result =
cache.query(new SqlQuery<Integer, [CacheObject]>([CacheObject].class,
"select * from [CacheName]"));
result.getAll()
*Exception in thread "main" javax.cache.CacheException: Failed to run reduce
query locally.*
at
org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:673)
at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$2.iterator(IgniteH2Indexing.java:956)
at
org.apache.ignite.internal.processors.cache.QueryCursorImpl.iterator(QueryCursorImpl.java:61)
at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$3.iterator(IgniteH2Indexing.java:990)
at
org.apache.ignite.internal.processors.cache.QueryCursorImpl.iterator(QueryCursorImpl.java:61)
at
org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:73)
at com.test.ignite.query.QueryFetch2.queryPrices(QueryFetch2.java:83)
at com.test.ignite.query.QueryFetch2.main(QueryFetch2.java:52)
Caused by: java.lang.NullPointerException
at
org.apache.ignite.internal.processors.query.h2.twostep.GridMergeIndexUnsorted$1.hasNext(GridMergeIndexUnsorted.java:97)
Cache Configurations I am using:
CacheConfiguration<Object, Object> cacheConfig = new
CacheConfiguration<>(cacheName);
cacheConfig.setCacheMode(CacheMode.REPLICATED);
cacheConfig.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
cacheConfig.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new
Duration(TimeUnit.MINUTES, 60)));
cacheConfig.setEvictionPolicy(new LruEvictionPolicy(50000));
cacheConfig.setOffHeapMaxMemory(0);
cacheConfig.setSwapEnabled(false);
cacheConfig.setBackups(1);
cacheConfig.setAtomicityMode(CacheAtomicityMode.ATOMIC);
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Pagination-to-fetch-complete-data-tp3071.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.