mirror of https://github.com/apache/lucene.git
LUCENE-6616: only claim to have created a file once createOutput succeeded
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1690952 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
422694f9c0
commit
1498d5b0b7
|
@ -154,9 +154,10 @@ public class SimpleTextSegmentInfoFormat extends SegmentInfoFormat {
|
|||
public void write(Directory dir, SegmentInfo si, IOContext ioContext) throws IOException {
|
||||
|
||||
String segFileName = IndexFileNames.segmentFileName(si.name, "", SimpleTextSegmentInfoFormat.SI_EXTENSION);
|
||||
si.addFile(segFileName);
|
||||
|
||||
try (IndexOutput output = dir.createOutput(segFileName, ioContext)) {
|
||||
// Only add the file once we've successfully created it, else IFD assert can trip:
|
||||
si.addFile(segFileName);
|
||||
BytesRefBuilder scratch = new BytesRefBuilder();
|
||||
|
||||
SimpleTextUtil.write(output, SI_VERSION);
|
||||
|
|
Loading…
Reference in New Issue