lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r934954 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/StoredFieldsWriter.java
Date Fri, 16 Apr 2010 14:59:07 GMT
Author: mikemccand
Date: Fri Apr 16 14:59:07 2010
New Revision: 934954

URL: http://svn.apache.org/viewvc?rev=934954&view=rev
Log:
add an additional assert to try to catch possible 'fdx size mismatch' bug

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/StoredFieldsWriter.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/StoredFieldsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/StoredFieldsWriter.java?rev=934954&r1=934953&r2=934954&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/StoredFieldsWriter.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/StoredFieldsWriter.java Fri Apr
16 14:59:07 2010
@@ -29,6 +29,7 @@ final class StoredFieldsWriter {
   final DocumentsWriter docWriter;
   final FieldInfos fieldInfos;
   int lastDocID;
+  private String docStoreSegment;
 
   PerDoc[] docFreeList = new PerDoc[1];
   int freeCount;
@@ -58,10 +59,10 @@ final class StoredFieldsWriter {
     if (fieldsWriter != null)
       fieldsWriter.flush();
   }
-  
-  private void initFieldsWriter() throws IOException {
+
+  private synchronized void initFieldsWriter() throws IOException {
     if (fieldsWriter == null) {
-      final String docStoreSegment = docWriter.getDocStoreSegment();
+      docStoreSegment = docWriter.getDocStoreSegment();
       if (docStoreSegment != null) {
         fieldsWriter = new FieldsWriter(docWriter.directory,
                                         docStoreSegment,
@@ -83,8 +84,10 @@ final class StoredFieldsWriter {
     if (fieldsWriter != null) {
       fieldsWriter.close();
       fieldsWriter = null;
-      lastDocID = 0;
+      assert docStoreSegment != null;
       assert state.docStoreSegmentName != null;
+      assert docStoreSegment.equals(state.docStoreSegmentName): "fieldsWriter wrote to segment="
+ docStoreSegment + " vs SegmentWriteState segment=" + state.docStoreSegmentName;
+      lastDocID = 0;
       String fieldsName = IndexFileNames.segmentFileName(state.docStoreSegmentName, IndexFileNames.FIELDS_EXTENSION);
       String fieldsIdxName = IndexFileNames.segmentFileName(state.docStoreSegmentName, IndexFileNames.FIELDS_INDEX_EXTENSION);
       state.flushedFiles.add(fieldsName);



Mime
View raw message