-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Single loop for FieldfInfo processing #137967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
burqen
wants to merge
9
commits into
elastic:main
Choose a base branch
from
burqen:ap/2025.11.10.ES-13452-iterate-fields-once--inline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+173
−150
Open
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c3f8de5
Decouple DeduplicatingFieldInfoCodec
burqen 46c9566
Move DecouplingFieldInfosCodec to upper level
burqen 8c1f45e
Single loop for FieldInfo processing
burqen 21e6faf
Update docs/changelog/137967.yaml
burqen cb9fdb7
Fix test failures expecting inheritance
burqen 57da3f7
Fix more test failures expecting inheritance
burqen 47cd28d
Merge remote-tracking branch 'upstream/main' into ap/2025.11.10.ES-13…
burqen bf75792
[CI] Auto commit changes from spotless
8f21294
Address PR comments
burqen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| pr: 137967 | ||
| summary: Single loop for `FielfInfo` processing | ||
| area: TSDB | ||
| type: enhancement | ||
| issues: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
server/src/main/java/org/elasticsearch/index/codec/DeduplicateFieldInfosCodec.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||||||||||
| /* | ||||||||||||||||||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||||||||||||||||||
| * or more contributor license agreements. Licensed under the "Elastic License | ||||||||||||||||||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||||||||||||||||||
| * Public License v 1"; you may not use this file except in compliance with, at | ||||||||||||||||||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||||||||||||||||||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||||||||||||||||||
| */ | ||||||||||||||||||
|
|
||||||||||||||||||
| package org.elasticsearch.index.codec; | ||||||||||||||||||
|
|
||||||||||||||||||
| import org.apache.lucene.codecs.Codec; | ||||||||||||||||||
| import org.apache.lucene.codecs.FieldInfosFormat; | ||||||||||||||||||
| import org.apache.lucene.codecs.FilterCodec; | ||||||||||||||||||
| import org.elasticsearch.index.codec.tsdb.TSDBSyntheticIdCodec; | ||||||||||||||||||
|
|
||||||||||||||||||
| public sealed class DeduplicateFieldInfosCodec extends FilterCodec permits TSDBSyntheticIdCodec { | ||||||||||||||||||
|
|
||||||||||||||||||
| private final DeduplicatingFieldInfosFormat fieldInfosFormat; | ||||||||||||||||||
|
|
||||||||||||||||||
| @SuppressWarnings("this-escape") | ||||||||||||||||||
| protected DeduplicateFieldInfosCodec(String name, Codec delegate) { | ||||||||||||||||||
| super(name, delegate); | ||||||||||||||||||
| this.fieldInfosFormat = createFieldInfosFormat(delegate.fieldInfosFormat()); | ||||||||||||||||||
| } | ||||||||||||||||||
|
||||||||||||||||||
| protected DeduplicateFieldInfosCodec(String name, Codec delegate) { | |
| super(name, delegate); | |
| this.fieldInfosFormat = createFieldInfosFormat(delegate.fieldInfosFormat()); | |
| } | |
| protected DeduplicateFieldInfosCodec(Codec delegate) { | |
| super(delegate.getName(), delegate); | |
| this.fieldInfosFormat = createFieldInfosFormat(delegate.fieldInfosFormat()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |||||
| import org.elasticsearch.common.util.Maps; | ||||||
| import org.elasticsearch.common.util.StringLiteralDeduplicator; | ||||||
| import org.elasticsearch.common.util.concurrent.ConcurrentCollections; | ||||||
| import org.elasticsearch.index.codec.tsdb.TSDBSyntheticIdCodec; | ||||||
| import org.elasticsearch.index.mapper.FieldMapper; | ||||||
|
|
||||||
| import java.io.IOException; | ||||||
|
|
@@ -28,7 +29,7 @@ | |||||
| * cases attribute maps on read. We use this to reduce the per-field overhead for Elasticsearch instances holding a large number of | ||||||
| * segments. | ||||||
| */ | ||||||
| public final class DeduplicatingFieldInfosFormat extends FieldInfosFormat { | ||||||
| public sealed class DeduplicatingFieldInfosFormat extends FieldInfosFormat permits TSDBSyntheticIdCodec.RewriteFieldInfosFormat { | ||||||
|
|
||||||
| private static final Map<Map<String, String>, Map<String, String>> attributeDeduplicator = ConcurrentCollections.newConcurrentMap(); | ||||||
|
|
||||||
|
|
@@ -43,33 +44,40 @@ public DeduplicatingFieldInfosFormat(FieldInfosFormat delegate) { | |||||
| @Override | ||||||
| public FieldInfos read(Directory directory, SegmentInfo segmentInfo, String segmentSuffix, IOContext iocontext) throws IOException { | ||||||
| final FieldInfos fieldInfos = delegate.read(directory, segmentInfo, segmentSuffix, iocontext); | ||||||
| validateFieldInfos(fieldInfos); | ||||||
| final FieldInfo[] deduplicated = new FieldInfo[fieldInfos.size()]; | ||||||
| int i = 0; | ||||||
| for (FieldInfo fi : fieldInfos) { | ||||||
| deduplicated[i++] = new FieldInfo( | ||||||
| FieldMapper.internFieldName(fi.getName()), | ||||||
| fi.number, | ||||||
| fi.hasTermVectors(), | ||||||
| fi.omitsNorms(), | ||||||
| fi.hasPayloads(), | ||||||
| fi.getIndexOptions(), | ||||||
| fi.getDocValuesType(), | ||||||
| fi.docValuesSkipIndexType(), | ||||||
| fi.getDocValuesGen(), | ||||||
| internStringStringMap(fi.attributes()), | ||||||
| fi.getPointDimensionCount(), | ||||||
| fi.getPointIndexDimensionCount(), | ||||||
| fi.getPointNumBytes(), | ||||||
| fi.getVectorDimension(), | ||||||
| fi.getVectorEncoding(), | ||||||
| fi.getVectorSimilarityFunction(), | ||||||
| fi.isSoftDeletesField(), | ||||||
| fi.isParentField() | ||||||
| ); | ||||||
| deduplicated[i++] = processFieldInfo(fi); | ||||||
| } | ||||||
| return new FieldInfosWithUsages(deduplicated); | ||||||
| } | ||||||
|
|
||||||
| protected void validateFieldInfos(FieldInfos fieldInfos) {} | ||||||
|
|
||||||
| protected FieldInfo processFieldInfo(FieldInfo fi) { | ||||||
|
||||||
| protected FieldInfo processFieldInfo(FieldInfo fi) { | |
| protected FieldInfo wrapFieldInfo(FieldInfo fi) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: