You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Yakov Zhdanov <yz...@apache.org> on 2015/02/07 12:36:34 UTC

fastest way to check if backup

Guys,

cctx.affinity().backups(entry.key(),
cctx.topology().topologyVersion()).contains(cctx.localNode())

does not seem to be fast enough.

cctx.affinity().backups() returns F.view() over ArrayList with excluded
first element which always ends up into an iteration.

Alex G, thoughts?

--Yakov

Re: fastest way to check if backup

Posted by Alexey Goncharuk <al...@gmail.com>.
I do not see how we can avoid iteration in a general case because cache can
have more than one backup. But I think it makes sense to create a separate
method which will not use views and will start iteration from the second
element of nodes collection (which is always an ArrayList).

2015-02-07 3:36 GMT-08:00 Yakov Zhdanov <yz...@apache.org>:

> Guys,
>
> cctx.affinity().backups(entry.key(),
> cctx.topology().topologyVersion()).contains(cctx.localNode())
>
> does not seem to be fast enough.
>
> cctx.affinity().backups() returns F.view() over ArrayList with excluded
> first element which always ends up into an iteration.
>
> Alex G, thoughts?
>
> --Yakov
>