Bug 1252889
Summary: | Cache.getAdvancedCache().getDistributionManager().getLocality always returns true | ||
---|---|---|---|
Product: | [JBoss] JBoss Data Grid 6 | Reporter: | Shay Matasaro <smatasar> |
Component: | Documentation | Assignee: | Christian Huffman <chuffman> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | |
Severity: | unspecified | Docs Contact: | |
Priority: | high | ||
Version: | 6.5.0 | CC: | afield, chuffman, jdg-bugs, mgencur, paul.ronane, ttarrant, wfink |
Target Milestone: | Post GA | ||
Target Release: | 6.5.1 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-10-30 12:32:24 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Shay Matasaro
2015-08-12 12:57:15 UTC
Shay, I think getLocality() returns LOCAL even for backup nodes, not just primaries. You should probably change your code to use getPrimaryLocation() instead. We can consider adding primary information to the DataLocality object. Hi Tristan, I remember reading a comment you made about getLocality() not working on a forum in the community edition. But the above doesn't work either. Please take a look at the code. Where we have a key(runIdKey3) that is not in the cache the following statement returns true: org.infinispan.remoting.transport.Address nodeAddress = paramCache.getCacheManager().getAddress(); org.infinispan.remoting.transport.Address address = paramCache.getAdvancedCache().getDistributionManager().getPrimaryLocation(key); if(nodeAddress.equals(address)) { The fundamental issue is the same, the key that doesn't exist for any of these methods returns the local node address Thanks Paul Hi, I have seen a comment on this bug -> https://bugzilla.redhat.com/show_bug.cgi?id=1251977 I find this quite strange really, own means the hashing function used, own is not very clear here. You can't own something you don't have. It seems the only real way to check where a key doesnt exist is a null check which i was previously doing and using getPrimaryLocation... Thanks Paul Tristan, if that is the case I'll switch this to a documentation bug , so that getLocality gets a much better description and so does getPrimaryLocation "Ownership" as defined by the DistributionManager (and the underlying ConsistentHash) is theoretical: both of those constructs have no knowledge about the data in the cache, but are just used to determine on which node a specified key would be stored. Therefore to determine if an entry exists and where you would need to either ask both the cache (cache.getAdvancedCache().withFlags(SKIP_REMOTE_LOOKUP).containsKey(key) && cache.getAdvancedCache().getDistributionManager().getLocality(key).isLocal()). Alternatively you can query the DataContainer directly: cache.getAdvancedCache().getDataContainer().containsKey(key) If the entry is passivated the above will return false. This section has been published and is available on the customer portal at the following link: https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Data_Grid/6.5/html-single/Developer_Guide/index.html#Distributed_Execution_and_Locality |