lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1698201 - in /lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs: lucene40/Lucene40RWSegmentInfoFormat.java lucene46/Lucene46RWSegmentInfoFormat.java
Date Thu, 27 Aug 2015 17:43:42 GMT
Author: mikemccand
Date: Thu Aug 27 17:43:42 2015
New Revision: 1698201

URL: http://svn.apache.org/r1698201
Log:
LUCENE-6769: don't claim to have created a file until createOutput in fact succeeded

Modified:
    lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWSegmentInfoFormat.java
    lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene46/Lucene46RWSegmentInfoFormat.java

Modified: lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWSegmentInfoFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWSegmentInfoFormat.java?rev=1698201&r1=1698200&r2=1698201&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWSegmentInfoFormat.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene40/Lucene40RWSegmentInfoFormat.java
Thu Aug 27 17:43:42 2015
@@ -38,12 +38,14 @@ public final class Lucene40RWSegmentInfo
   @Override
   public void write(Directory dir, SegmentInfo si, IOContext ioContext) throws IOException
{
     final String fileName = IndexFileNames.segmentFileName(si.name, "", Lucene40SegmentInfoFormat.SI_EXTENSION);
-    si.addFile(fileName);
 
     final IndexOutput output = dir.createOutput(fileName, ioContext);
 
     boolean success = false;
     try {
+      // Only add the file once we've successfully created it, else IFD assert can trip:
+      si.addFile(fileName);
+
       CodecUtil.writeHeader(output, Lucene40SegmentInfoFormat.CODEC_NAME, Lucene40SegmentInfoFormat.VERSION_CURRENT);
       // Write the Lucene version that created this segment, since 3.1
       output.writeString(si.getVersion().toString());

Modified: lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene46/Lucene46RWSegmentInfoFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene46/Lucene46RWSegmentInfoFormat.java?rev=1698201&r1=1698200&r2=1698201&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene46/Lucene46RWSegmentInfoFormat.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/backward-codecs/src/test/org/apache/lucene/codecs/lucene46/Lucene46RWSegmentInfoFormat.java
Thu Aug 27 17:43:42 2015
@@ -37,12 +37,14 @@ public final class Lucene46RWSegmentInfo
   @Override
   public void write(Directory dir, SegmentInfo si, IOContext ioContext) throws IOException
{
     final String fileName = IndexFileNames.segmentFileName(si.name, "", Lucene46SegmentInfoFormat.SI_EXTENSION);
-    si.addFile(fileName);
 
     final IndexOutput output = dir.createOutput(fileName, ioContext);
 
     boolean success = false;
     try {
+      // Only add the file once we've successfully created it, else IFD assert can trip:
+      si.addFile(fileName);
+
       CodecUtil.writeHeader(output, Lucene46SegmentInfoFormat.CODEC_NAME, Lucene46SegmentInfoFormat.VERSION_CURRENT);
       Version version = si.getVersion();
       if (version.major < 4) {



Mime
View raw message