narendly commented on a change in pull request #642: Fix zk session race 
condition before creating a live instance
URL: https://github.com/apache/helix/pull/642#discussion_r353569791
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/zookeeper/ZkClient.java
 ##########
 @@ -531,12 +558,29 @@ public String create(final String path, Object datat, 
final List<ACL> acl, final
     try {
       final byte[] data = datat == null ? null : serialize(datat, path);
       checkDataSizeLimit(data);
-      String actualPath = retryUntilConnected(new Callable<String>() {
-        @Override
-        public String call() throws Exception {
-          return getConnection().create(path, data, acl, mode);
-        }
-      });
+
+      /*
+       * We pass different implementation of callable.
+       * 1. If the session id is null, it means the operation is NOT session 
aware.
+       * In this case, we will create a regular callable to create an 
ephemeral node.
+       * 2. Otherwise, the operation is session aware. We will use a 
SessionAwareCallable to
+       * create an ephemeral node, which is guaranteed to be created in the 
expected session.
+       */
+      String actualPath;
+      if (sessionId == null) {
 
 Review comment:
   +1. If mode is not ephemeral, no need to involve sessionId.

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