narendly commented on a change in pull request #799: [MSDS] Add REST endpoint
to get mapping of all sharding keys by realm
URL: https://github.com/apache/helix/pull/799#discussion_r382970187
##########
File path:
helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
##########
@@ -111,6 +111,16 @@ public ZkMetadataStoreDirectory(Map<String, String>
routingZkAddressMap)
return allShardingKeys;
}
+ @Override
+ public Map<String, List<String>> getShardingKeysByRealm(String namespace) {
+ Map<String, List<String>> shardingKeysByRealmMap =
_realmToShardingKeysMap.get(namespace);
+ if (shardingKeysByRealmMap == null) {
+ throw new NoSuchElementException("Namespace " + namespace + " does not
exist!");
+ }
+
+ return shardingKeysByRealmMap;
Review comment:
That's a very good point and I am glad that you've considered potential
cases like the one you described in your comments.
The potential race condition you raised would be valid if we allowed
`namespace`s to be removed, but thanks to the way we define namespaces, they
are never removed (only updated). So I don't think we need to be worried about
that particular race condition here - do you agree? If so, we could simplify
the code as originally suggested.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]