[
https://issues.apache.org/jira/browse/SOLR-16507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699086#comment-17699086
]
Vinayak Hegde commented on SOLR-16507:
--------------------------------------
HI, [~dsmiley] I started working on this
currently, I am trying to replace the NodeStateProvider with metrics API for
disk space.
In this, we need to find indexSize and freeSize
for indexSize, I added something like this
{code:java}
CloudSolrClient cloudSolrClient = cloudManager.getCloudSolrClient();
ModifiableSolrParams params = new ModifiableSolrParams();
String metricName = new StringBuilder("solr.core.")
.append(collection).append(".")
.append(shard).append(".")
.append(Utils.parseMetricsReplicaName(collection,
parentShardLeader.getCoreName()))
.append(":INDEX.sizeInBytes").toString();
params.add("key", metricName);
V2Request req = new
V2Request.Builder("/admin/metrics").forceV2(true).GET().withParams(params).build();
V2Response rsp;
try {
rsp = req.process(cloudSolrClient);
} catch (Exception e) {
log.error("Error occurred while checking the disk space of the node");
return;
}
if(rsp.getStatus() != 0 || rsp.getResponse() == null) {
log.warn("cannot verify information for parent shard leader");
return;
}
NamedList<Object> response = rsp.getResponse();
NamedList<Object> metrics = (NamedList<Object>) response.get("metrics");
if(metrics == null) {
log.warn("cannot verify information for parent shard leader");
return;
}
Number size = (Number) metrics.get(metricName);
if(size == null) {
log.warn("cannot verify information for parent shard leader");
return;
}
Double indexSize = size.doubleValue();
if(indexSize == null) {
log.warn("cannot verify information for parent shard leader");
return;
} {code}
BTW, added getCloudSolrClient() in cloudManager
is it correct or at least the approach?
As for freeSize, I found the parameter
[http://localhost:8983/solr/admin/metrics?key=solr.node:CONTAINER.fs.usableSpace]
. However, I need to specify the node from which I need the information. I can
get the node name from {{{}parentShardLeader.getNodeName(){}}}, but I'm not
sure how to specify it. Could you please help me with this?
> Remove NodeStateProvider & Snitch
> ---------------------------------
>
> Key: SOLR-16507
> URL: https://issues.apache.org/jira/browse/SOLR-16507
> Project: Solr
> Issue Type: Task
> Reporter: David Smiley
> Priority: Major
> Labels: newdev
>
> The NodeStateProvider is a relic relating to the old autoscaling framework
> that was removed in Solr 9. The only remaining usage of it is for
> SplitShardCmd to check the disk space. For this, it could use the metrics
> api.
> I think we'll observe that Snitch and other classes in
> org.apache.solr.common.cloud.rule can be removed as well, as it's related to
> NodeStateProvider.
> Only
> org.apache.solr.cluster.placement.impl.AttributeFetcherImpl#getMetricSnitchTag
> and org.apache.solr.cluster.placement.impl.NodeMetricImpl refer to some
> constants in the code to be removed. Those constants could move out,
> consolidated somewhere we think is appropriate.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]