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

 ##########
 File path: 
helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
 ##########
 @@ -90,7 +117,24 @@ public synchronized boolean 
deleteMetadataStoreRealm(String realm) {
       return _zkClient.delete(MetadataStoreRoutingConstants.ROUTING_DATA_PATH 
+ "/" + realm);
     }
 
-    // TODO: Forward the request to leader
+    String leaderHostName = _leaderElection.getCurrentLeaderInfo().getId();
+    String url =
+        leaderHostName + "/admin/v2/namespaces/" + _namespace + 
"/metadata-store-realms/" + realm;
+    HttpDelete deleteRequest = new HttpDelete(url);
+    try {
+      HttpResponse response = _forwardHttpClient.execute(deleteRequest);
+      if (response.getStatusLine().getStatusCode() != 200) {
+        HttpEntity respEntity = response.getEntity();
+        LOG.error("the forwarded request to leader has failed for 
deleteMetadataStoreRealm: {}",
+            respEntity != null ? EntityUtils.toString(respEntity) : "");
 
 Review comment:
   Why is the ternary necessary?
   
   Did you meant to have a log msg like:
   
   "the forwarded request to leader has failed for deleteMetadataStoreRealm:  "?

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