jiajunwang 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_r361019129
##########
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:
How to ensure this flag is for the "same session" only? I didn't see you
check if it is the "same session", or reset the flag.
----------------------------------------------------------------
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]