You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/10/31 14:02:16 UTC

[34/50] [abbrv] lucene-solr:jira/solr-11285-sim: SOLR-11413: SolrGraphiteReporter fails to report metrics due to non-thread safe code.

SOLR-11413: SolrGraphiteReporter fails to report metrics due to non-thread safe code.


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

Branch: refs/heads/jira/solr-11285-sim
Commit: c8d55cc6d45afaff31160a22fbe01dc36bb6675f
Parents: cc519b9
Author: Andrzej Bialecki <ab...@apache.org>
Authored: Mon Oct 30 12:52:01 2017 +0100
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Mon Oct 30 12:52:01 2017 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                        |  2 ++
 .../solr/metrics/reporters/SolrGraphiteReporter.java    | 12 +++++-------
 solr/core/src/test-files/solr/solr-graphitereporter.xml |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8d55cc6/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b292625..22dfaf9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -81,6 +81,8 @@ Bug Fixes
 
 * SOLR-11557: Fix SolrZkClient.checkInterrupted (Tomás Fernández Löbbe)
 
+* SOLR-11413: SolrGraphiteReporter fails to report metrics due to non-thread safe code. (Erik Persson, ab)
+
 Optimizations
 ----------------------
 * SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8d55cc6/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java b/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java
index 68111d5..4a55f46 100644
--- a/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java
+++ b/solr/core/src/java/org/apache/solr/metrics/reporters/SolrGraphiteReporter.java
@@ -75,13 +75,11 @@ public class SolrGraphiteReporter extends FilteringSolrMetricReporter {
     }
     GraphiteSender graphite;
     String id = host + ":" + port + ":" + pickled;
-    graphite = serviceRegistry.getOrCreate(id, () -> {
-      if (pickled) {
-        return new PickledGraphite(host, port);
-      } else {
-        return new Graphite(host, port);
-      }
-    });
+    if (pickled) {
+      graphite = new PickledGraphite(host, port);
+    } else {
+      graphite = new Graphite(host, port);
+    }
     if (instancePrefix == null) {
       instancePrefix = registryName;
     } else {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8d55cc6/solr/core/src/test-files/solr/solr-graphitereporter.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/solr-graphitereporter.xml b/solr/core/src/test-files/solr/solr-graphitereporter.xml
index 7c7f5ca..de12313 100644
--- a/solr/core/src/test-files/solr/solr-graphitereporter.xml
+++ b/solr/core/src/test-files/solr/solr-graphitereporter.xml
@@ -18,7 +18,7 @@
 
 <solr>
  <metrics>
-  <reporter name="test" group="node" class="org.apache.solr.metrics.reporters.SolrGraphiteReporter">
+  <reporter name="test" group="node,core" class="org.apache.solr.metrics.reporters.SolrGraphiteReporter">
     <str name="host">localhost</str>
     <int name="port">${mock-graphite-port}</int>
     <!-- for unit tests this is set to 1 second - DO NOT USE THIS VALUE IN PRODUCTION! -->