Skip per-document stored field reads on sorted indices when no stored fields are present#15718
Conversation
… fields are present Avoid unnecessary seeks and reads on the stored fields file during flush in SortingStoredFieldsConsumer for segments that do not contain stored fields. Closes apache#15713
|
I'm wondering if you could just skip the Though looking at the behavior in |
Yes, I think that's a contract that we have to keep. Alternatively we could use a different approach and just write a flag in the stored fields metadata where we track that there are no stored fields, but we can still respond calls to the |
romseygeek
left a comment
There was a problem hiding this comment.
Looks good! I have one question about the test. Also, can you add a CHANGES entry in the 10.5 section?
| new FilterDirectory(dir) { | ||
| @Override | ||
| public IndexInput openInput(String name, IOContext context) throws IOException { | ||
| if (name.contains(Lucene90CompressingStoredFieldsWriter.FIELDS_EXTENSION)) { |
There was a problem hiding this comment.
Does the test write to any files other than the StoredFields file? I worry that relying on the filename might be a bit fragile.
There was a problem hiding this comment.
It also writes into a metadata file and into the fields index files. I understand you concern, but I couldn't find another way of asserting that we don't read n times, do you have other ideas?
There was a problem hiding this comment.
It's not ideal, but we're not doing Codec randomization here so I think we should be OK.
| super.writeField(info, value); | ||
| hasStoredFields = true; | ||
| } | ||
|
|
There was a problem hiding this comment.
This optimization only works if all docs in the segment have no stored fields, right? Which I think is probably fine, as that's a fairly common case.
There was a problem hiding this comment.
Yes, that's right 👍
|
Thanks @fcofdez! |
|
Thanks for the review @romseygeek! |
Avoid unnecessary seeks and reads on the stored fields file during
flush in SortingStoredFieldsConsumer for segments that do not contain
stored fields.
Closes #15713