Skip to content

Apache Lucene open-source search software

LUCENE-9147: Avoid reusing file names with FileSwitchDirectory or NRTCachingDirectory and IOContext randomization.

Adrien Grand1b882246d70e
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java
index 42d7ca46f8d..e67195e2e6e 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/compressing/FieldsIndexWriter.java
@@ -79,12 +79,12 @@ public final class FieldsIndexWriter implements Closeable {
this.id = id;
this.blockShift = blockShift;
this.ioContext = ioContext;
- this.docsOut = dir.createTempOutput(name, "doc_ids", ioContext);
+ this.docsOut = dir.createTempOutput(name, codecName + "-doc_ids", ioContext);
IndexOutput filePointersOut = null;
boolean success = false;
try {
CodecUtil.writeHeader(docsOut, codecName + "Docs", VERSION_CURRENT);
- this.filePointersOut = filePointersOut = dir.createTempOutput(name, "file_pointers", ioContext);
+ this.filePointersOut = filePointersOut = dir.createTempOutput(name, codecName + "file_pointers", ioContext);
CodecUtil.writeHeader(filePointersOut, codecName + "FilePointers", VERSION_CURRENT);
success = true;
} finally {