Skip to content

Commit 480ce7b

Browse files
committed
added comments
1 parent 0f93844 commit 480ce7b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/main/java/org/elasticsearch/index/codec/TrackingPostingsInMemoryBytesCodec.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ static final class TrackingLengthFieldsConsumer extends FieldsConsumer {
7070
this.state = state;
7171
this.in = in;
7272
this.totalBytes = new long[1];
73+
// Alternatively, we can consider using a FixedBitSet here and size to max(fieldNumber). T
74+
// his should be faster without worrying too much about memory usage.
7375
this.seenFields = new IntHashSet(state.fieldInfos.size());
7476
}
7577

@@ -107,6 +109,8 @@ public Terms terms(String field) throws IOException {
107109
if (seenFields.add(fieldNum)) {
108110
return new TrackingLengthTerms(terms, bytes -> totalBytes[0] += bytes);
109111
} else {
112+
// As far as I know only when bloom filter for _id filter gets written this method gets invoked twice for the same field.
113+
// So maybe we can get rid of the seenFields here? And just keep track of whether _id field has been seen?
110114
return terms;
111115
}
112116
}

0 commit comments

Comments
 (0)