Search code examples
gridgain

primaryValues() and values() return same result in REPLICATED-MODE


I just found that if cache is in REPLICATED mode, primaryValues() and values() will return same result. is this by design?

Little confused because I know that REPLICATED mode is internally treated as PARTIONED - mode , so i can still iterate over primary set and have key-node affinity available. so how can I iterate only primary set of a REPLICATED cache on a node?

here is the code snipet I use :

 GridCache<Long, Entity> cache= g.cache("REPLICATED");
 Collection<Entity>  result = cache.primaryValues();
// Collection<Entity>  result = cache.values();

Solution

  • Replicated cache had explicit logic to return the whole data set for primaryValues(). I agree with you - this is not correct behavior. It will be fixed in 6.5.6 release coming out shortly.