NealSun96 commented on a change in pull request #844: Implement setRoutingData
for MetadataStoreDirectoryService
URL: https://github.com/apache/helix/pull/844#discussion_r386743515
##########
File path:
helix-rest/src/main/java/org/apache/helix/rest/metadatastore/ZkMetadataStoreDirectory.java
##########
@@ -113,10 +113,14 @@ private void init(String namespace, String zkAddress)
throws InvalidRoutingDataE
_routingDataWriterMap.put(namespace, new
ZkRoutingDataWriter(namespace, zkAddress));
// Populate realmToShardingKeys with ZkRoutingDataReader
- _realmToShardingKeysMap
- .put(namespace,
_routingDataReaderMap.get(namespace).getRoutingData());
- _routingDataMap
- .put(namespace, new
TrieRoutingData(_realmToShardingKeysMap.get(namespace)));
+ Map<String, List<String>> rawRoutingData =
+ _routingDataReaderMap.get(namespace).getRoutingData();
+ _realmToShardingKeysMap.put(namespace, rawRoutingData);
+ try {
+ _routingDataMap.put(namespace, new
TrieRoutingData(rawRoutingData));
+ } catch (InvalidRoutingDataException e) {
+ // Do not create TrieRoutingData if the routing data is invalid
Review comment:
We are not throwing any exception because we allow this to happen. For logs,
it's a good point - in my opinion, logging this may pollute the main log
because in most cases this situation isn't even qualified as an error (when a
namespace is initialized, this exception clause will happen because
`rawRoutingData` is empty, which is a normal situation); however, when this is
an actual error situation, it's better to log it. Since this logic is in data
change callback, it's very easy to spam logs that are non-essential in this
case, hence why I didn't log anything here.
Since I have conflicting views myself, I'm open to your suggestions.
----------------------------------------------------------------
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]