You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/10 10:06:57 UTC
[lucene] 10/17: SOLR-15019: Fix issues from review.
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a commit to branch jira/solr-15019
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit f4b0e4087e3f0251b5825a94fee64264c8409397
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Mon Dec 21 12:27:06 2020 +0100
SOLR-15019: Fix issues from review.
---
.../solr/cluster/placement/AttributeFetcher.java | 30 +++++++++++++++-------
.../solr/cluster/placement/AttributeValues.java | 2 +-
.../solr/cluster/placement/ReplicaMetric.java | 4 +--
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java b/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java
index 73cba48..af63baa 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/AttributeFetcher.java
@@ -58,40 +58,48 @@ public interface AttributeFetcher {
/**
* Request a given system property on each node. To get the value use {@link AttributeValues#getSystemProperty(Node, String)}
+ * @param name system property name
*/
AttributeFetcher requestNodeSystemProperty(String name);
/**
* Request an environment variable on each node. To get the value use {@link AttributeValues#getEnvironmentVariable(Node, String)}
+ * @param name environment property name
*/
AttributeFetcher requestNodeEnvironmentVariable(String name);
/**
* Request a node metric from each node. To get the value use {@link AttributeValues#getMetric(Node, String, NodeMetricRegistry)}
+ * @param metricName name of the metric (within the registry)
+ * @param registry one of the node-level metric registries
*/
AttributeFetcher requestNodeMetric(String metricName, NodeMetricRegistry registry);
/**
+ * Requests any metric from any metric registry on each node, using a fully-qualified metric key,
+ * for example <code>solr.jvm:system.properties:user.name</code>.
+ * To get the value use {@link AttributeValues#getNodeMetric(Node, String)}
+ * @param metricKey fully-qualified metric key
+ */
+ AttributeFetcher requestNodeMetric(String metricKey);
+
+ /**
* Request collection-level metrics. To get the values use {@link AttributeValues#getCollectionMetrics(String)}.
* Note that this request will fetch information from nodes relevant to the collection
* replicas and not the ones specified in {@link #fetchFrom(Set)} (though they may overlap).
+ * @param solrCollection request metrics for this collection
+ * @param metrics metrics to retrieve (see {@link ReplicaMetric})
*/
- AttributeFetcher requestCollectionMetrics(SolrCollection solrCollection, Set<ReplicaMetric<?>> metricNames);
+ AttributeFetcher requestCollectionMetrics(SolrCollection solrCollection, Set<ReplicaMetric<?>> metrics);
/**
* The set of nodes from which to fetch all node related attributes. Calling this method is mandatory if any of the {@code requestNode*}
* methods got called.
+ * @param nodes nodes to fetch from
*/
AttributeFetcher fetchFrom(Set<Node> nodes);
/**
- * Requests any metric from any metric registry on each node, using a fully-qualified metric key,
- * for example <code>solr.jvm:system.properties:user.name</code>.
- * To get the value use {@link AttributeValues#getNodeMetric(Node, String)}
- */
- AttributeFetcher requestNodeMetric(String metricKey);
-
- /**
* Fetches all requested node attributes from all nodes passed to {@link #fetchFrom(Set)} as well as non node attributes
* (those requested for example using {@link #requestNodeMetric(String)}.
*
@@ -110,7 +118,11 @@ public interface AttributeFetcher {
/**
* corresponds to solr.jvm
*/
- SOLR_JVM
+ SOLR_JVM,
+ /**
+ * corresponds to solr.jetty
+ */
+ SOLR_JETTY
}
enum DiskHardwareType {
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/AttributeValues.java b/solr/core/src/java/org/apache/solr/cluster/placement/AttributeValues.java
index 1f075be..ca0d1b0 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/AttributeValues.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/AttributeValues.java
@@ -74,7 +74,7 @@ public interface AttributeValues {
Optional<Object> getNodeMetric(Node node, String metricKey);
/**
- *
+ * Get collection metrics.
*/
Optional<CollectionMetrics> getCollectionMetrics(String collectionName);
}
diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/ReplicaMetric.java b/solr/core/src/java/org/apache/solr/cluster/placement/ReplicaMetric.java
index b432f6f..0f01889 100644
--- a/solr/core/src/java/org/apache/solr/cluster/placement/ReplicaMetric.java
+++ b/solr/core/src/java/org/apache/solr/cluster/placement/ReplicaMetric.java
@@ -28,7 +28,7 @@ public class ReplicaMetric<T> {
private static final double GB = 1024 * 1024 * 1024;
@SuppressWarnings("unchecked")
- private final Function<Object, T> NO_CONVERTER = v -> {
+ private final Function<Object, T> IDENTITY_CONVERTER = v -> {
try {
return (T) v;
} catch (ClassCastException cce) {
@@ -71,7 +71,7 @@ public class ReplicaMetric<T> {
this.name = name;
this.internalName = internalName;
if (converter == null) {
- this.converter = NO_CONVERTER;
+ this.converter = IDENTITY_CONVERTER;
} else {
this.converter = converter;
}