0

We can use Ignite's ScanQuery object for example to query only a local cache for entries. Like this:

    ScanQuery<Object, Object> qry = new ScanQuery<>()
                    .setLocal(true);

Now, if we have a cache with cacheConfiguration.setBackups(1), is there any way to query only backup entries, locally stored on a node?

It is possible if we use

igniteCache.localEntries(CachePeekMode.BACKUP);

But, I would really need a ScanQuery here, for its setPageSize method.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Kristoff
  • 326
  • 2
  • 13

1 Answers1

1

It's not possible to use ScanQuery on local node only from backups, so, I think you should use

igniteCache.localEntries(CachePeekMode.BACKUP)

for this case.

By the way, what is your use case? Maybe I can recommend something better for you.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Evgenii Zhuravlev
  • 2,987
  • 1
  • 9
  • 15
  • Hi Evgenii, Thank you for your response. It seams that `igniteCache.localEntries` is the only way. In our use case, we are using offheap mode + Ignite's native persistent storage. But we would like to have the possibility to, lets say "archive" all local entries (primary and backup) stored on a node for particular cache and "save" them in a file. The problem with `igniteCache.localEntries` is that we are not sure if as a result, entries from local caches would be "transferred" to heap by calling `igniteCache.localEntries` which returns `Iterable>` – Kristoff Aug 31 '17 at 19:10
  • In both cases, with ScanQuery and with igniteCache.localEntries, entries will be transferred to heap from offheap – Evgenii Zhuravlev Sep 01 '17 at 07:33
  • Hey, thanks. With `ScanQuery` it can be done in batches if I'm correct. According to last post from [IgniteUserList](http://apache-ignite-users.70518.x6.nabble.com/Pagination-to-fetch-complete-Cache-data-td3071.html#a6370) with _pageSize_ attribute. `This means that client will fetch rows in pages discarding old ones, so that you never have more than 10 rows in local memory at the same time.` Which is ok for us, if we could query the backup entries too. – Kristoff Sep 01 '17 at 07:47
  • answered to your question on Ignite user list: http://apache-ignite-users.70518.x6.nabble.com/IgniteCache-localEntries-CachePeekMode-peekModes-result-tc16606.html – Evgenii Zhuravlev Sep 01 '17 at 10:35