You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/09/21 05:15:09 UTC

[GitHub] [incubator-pinot] KKcorps commented on a change in pull request #6020: Add Caching in Controller Broker API

KKcorps commented on a change in pull request #6020:
URL: https://github.com/apache/incubator-pinot/pull/6020#discussion_r491796919



##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/listener/ClusterLiveInstanceChangeListener.java
##########
@@ -0,0 +1,34 @@
+package org.apache.pinot.controller.helix.core.listener;
+
+import java.util.ArrayList;
+import org.apache.helix.HelixDataAccessor;
+import org.apache.helix.NotificationContext;
+import org.apache.helix.api.listeners.LiveInstanceChangeListener;
+import org.apache.helix.model.LiveInstance;
+
+import java.util.List;
+import org.apache.helix.PropertyKey.Builder;
+
+
+public class ClusterLiveInstanceChangeListener implements LiveInstanceChangeListener {
+  private HelixDataAccessor _helixDataAccessor;
+  private Builder _keyBuilder;
+  private List<LiveInstance> _liveInstances = new ArrayList<>();
+
+  public ClusterLiveInstanceChangeListener(HelixDataAccessor helixDataAccessor, Builder keyBuilder) {
+    _helixDataAccessor = helixDataAccessor;
+    _keyBuilder = keyBuilder;
+  }
+
+  @Override
+  public void onLiveInstanceChange(List<LiveInstance> liveInstances, NotificationContext changeContext) {
+    _liveInstances = liveInstances;

Review comment:
       This was returning older values rather than updated values in onChange methoda.

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/listener/ClusterInstanceConfigChangeListener.java
##########
@@ -0,0 +1,32 @@
+package org.apache.pinot.controller.helix.core.listener;
+
+import org.apache.helix.HelixManager;
+import org.apache.helix.NotificationContext;
+import org.apache.helix.api.listeners.InstanceConfigChangeListener;
+import org.apache.helix.model.InstanceConfig;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.pinot.common.utils.helix.HelixHelper;
+
+
+public class ClusterInstanceConfigChangeListener implements InstanceConfigChangeListener {
+    private HelixManager _helixManager;
+    private List<InstanceConfig> _instanceConfigs = new ArrayList<>();
+
+    public ClusterInstanceConfigChangeListener(HelixManager helixManager) {
+        _helixManager = helixManager;
+    }
+
+    @Override
+    public void onInstanceConfigChange(List<InstanceConfig> instanceConfigs, NotificationContext context) {
+        _instanceConfigs = instanceConfigs;

Review comment:
       This was returning older values rather than updated values in onChange methoda.
   
   




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org