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

 ##########
 File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/zookeeper/ZkClient.java
 ##########
 @@ -835,8 +1080,28 @@ protected void processStateChanged(WatchedEvent event) {
     if (getShutdownTrigger()) {
       return;
     }
+
     fireStateChangedEvent(event.getState());
-    if (isManagingZkConnection() && event.getState() == KeeperState.Expired) {
+
+    if (!isManagingZkConnection()) {
+      return;
+    }
+
+    if (event.getState() == KeeperState.SyncConnected) {
+      if (!_isNewSessionEventFired) {
+        /*
+         * Once the new zookeeper session receives the first SyncConnected 
state,
+         * the zookeeper session is established and connected to zookeeper 
service.
+         * So the session id is available and non-zero. Now we can fire new 
session events.
+         */
+        fireNewSessionEvents();
+        /*
+         * Set it true to avoid firing events again for the same session next 
time
 
 Review comment:
   Resetting the flag is after reconnect:
   
https://github.com/apache/helix/blob/b485d1f708e3308fa46a0ce88dda36607d93e186/helix-core/src/main/java/org/apache/helix/manager/zk/zookeeper/ZkClient.java#L1143-L1145

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