Index: lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java =================================================================== --- lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java (revision 1162298) +++ lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java (working copy) @@ -131,7 +131,13 @@ } } } - + + // TODO: make @Nightly variant that provokes more disk + // fulls + + // TODO: have test fail if on any given top + // iter there was not a single IOE hit + /* Test: make sure when we run out of disk space or hit random IOExceptions in any of the addIndexes(*) calls Index: lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java =================================================================== --- lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java (revision 1162298) +++ lucene/src/java/org/apache/lucene/index/values/VarStraightBytesImpl.java (working copy) @@ -128,13 +128,13 @@ address += numDataBytes; // this is the address after all addr pointers are updated iter.close(); } finally { - IOUtils.closeSafely(true, cloneIdx); + IOUtils.closeSafely(false, cloneIdx); } final IndexInput cloneData = reader.cloneData(); try { datOut.copyBytes(cloneData, numDataBytes); } finally { - IOUtils.closeSafely(true, cloneData); + IOUtils.closeSafely(false, cloneData); } } else { super.merge(state); Index: lucene/src/java/org/apache/lucene/index/values/FixedStraightBytesImpl.java =================================================================== --- lucene/src/java/org/apache/lucene/index/values/FixedStraightBytesImpl.java (revision 1162298) +++ lucene/src/java/org/apache/lucene/index/values/FixedStraightBytesImpl.java (working copy) @@ -104,41 +104,39 @@ datOut = getDataOut(); boolean success = false; try { - if (state.liveDocs == null && state.reader instanceof Reader) { - Reader reader = (Reader) state.reader; - final int maxDocs = reader.maxDoc; - if (maxDocs == 0) { - return; - } - if (size == -1) { - size = reader.size; - datOut.writeInt(size); - } - if (lastDocID+1 < state.docBase) { - fill(datOut, state.docBase); - lastDocID = state.docBase-1; - } - // TODO should we add a transfer to API to each reader? - final IndexInput cloneData = reader.cloneData(); - try { - datOut.copyBytes(cloneData, size * maxDocs); - } finally { - IOUtils.closeSafely(true, cloneData); - } + if (state.liveDocs == null && state.reader instanceof Reader) { + Reader reader = (Reader) state.reader; + final int maxDocs = reader.maxDoc; + if (maxDocs == 0) { + return; + } + if (size == -1) { + size = reader.size; + datOut.writeInt(size); + } + if (lastDocID+1 < state.docBase) { + fill(datOut, state.docBase); + lastDocID = state.docBase-1; + } + // TODO should we add a transfer to API to each reader? + final IndexInput cloneData = reader.cloneData(); + try { + datOut.copyBytes(cloneData, size * maxDocs); + } finally { + IOUtils.closeSafely(false, cloneData); + } - lastDocID += maxDocs; - } else { - super.merge(state); - } - success = true; + lastDocID += maxDocs; + } else { + super.merge(state); + } + success = true; } finally { if (!success) { IOUtils.closeSafely(!success, datOut); } } } - - @Override protected void mergeDoc(int docID) throws IOException { Index: lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java =================================================================== --- lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java (revision 1162298) +++ lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java (working copy) @@ -89,7 +89,7 @@ consumers.finish(state.numDocs); }; // close perDocConsumer during flush to ensure all files are flushed due to PerCodec CFS - IOUtils.closeSafely(true, perDocConsumers.values()); + IOUtils.closeSafely(false, perDocConsumers.values()); } @Override Index: lucene/src/java/org/apache/lucene/index/IndexWriter.java =================================================================== --- lucene/src/java/org/apache/lucene/index/IndexWriter.java (revision 1162298) +++ lucene/src/java/org/apache/lucene/index/IndexWriter.java (working copy) @@ -2607,7 +2607,7 @@ } } } finally { - IOUtils.closeSafely(true, cfsdir); + IOUtils.closeSafely(false, cfsdir); } info.dir = directory; Index: lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java =================================================================== --- lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java (revision 1162298) +++ lucene/src/java/org/apache/lucene/store/CompoundFileDirectory.java (working copy) @@ -95,10 +95,10 @@ if (firstInt == CompoundFileWriter.FORMAT_CURRENT) { IndexInput input = null; try { - input = dir.openInput(IndexFileNames.segmentFileName( - IndexFileNames.stripExtension(name), "", - IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION), - IOContext.READONCE); + final String entriesFileName = IndexFileNames.segmentFileName( + IndexFileNames.stripExtension(name), "", + IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION); + input = dir.openInput(entriesFileName, IOContext.READONCE); final int readInt = input.readInt(); // unused right now assert readInt == CompoundFileWriter.ENTRY_FORMAT_CURRENT; final int numEntries = input.readVInt(); @@ -112,7 +112,7 @@ } return mapping; } finally { - IOUtils.closeSafely(true, input); + IOUtils.closeSafely(false, input); } } else { // TODO remove once 3.x is not supported anymore Index: lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java =================================================================== --- lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java (revision 1162298) +++ lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java (working copy) @@ -153,7 +153,10 @@ @Override public String toString() { - maybeYield(); + // NOTE: do not maybeYield here, since it consumes + // randomness and can thus (unexpectedly during + // debugging) change the behavior of a seed + // maybeYield(); return "MockDirWrapper(" + delegate + ")"; }