NealSun96 commented on a change in pull request #788: WIP: Implement request 
forwarding for ZkRoutingDataWriter
URL: https://github.com/apache/helix/pull/788#discussion_r382354444
 
 

 ##########
 File path: 
helix-rest/src/main/java/org/apache/helix/rest/server/resources/metadatastore/MetadataStoreDirectoryAccessor.java
 ##########
 @@ -153,9 +161,13 @@ public Response getShardingKeys(@QueryParam("realm") 
String realm) {
   public Response addShardingKey(@PathParam("realm") String realm,
       @PathParam("sharding-key") String shardingKey) {
     try {
-      _metadataStoreDirectory.addShardingKey(_namespace, realm, shardingKey);
+      if (!_metadataStoreDirectory.addShardingKey(_namespace, realm, 
shardingKey)) {
+        return serverError();
 
 Review comment:
   Here are the situations where this condition can be invoked:
   1. When the request forwarded to the leader instance returns a non-ok;
   2. When the request forwarded to the leader raises an IOException;
   3. When writing to ZooKeeper fails. 
   All of them happen on the layer of `ZkRoutingDataWriter`. I'll need some 
advice on how to propagate the correct information back to the REST layer - I 
do not see an easy way to do this. 
   At the same time, I believe it's unnecessary to let clients know the exact 
situation among these 3 situations, because these situations are unrelated to 
client input and there's nothing clients can do. All these situations are 
strictly internal errors and are out of the hands of clients. 

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