You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2021/04/26 16:28:26 UTC
[solr] branch main updated: SOLR-15341: remove indexHeapUsageBytes
(#94)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 175094a SOLR-15341: remove indexHeapUsageBytes (#94)
175094a is described below
commit 175094ae3110b1fbac487721443431fcecf6132a
Author: David Smiley <ds...@apache.org>
AuthorDate: Mon Apr 26 12:28:16 2021 -0400
SOLR-15341: remove indexHeapUsageBytes (#94)
from /admin/segments and /admin/luke because it's no longer available in Lucene 9
---
solr/CHANGES.txt | 4 +--
.../solr/handler/admin/LukeRequestHandler.java | 41 +++++-----------------
solr/webapp/web/partials/core_overview.html | 3 --
3 files changed, 11 insertions(+), 37 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 75c5737..fe5cc0f 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -265,8 +265,8 @@ Other Changes
alternative implementations of where ConfigSets come from.
(Nazerke Seidan, David Smiley)
-* SOLR-15341: Lucene has removed CodecReader#ramBytesUsed in LUCENE-9387, so ramBytesUsed will no longer be reported
- in SegmentsInfo handler (janhoy)
+* SOLR-15341: Remove indexHeapUsageBytes info from /admin/segments and /admin/luke because it's no
+ longer available in Lucene -- LUCENE-9387. (janhoy, David Smiley)
* SOLR-15146: Allow Collection API and Config Set API to be done in a distributed fashion without going through Overseer (Ilan Ginzburg)
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
index be091a9..a28ce1c 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
@@ -16,6 +16,10 @@
*/
package org.apache.solr.handler.admin;
+import static org.apache.lucene.index.IndexOptions.DOCS;
+import static org.apache.lucene.index.IndexOptions.DOCS_AND_FREQS;
+import static org.apache.lucene.index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.nio.file.NoSuchFileException;
@@ -29,7 +33,6 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CharFilterFactory;
import org.apache.lucene.analysis.TokenFilterFactory;
@@ -39,13 +42,11 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.FilterLeafReader;
import org.apache.lucene.index.IndexCommit;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.LeafReader;
-import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.MultiTerms;
import org.apache.lucene.index.PostingsEnum;
import org.apache.lucene.index.Term;
@@ -55,7 +56,6 @@ import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.AlreadyClosedException;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CharsRefBuilder;
@@ -81,18 +81,14 @@ import org.apache.solr.update.SolrIndexWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.apache.lucene.index.IndexOptions.DOCS;
-import static org.apache.lucene.index.IndexOptions.DOCS_AND_FREQS;
-import static org.apache.lucene.index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
-
/**
- * This handler exposes the internal lucene index. It is inspired by and
- * modeled on Luke, the Lucene Index Browser by Andrzej Bialecki.
- * http://www.getopt.org/luke/
+ * Exposes the internal lucene index. It's registered at /admin/luke by default.
*
- * For more documentation see:
- * http://wiki.apache.org/solr/LukeRequestHandler
+ * It is inspired by and
+ * modeled on Luke, the Lucene Index Browser that is currently a Lucene module:
+ * https://github.com/apache/lucene/tree/main/lucene/luke
*
+ * @see SegmentsInfoRequestHandler
* @since solr 1.2
*/
public class LukeRequestHandler extends RequestHandlerBase
@@ -575,8 +571,6 @@ public class LukeRequestHandler extends RequestHandlerBase
indexInfo.add("numDocs", reader.numDocs());
indexInfo.add("maxDoc", reader.maxDoc());
indexInfo.add("deletedDocs", reader.maxDoc() - reader.numDocs());
- indexInfo.add("indexHeapUsageBytes", getIndexHeapUsed(reader));
-
indexInfo.add("version", reader.getVersion()); // TODO? Is this different then: IndexReader.getCurrentVersion( dir )?
indexInfo.add("segmentCount", reader.leaves().size());
indexInfo.add("current", closeSafe( reader::isCurrent));
@@ -633,23 +627,6 @@ public class LukeRequestHandler extends RequestHandlerBase
return -1;
}
- /** Returns the sum of RAM bytes used by each segment */
- private static long getIndexHeapUsed(DirectoryReader reader) {
- return reader.leaves().stream()
- .map(LeafReaderContext::reader)
- .map(FilterLeafReader::unwrap)
- .map(leafReader -> {
- if (leafReader instanceof Accountable) {
- return ((Accountable) leafReader).ramBytesUsed();
- } else {
- return -1L; // unsupported
- }
- })
- .mapToLong(Long::longValue)
- .reduce(0, (left, right) -> left == -1 || right == -1 ? -1 : left + right);
- // if any leaves are unsupported (-1), we ultimately return -1.
- }
-
// Get terribly detailed information about a particular field. This is a very expensive call, use it with caution
// especially on large indexes!
@SuppressWarnings("unchecked")
diff --git a/solr/webapp/web/partials/core_overview.html b/solr/webapp/web/partials/core_overview.html
index 0c3b8e3..b1d651a 100644
--- a/solr/webapp/web/partials/core_overview.html
+++ b/solr/webapp/web/partials/core_overview.html
@@ -39,9 +39,6 @@ limitations under the License.
<dt class="index_max-doc">Max Doc:</dt>
<dd class="index_max-doc value">{{index.maxDoc}}</dd>
- <dt class="index_heap-usage-bytes">Heap Memory Usage:</dt>
- <dd class="index_heap-usage-bytes value">{{index.indexHeapUsageBytes}}</dd>
-
<dt class="index_deleted-docs">Deleted Docs:</dt>
<dd class="index_deleted-docs value">{{index.deletedDocs}}</dd>