narendly commented on a change in pull request #924: WIP: fix
ZkHelixPropertyStore loses Zookeeper notification issue
URL: https://github.com/apache/helix/pull/924#discussion_r401175238
##########
File path:
helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java
##########
@@ -88,6 +92,57 @@ public void afterClass() {
deleteCluster(getShortClassName());
}
+ @Test
+ public void testSessionExpirationWithSharedZkClient() throws Exception {
+ /*
+ This test is to make sure SharedZkClient would work with
+ HelixPropertyStore when session expiration happens. More specifically
+ HelixPropertyStore would register all the callbacks after session
+ expiration.
+ */
+ String subRoot = _root + "/" + "localCallback";
+ List<String> subscribedPaths = new ArrayList<>();
+ subscribedPaths.add(subRoot);
+
+ ZkSerializer serializer = new ZNRecordSerializer();
+ ZkHelixPropertyStore<ZNRecord> store =
+ new ZkHelixPropertyStore<>(ZK_ADDR, serializer, subRoot,
subscribedPaths);
+
+ TestListener listener = new TestListener();
+ store.subscribe("/", listener);
+
+ // test dataCreate callbacks
+ listener.reset();
+ setNodes(store, 'a', true);
+
+ // kill the session to make sure shared zkClient re-installs watcher
+ // Note, current shared ZkClient does not issue new session. Thus, we need
+ // kill _zkConnectionManager's session. Otherwise,
ZkTestHelper.expireSesson
+ // would not work.
+ SharedZkClient sharedClient = (SharedZkClient) store.getTestZkClient();
+ HelixZkClient testClient = sharedClient.getConnectionManager();
+ ZkTestHelper.expireSession(testClient);
+
+
Review comment:
empty line?
----------------------------------------------------------------
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]