Hello!

Do you issue your cache operations from event listener thread? This might
be unsafe and also not return the expected results. Event listeners are
invoked from internal threads.

Consider issuing a task to public pool from event listener, and then
returning. I would expect that task will run when rebalance already takes
place.

Regards,
-- 
Ilya Kasnacheev


пт, 3 июл. 2020 г. в 11:17, ssansoy <s.san...@cmcmarkets.com>:

> Hi Ignite users,
>
> I have 3 nodes running, with a cache with the following configuration:
>
> cacheConfiguration.setCacheMode(CacheMode.PARTITIONED);
> cacheConfiguration.setBackups(1);
> cacheConfiguration.setRebalanceMode(CacheRebalanceMode.SYNC);
>
> cacheConfiguration.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
> cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
>
> E.g. a partitioned cache with 1 backup - so if one of the three nodes goes
> down, all the data is still available across the remaining 2 nodes.
>
> I also have some custom code that runs on the current "leader". E.g. the
> server code runs some tasks if it is the leader node - defined as being the
> "oldest node".
> The code running on each server registers a listener for
>
> {EventType.EVT_NODE_SEGMENTED,
> EventType.EVT_NODE_FAILED,EventType.EVT_NODE_LEFT}
>
> And if it discovers that it is now the new leader, the tasks restart on the
> new "oldest node".
>
> This works fine. The issue I am having is that one of these tasks that runs
> on the leader, needs to issue a cache query to do some work.
>
> I am finding, if one of my three nodes drops off, when one of the remaining
> two nodes becomes the leader and resumes the work, the records it gets back
> from the cache are incomplete. E.g. there may be 400 entries in the cache,
> but when node 1 drops off and node 2 takes over - it only sees 250, or some
> other number less than 400. A little later, this does correctly return to
> 400 - I expect because the exchange process has completed behind the scenes
> and the node now has all the data it needs.
>
> I am a little surprised by this however, because I am using
> CacheRebalanceMode.SYNC which suggests from the docs here:
> https://apacheignite.readme.io/docs/rebalancing that
>
> "This means that any call to cache public API will be blocked until
> rebalancing is finished."
>
> E.g. if I call ignite.cache("MYCACHE").size() (a public cache method) then
> this should not return an incomplete number, but rather block until the
> underlying rebalance has completes and then only return 400.
>
> Does anyone have any pointers to what I might be doing wrong here? Thanks!
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Reply via email to