Skip to content

Commit

Permalink
add index disk usage to core status call (#219)
Browse files Browse the repository at this point in the history
* add nodeStatus to core status call

* tidy

* tidy
  • Loading branch information
nginthfs committed Sep 6, 2024
1 parent d14cde0 commit c4ffc35
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions solr/core/src/java/org/apache/solr/handler/admin/StatusOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package org.apache.solr.handler.admin;

import java.io.Closeable;
import java.io.File;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand All @@ -39,6 +41,14 @@ public void execute(CoreAdminHandler.CallInfo it) throws Exception {
String reconcile = params.get(CoreAdminParams.RECONCILE_THRESHOLD);
boolean isIndexInfoNeeded = Boolean.parseBoolean(null == indexInfo ? "true" : indexInfo);
NamedList<Object> status = new SimpleOrderedMap<>();
NamedList<Object> nodeStatus = new SimpleOrderedMap<>();
if (it.handler.coreContainer != null) {
Path solrDataHome = it.handler.coreContainer.getCoreRootDirectory();
File dataDir = solrDataHome.toFile();
nodeStatus.add("indexDiskSizeTotal", dataDir.getTotalSpace());
nodeStatus.add("indexDiskSizeAvailable", dataDir.getUsableSpace());
}
it.rsp.add("nodeStatus", nodeStatus);
Map<String, Exception> failures = new HashMap<>();
for (Map.Entry<String, CoreContainer.CoreLoadFailure> failure :
it.handler.coreContainer.getCoreInitFailures().entrySet()) {
Expand Down

0 comments on commit c4ffc35

Please sign in to comment.