lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r655030 - /lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java
Date Sat, 10 May 2008 08:48:50 GMT
Author: mikemccand
Date: Sat May 10 01:48:50 2008
New Revision: 655030

URL: http://svn.apache.org/viewvc?rev=655030&view=rev
Log:
LUCENE-1282: upgrade an assert to a real check, to work around Sun JRE hotspot bug to prevent
index corruption

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java?rev=655030&r1=655029&r2=655030&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java Sat May 10 01:48:50
2008
@@ -355,8 +355,15 @@
         fieldsWriter.close();
       }
 
-      assert 4+docCount*8 == directory.fileLength(segment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION)
:
-        "after mergeFields: fdx size mismatch: " + docCount + " docs vs " + directory.fileLength(segment
+ "." + IndexFileNames.FIELDS_INDEX_EXTENSION) + " length in bytes of " + segment + "." +
IndexFileNames.FIELDS_INDEX_EXTENSION;
+      final long fdxFileLength = directory.fileLength(segment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
+
+      if (4+docCount*8 != fdxFileLength)
+        // This is most like a bug in Sun JRE 1.6.0_04/_05;
+        // we detect that the bug has struck, here, and
+        // throw an exception to prevent the corruption from
+        // entering the index.  See LUCENE-1282 for
+        // details.
+        throw new RuntimeException("mergeFields produced an invalid result: docCount is "
+ docCount + " but fdx file size is " + fdxFileLength + "; now aborting this merge to prevent
index corruption");
 
     } else
       // If we are skipping the doc stores, that means there



Mime
View raw message