Skip to content

Commit

Permalink
Propagate the flush IOContext to stored fields / term vectors writers…
Browse files Browse the repository at this point in the history
… when index sorting is enabled. (#13265)

This fixes index sorting to pass the correct `IOContext` to stored fields and
term vectors writers when index sorting is enabled. This is important for
things like `NRTCachingDirectory`.
  • Loading branch information
jpountz committed Apr 5, 2024
1 parent d2491ae commit 55a89be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ void flush(SegmentWriteState state, Sorter.DocMap sortMap) throws IOException {
// Don't pull a merge instance, since merge instances optimize for
// sequential access while we consume stored fields in random order here.
StoredFieldsWriter sortWriter =
codec
.storedFieldsFormat()
.fieldsWriter(state.directory, state.segmentInfo, IOContext.DEFAULT);
codec.storedFieldsFormat().fieldsWriter(state.directory, state.segmentInfo, state.context);
try {
reader.checkIntegrity();
CopyVisitor visitor = new CopyVisitor(sortWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void flush(
TermVectorsWriter writer =
codec
.termVectorsFormat()
.vectorsWriter(state.directory, state.segmentInfo, IOContext.DEFAULT);
.vectorsWriter(state.directory, state.segmentInfo, state.context);
try {
reader.checkIntegrity();
for (int docID = 0; docID < state.segmentInfo.maxDoc(); docID++) {
Expand Down

0 comments on commit 55a89be

Please sign in to comment.