You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ji...@apache.org on 2020/06/19 23:18:42 UTC
[helix] branch watcher updated: Enhance flaky test
TestRemoveUserCbHandlerOnPathRemoval (#1104)
This is an automated email from the ASF dual-hosted git repository.
jiajunwang pushed a commit to branch watcher
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/watcher by this push:
new 511dd3d Enhance flaky test TestRemoveUserCbHandlerOnPathRemoval (#1104)
511dd3d is described below
commit 511dd3db69465b6690dd464543b7ce1674432259
Author: kaisun2000 <52...@users.noreply.github.com>
AuthorDate: Fri Jun 19 16:18:31 2020 -0700
Enhance flaky test TestRemoveUserCbHandlerOnPathRemoval (#1104)
TestRemoveUserCbHandlerOnPathRemoval has a flaky assert. Address the assertion in this diff.
Co-authored-by: Kai Sun <ks...@ksun-mn1.linkedin.biz>
---
.../helix/integration/TestZkCallbackHandlerLeak.java | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java b/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
index 0bcee6d..ddf2a5f 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java
@@ -605,9 +605,23 @@ public class TestZkCallbackHandlerLeak extends ZkUnitTestBase {
"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");
+
+ // In this test participant0 also register to its own cocurrent state with a callbackhandler
+ // When session expiration happens, the current state parent path would also changes. However,
+ // an exists watch would still be installed by event pushed to ZkCLient event thread by
+ // fireAllEvent() children even path on behalf of old session callbackhandler. By the time this
+ // event gets invoked, the old session callbackhandler was removed, but the event would still
+ // install a exist watch for old session.
+ // The closest similar case in production is that router/controller has an session expiration at
+ // the same time as participant.
+ // Currently there are many places to register watch in Zookeeper over the evolution of Helix
+ // and ZkClient. We plan for further simplify the logic of watch installation next.
+ 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}");
// another session expiry on localhost_12918 should clear the two exist-watches on
// CURRENTSTATE/{oldSessionId}