kaisun2000 commented on a change in pull request #642: Fix handleNewSession 
creating ephemeral node with expired session
URL: https://github.com/apache/helix/pull/642#discussion_r362994414
 
 

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java
 ##########
 @@ -97,10 +97,28 @@ public ParticipantManager(HelixManager manager, 
HelixZkClient zkclient, int sess
   }
 
   /**
-   * Handle new session for a participang.
+   * Handles a new session for a participant.
+   *
+   * @deprecated
+   * This is deprecated. Instead, please use {@link #handleNewSession(String)} 
which takes care of
+   * potential session race condition issue.
+   *
    * @throws Exception
    */
+  @Deprecated
   public void handleNewSession() throws Exception {
+    handleNewSession(null);
+  }
+
+  /**
+   * Handles a new session for a participant. The new session's id has to be 
passed in, as it is
+   * required in {@link #createLiveInstance(String)} to prevent ephemeral node 
creation from session
+   * race condition: ephemeral node is created by an expired or unexpected 
session.
+   *
+   * @param sessionId the new session's ID
+   * @throws Exception if any exception occurs
+   */
+  public void handleNewSession(final String sessionId) throws Exception {
     joinCluster();
 
 Review comment:
   can _zkClient.getSessionId() == 0? 
   
   I think they can. We should do nothing here then.

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