rkirtir commented on code in PR #4901:
URL: https://github.com/apache/hive/pull/4901#discussion_r1413073299


##########
llap-client/src/java/org/apache/hadoop/hive/registry/impl/ZkRegistryBase.java:
##########
@@ -353,6 +356,23 @@ protected final void updateServiceRecord(
     }
   }
 
+  protected void ensurePersistentNodePath(ServiceRecord srv) throws 
IOException {
+    try {
+      String pNodePath = "/" + PATH_JOINER.join(namespace, 
StringUtils.substringBetween(workersPath, "/", "/"),

Review Comment:
   In order have test arount this code, I have pulled it in different method 
-getPersistentNodePath
   and added a unit test TestLlapZookeeperRegistryImpl.testPersistentNodePath



##########
llap-client/src/java/org/apache/hadoop/hive/registry/impl/ZkRegistryBase.java:
##########
@@ -353,6 +356,26 @@ protected final void updateServiceRecord(
     }
   }
 
+  protected void ensurePersistentNodePath(ServiceRecord srv) throws 
IOException {
+    try {
+      String pNodePath = "/" + PATH_JOINER.join(namespace, 
StringUtils.substringBetween(workersPath, "/", "/"),
+          "pnode0");
+      LOG.info("Check if persistent node  path {}  exists, create if not", 
pNodePath);
+      if (zooKeeperClient.checkExists().forPath(pNodePath) == null) {
+        
zooKeeperClient.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT)
+            .forPath(pNodePath, encoder.toBytes(srv));
+        LOG.info("Created persistent path at: {}", pNodePath);
+      }
+    } catch (Exception e) {
+      // throw exception if it is other than NODEEXISTS.
+      if (!(e instanceof KeeperException) || ((KeeperException) e).code() != 
KeeperException.Code.NODEEXISTS) {
+        LOG.error("Unable to create a persistent znode for this server 
instance", e);
+        throw new IOException(e);
+      }else{

Review Comment:
   fixed



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to