juanka588 commented on a change in pull request #1497:
URL: https://github.com/apache/lucene-solr/pull/1497#discussion_r426509706



##########
File path: 
solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
##########
@@ -634,17 +635,19 @@ private static long getSegmentsFileLength(IndexCommit 
commit) {
 
   /** Returns the sum of RAM bytes used by each segment */
   private static long getIndexHeapUsed(DirectoryReader reader) {
-    long indexHeapRamBytesUsed = 0;
-    for(LeafReaderContext leafReaderContext : reader.leaves()) {
-      LeafReader leafReader = leafReaderContext.reader();
-      if (leafReader instanceof SegmentReader) {
-        indexHeapRamBytesUsed += ((SegmentReader) leafReader).ramBytesUsed();
-      } else {
-        // Not supported for any reader that is not a SegmentReader
-        return -1;
-      }
-    }
-    return indexHeapRamBytesUsed;
+    return reader.leaves().stream()
+        .map(LeafReaderContext::reader)
+        .map(FilterLeafReader::unwrap)
+        .map(leafReader -> {
+          if (leafReader instanceof Accountable) {

Review comment:
       can we filter here instead?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to