jackjlli commented on a change in pull request #3633: Use 
ZkCacheBaseDataAccessor to cache instance configs in PinotHelixResourceManager
URL: https://github.com/apache/incubator-pinot/pull/3633#discussion_r245104866
 
 

 ##########
 File path: 
pinot-controller/src/main/java/com/linkedin/pinot/controller/helix/core/PinotHelixResourceManager.java
 ##########
 @@ -168,6 +173,16 @@ public synchronized void start() {
     _helixAdmin = _helixZkManager.getClusterManagmentTool();
     _propertyStore = _helixZkManager.getHelixPropertyStore();
     _helixDataAccessor = _helixZkManager.getHelixDataAccessor();
+    // Cache instance zk paths.
+    BaseDataAccessor<ZNRecord> baseDataAccessor = 
_helixDataAccessor.getBaseDataAccessor();
+    if (baseDataAccessor instanceof ZkBaseDataAccessor) {
+      String instanceConfigs = 
PropertyPathBuilder.instanceConfig(_helixClusterName);
+      _cacheInstanceConfigsDataAccessor =
+          new ZkCacheBaseDataAccessor<>((ZkBaseDataAccessor<ZNRecord>) 
baseDataAccessor, instanceConfigs,
+              Collections.singletonList(instanceConfigs), 
Collections.singletonList(instanceConfigs));
 
 Review comment:
   @dasahcc Do you mean keeping one 
`Collections.singletonList(instanceConfigs)` is enough if I've already given 
root path?
   We can't guarantee instances are stable; we may add/remove instances. But 
the purpose of getting instance configs is to get the admin endpoint, which 
consists of hostname and admin port. And these two elements won't be changed 
often for each instance. So I guess the correct usage of that class is:
   ```
   _cacheInstanceConfigsDataAccessor =
             new ZkCacheBaseDataAccessor<>((ZkBaseDataAccessor<ZNRecord>) 
baseDataAccessor, instanceConfigs,
                 Collections.singletonList(instanceConfigs), null);
   ```
   Could you confirm?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]

Reply via email to