kaisun2000 commented on a change in pull request #1104:
URL: https://github.com/apache/helix/pull/1104#discussion_r442567666



##########
File path: 
helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
##########
@@ -605,9 +605,12 @@ public void onStateChange(String instanceName, 
List<CurrentState> statesInfo,
         "Should have 1 data-watches: MESSAGES");
     Assert.assertEquals(watchPaths.get("childWatches").size(), 1,
         "Should have 1 child-watches: MESSAGES");
-    Assert
-        .assertEquals(watchPaths.get("existWatches").size(), 2,
-            "Should have 2 exist-watches: CURRENTSTATE/{oldSessionId} and 
CURRENTSTATE/{oldSessionId}/TestDB0");
+    result = TestHelper.verify(()-> {
+      Map<String, List<String>> wPaths = 
ZkTestHelper.getZkWatch(participantToExpire.getZkClient());
+      return wPaths.get("existWatches").size() == 1;
+    }, 10000);
+    Assert.assertTrue(result,
+        "Should have 1 exist-watches: CURRENTSTATE/{oldSessionId}");

Review comment:
       This test is confusing. Note here it is a participant0, register and 
currentstate/{sessionid} callbackhandler of itself. 
   
   This does not normally happen in production,
   
   The only case this can happen is that controller have CB for participant 1. 
At the same time controller and participant 1 both have session expiration. 
   
   Back to the question, yes, the old session will be removed from participant 
point of view. But from router point of view (participant0 is also router as it 
subscribe to callbackhandler of current state), each existing callbackhandler 
of router would be called via lambda from zkclient event queue inserted by 
fireAllEvent() after session expiration.
   
   ` fireChildChangedEvents(entry.getKey(), entry.getValue(), true);`
   
   The lambda would install this watch. 
   
   Note, this is normally not a problem as we don't have such usage case. Only 
if both participant and controller/router have session expiration at the same 
time. 
   
   Later, we plan to make it clear the responsibility of who should install 
watcher. We can simplify the logic here.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to