xyuanlu commented on a change in pull request #1415:
URL: https://github.com/apache/helix/pull/1415#discussion_r496279782



##########
File path: 
helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -632,31 +636,33 @@ private void subscribeForChanges(NotificationContext.Type 
callbackType, String p
             case CUSTOMIZED_VIEW:
             case TARGET_EXTERNAL_VIEW: {
               // check if bucketized
-              BaseDataAccessor<ZNRecord> baseAccessor = new 
ZkBaseDataAccessor<>(_zkClient);
-              List<ZNRecord> records = baseAccessor.getChildren(path, null, 0, 
0, 0);
-              for (ZNRecord record : records) {
-                HelixProperty property = new HelixProperty(record);
-                String childPath = path + "/" + record.getId();
-
-                int bucketSize = property.getBucketSize();
-                if (bucketSize > 0) {
-                  // subscribe both data-change and child-change on bucketized 
parent node
-                  // data-change gives a delete-callback which is used to 
remove watch
-                  List<String> bucketizedChildNames = 
subscribeChildChange(childPath, callbackType);
+              if (BUCKETIZE_ZNRECORD_ENABLED) {
+                BaseDataAccessor<ZNRecord> baseAccessor = new 
ZkBaseDataAccessor<>(_zkClient);
+                List<ZNRecord> records = baseAccessor.getChildren(path, null, 
0, 0, 0);
+                for (ZNRecord record : records) {
+                  HelixProperty property = new HelixProperty(record);
+                  String childPath = path + "/" + record.getId();
+                  int bucketSize = property.getBucketSize();
+                  // Do data-change subscribe for both bucketized parent node 
and non-bucketized node.
+                  // For bucketized parent node, data-change gives a 
delete-callback to remove watch.
                   subscribeDataChange(childPath, callbackType);
-
-                  // subscribe data-change on bucketized child
-                  if (bucketizedChildNames != null) {
-                    for (String bucketizedChildName : bucketizedChildNames) {
-                      String bucketizedChildPath = childPath + "/" + 
bucketizedChildName;
-                      subscribeDataChange(bucketizedChildPath, callbackType);
+                  if (bucketSize > 0) {
+                    // subscribe child-change on bucketized parent node.
+                    List<String> bucketizedChildNames =
+                        subscribeChildChange(childPath, callbackType);
+
+                    // subscribe data-change on bucketized child
+                    if (bucketizedChildNames != null) {
+                      for (String bucketizedChildName : bucketizedChildNames) {
+                        String bucketizedChildPath = childPath + "/" + 
bucketizedChildName;
+                        subscribeDataChange(bucketizedChildPath, callbackType);
+                      }
                     }
                   }
-                } else {
-                  subscribeDataChange(childPath, callbackType);
                 }
+                break;
               }
-              break;
+              // go to default branch if bucketized feature is not enabled.

Review comment:
       Updated.




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