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

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/ParticipantManager.java
 ##########
 @@ -158,7 +162,7 @@ private void joinCluster() {
     }
   }
 
-  private void createLiveInstance() {
+  private void createLiveInstance(final String sessionId) {
 
 Review comment:
   > I realized when reviewing the later code that you don't need to pass the 
sessionId. Correct me if I am wrong, I think you can just pass _sessionId into 
the createEphemeral().
   
   My answer is no. If we pass _sessionId into createEphemeral(), I think that 
is what the current code does and why race condition occurs. Session expiration 
can occur any time between reconnectOnExpiring() and zookeeper.create(), which 
means _sessionId could change during the period. If _sessionId changes before 
we pass _sessionId to createEphemeral(), I think that would be incorrect. 
Please correct me if I am wrong.
   
   > Does that mean we don't need the new interface?
   
   If we don't have to pass the session id into 
ZkHelixManager.handNewSession(sessionId) and just use _sessionId, I don't 
believe we need the new interface. But the fact is, I think we need the 
sessionId because we expect to create an ephemeral node in the expected 
session, not a later/new session.
   
   
   

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