NealSun96 commented on a change in pull request #751: Implement 
getAllMappingUnderPath and getMetadataStoreRealm
URL: https://github.com/apache/helix/pull/751#discussion_r377857618
 
 

 ##########
 File path: 
helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataReader.java
 ##########
 @@ -85,23 +85,14 @@ public ZkRoutingDataReader(String namespace, String 
zkAddress,
           "Routing data directory ZNode " + 
MetadataStoreRoutingConstants.ROUTING_DATA_PATH
               + " does not exist. Routing ZooKeeper address: " + _zkAddress);
     }
-    if (children == null || children.isEmpty()) {
-      throw new InvalidRoutingDataException(
-          "There are no metadata store realms defined. Routing ZooKeeper 
address: " + _zkAddress);
-    }
     for (String child : children) {
       ZNRecord record =
           _zkClient.readData(MetadataStoreRoutingConstants.ROUTING_DATA_PATH + 
"/" + child);
       List<String> shardingKeys =
           
record.getListField(MetadataStoreRoutingConstants.ZNRECORD_LIST_FIELD_KEY);
-      if (shardingKeys == null || shardingKeys.isEmpty()) {
-        throw new InvalidRoutingDataException(
-            "Realm address ZNode " + 
MetadataStoreRoutingConstants.ROUTING_DATA_PATH + "/" + child
-                + " does not have a value for key "
-                + MetadataStoreRoutingConstants.ZNRECORD_LIST_FIELD_KEY
-                + ". Routing ZooKeeper address: " + _zkAddress);
+      if (shardingKeys != null && !shardingKeys.isEmpty()) {
+        routingData.put(child, shardingKeys);
 
 Review comment:
   My opinion is that if a realm doesn't have sharding keys, it shouldn't be a 
part of the routing data, because it isn't providing "routing". Although I can 
understand that whoever tries to get all routing data may get surprised if the 
realm disappears. 
   If we are adding empty lists, I would have to change the behavior here also: 
https://github.com/apache/helix/pull/731/files#diff-cd0252f86478a5ece76fb628cd7edbfcR170
 

----------------------------------------------------------------
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]

Reply via email to