You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2018/11/12 07:39:29 UTC

lucene-solr:master: SOLR-12977: Autoscaling tries to fetch metrics from dead nodes

Repository: lucene-solr
Updated Branches:
  refs/heads/master 52998fa50 -> 605c3f6f1


SOLR-12977: Autoscaling tries to fetch metrics from dead nodes


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/605c3f6f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/605c3f6f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/605c3f6f

Branch: refs/heads/master
Commit: 605c3f6f1a8d14ad3933d2ea225ec5ee66a631d9
Parents: 52998fa
Author: Noble Paul <no...@apache.org>
Authored: Mon Nov 12 18:39:05 2018 +1100
Committer: Noble Paul <no...@apache.org>
Committed: Mon Nov 12 18:39:05 2018 +1100

----------------------------------------------------------------------
 solr/CHANGES.txt                                             | 2 ++
 .../solr/client/solrj/impl/SolrClientNodeStateProvider.java  | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/605c3f6f/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a13e5cb..2e8e97a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -212,6 +212,8 @@ New Features
   to set this to false (using docValues as needed) to reduce the risk of large fluxuations in heap
   size due to unexpected attempts to sort/facet/function on non-docValue fields. (hossman)
 
+* SOLR-12977: Autoscaling tries to fetch metrics from dead nodes (noble)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/605c3f6f/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
index 5a9d5b0..fc3564f 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
@@ -118,7 +118,6 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
 
   @Override
   public void writeMap(EntryWriter ew) throws IOException {
-//    ew.put("liveNodes", liveNodes);
     ew.put("replicaInfo", Utils.getDeepCopy(nodeVsCollectionVsShardVsReplicaInfo, 5));
     ew.put("nodeValues", nodeVsTags);
   }
@@ -189,6 +188,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
   }
 
   static void fetchReplicaMetrics(String solrNode, ClientSnitchCtx ctx, Map<String, Object> metricsKeyVsTag) {
+    if (!ctx.isNodeAlive(solrNode)) return;
     ModifiableSolrParams params = new ModifiableSolrParams();
     params.add("key", metricsKeyVsTag.keySet().toArray(new String[0]));
     try {
@@ -216,6 +216,7 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
   static class AutoScalingSnitch extends ImplicitSnitch {
     @Override
     protected void getRemoteInfo(String solrNode, Set<String> requestedTags, SnitchContext ctx) {
+      if (!((ClientSnitchCtx)ctx).isNodeAlive(solrNode)) return;
       ClientSnitchCtx snitchContext = (ClientSnitchCtx) ctx;
       Map<String, Object> metricsKeyVsTag = new HashMap<>();
       for (String tag : requestedTags) {
@@ -314,6 +315,11 @@ public class SolrClientNodeStateProvider implements NodeStateProvider, MapWriter
     ZkClientClusterStateProvider zkClientClusterStateProvider;
     CloudSolrClient solrClient;
 
+    public boolean isNodeAlive(String node) {
+      if (zkClientClusterStateProvider != null && zkClientClusterStateProvider.getLiveNodes().contains(node))
+        return true;
+      return true;
+    }
     public ClientSnitchCtx(SnitchInfo perSnitch,
                            String node, Map<String, Object> session,
                            CloudSolrClient solrClient) {