You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2024/07/31 18:35:50 UTC
(lucene) branch branch_9x updated: Deduplicate bytes for `FieldReader#rootCode` (#13610)
This is an automated email from the ASF dual-hosted git repository.
abr pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new ca1b26993f9 Deduplicate bytes for `FieldReader#rootCode` (#13610)
ca1b26993f9 is described below
commit ca1b26993f92c4896c1eebc444793c422f3c6a27
Author: Armin Braun <me...@obrown.io>
AuthorDate: Wed Jul 31 20:31:13 2024 +0200
Deduplicate bytes for `FieldReader#rootCode` (#13610)
Looking at how these instances are serialized to disk it appears
that the empty output in the FST metadata is always the same as the
rootCode bytes.
Without changing the serialization we could at least deduplicate here,
saving hundreds of MB in some high-segment count use cases I observed in
ES.
---
.../org/apache/lucene/codecs/lucene90/blocktree/FieldReader.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/FieldReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/FieldReader.java
index 5a3a160a964..55f4f3342e8 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/FieldReader.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/FieldReader.java
@@ -78,7 +78,6 @@ public final class FieldReader extends Terms {
this.sumTotalTermFreq = sumTotalTermFreq;
this.sumDocFreq = sumDocFreq;
this.docCount = docCount;
- this.rootCode = rootCode;
this.minTerm = minTerm;
this.maxTerm = maxTerm;
// if (DEBUG) {
@@ -100,6 +99,14 @@ public final class FieldReader extends Terms {
w.close();
}
*/
+ BytesRef emptyOutput = metadata.getEmptyOutput();
+ if (rootCode.equals(emptyOutput) == false) {
+ // TODO: this branch is never taken
+ assert false;
+ this.rootCode = rootCode;
+ } else {
+ this.rootCode = emptyOutput;
+ }
}
long readVLongOutput(DataInput in) throws IOException {