You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2020/09/03 09:40:07 UTC

[lucene-solr] branch branch_8x updated: LUCENE-9483: Disable per-thread caching of buffers for decompression of stored fields. (#1787)

This is an automated email from the ASF dual-hosted git repository.

jpountz pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new b331eb6  LUCENE-9483: Disable per-thread caching of buffers for decompression of stored fields. (#1787)
b331eb6 is described below

commit b331eb61703f4e2ebdc4cde11938cb710c603246
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Thu Sep 3 11:37:34 2020 +0200

    LUCENE-9483: Disable per-thread caching of buffers for decompression of stored fields. (#1787)
    
    These buffers can use lots of memory when the number of segments,
    threads or both is high.
---
 .../compressing/CompressingStoredFieldsReader.java   | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java
index 373efa9..2ced3de 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/CompressingStoredFieldsReader.java
@@ -408,8 +408,17 @@ public final class CompressingStoredFieldsReader extends StoredFieldsReader {
     // the start pointer at which you can read the compressed documents
     private long startPointer;
 
-    private final BytesRef spare = new BytesRef();
-    private final BytesRef bytes = new BytesRef();
+    private final BytesRef spare;
+    private final BytesRef bytes;
+
+    BlockState() {
+      if (merging) {
+        spare = new BytesRef();
+        bytes = new BytesRef();
+      } else {
+        spare = bytes = null;
+      }
+    }
 
     boolean contains(int docID) {
       return docID >= docBase && docID < docBase + chunkDocs;
@@ -539,6 +548,13 @@ public final class CompressingStoredFieldsReader extends StoredFieldsReader {
       final int totalLength = offsets[chunkDocs];
       final int numStoredFields = this.numStoredFields[index];
 
+      final BytesRef bytes;
+      if (merging) {
+        bytes = this.bytes;
+      } else {
+        bytes = new BytesRef();
+      }
+
       final DataInput documentInput;
       if (length == 0) {
         // empty