jiajunwang commented on a change in pull request #1344:
URL: https://github.com/apache/helix/pull/1344#discussion_r483169343



##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -533,7 +533,7 @@ public void invoke(NotificationContext changeContext) 
throws Exception {
     }
   }
 
-  private void subscribeChildChange(String path, NotificationContext.Type 
callbackType) {
+  private List<String> subscribeChildChange(String path, 
NotificationContext.Type callbackType) {

Review comment:
       Method comment, please.

##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -592,8 +595,8 @@ private void 
subscribeForChangesAsyn(NotificationContext.Type callbackType, Stri
 
   private void subscribeForChanges(NotificationContext.Type callbackType, 
String path,
       boolean watchChild) {
-    logger.info("Subscribing changes listener to path: {}, type: {}, listener: 
{}", path,
-        callbackType, _listener);
+    logger.info("Subscribing changes listener to path: {}, callback type: {}, 
event types: {}, "

Review comment:
       For debug, please add new fields to the end of the string. And don't 
change the existing content if they are not hurt too much. Otherwise, the dev 
needs to switch the code version back and forth to double-check before 
debugging the older version deployment.

##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -604,11 +607,8 @@ private void subscribeForChanges(NotificationContext.Type 
callbackType, String p
     }
 
     if (_eventTypes.contains(EventType.NodeChildrenChanged)) {
-      logger.info("Subscribing child change listener to path: {}", path);

Review comment:
       I personally think these 2 info logs are still desired. Especially we 
are changing the subscription mechanism.

##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -533,7 +533,7 @@ public void invoke(NotificationContext changeContext) 
throws Exception {
     }
   }
 
-  private void subscribeChildChange(String path, NotificationContext.Type 
callbackType) {
+  private List<String> subscribeChildChange(String path, 
NotificationContext.Type callbackType) {
     if (callbackType == NotificationContext.Type.INIT

Review comment:
       Is it possible that you just return ChildrenSubscribeResult?
   Then if _isInstalled is false, no one will read the children. Otherwise, if 
_isInstalled, then the list should never be null.

##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -646,10 +645,14 @@ private void subscribeForChanges(NotificationContext.Type 
callbackType, String p
               break;
             }
             default: {
-              List<String> childNames = _zkClient.getChildren(path);
-              if (childNames != null) {
-                for (String childName : childNames) {
-                  String childPath = path + "/" + childName;
+              // When callback type is FINALIZE or PERIODIC_REFRESH, 
subscribeChildChange doesn't
+              // get children list. We need to read children to unsubscribe 
data change listeners.
+              if (callbackType != Type.INIT && callbackType != Type.CALLBACK) {

Review comment:
       As I mentioned above, if the return value is ChildrenSubscribeResult, 
then you just need to check "_isInstalled" for the following logic.




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