lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r750849 - /lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
Date Fri, 06 Mar 2009 11:22:14 GMT
Author: mikemccand
Date: Fri Mar  6 11:22:12 2009
New Revision: 750849

URL: http://svn.apache.org/viewvc?rev=750849&view=rev
Log:
LUCENE-1554: remove false-positive assert that may (rarely) trip when it's not supposed to

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

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java?rev=750849&r1=750848&r2=750849&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java Fri Mar  6 11:22:12
2009
@@ -4427,14 +4427,16 @@
     if (merge.increfDone)
       decrefMergeSegments(merge);
 
-    assert merge.registerDone;
-
-    final SegmentInfos sourceSegments = merge.segments;
-    final int end = sourceSegments.size();
-    for(int i=0;i<end;i++)
-      mergingSegments.remove(sourceSegments.info(i));
-    mergingSegments.remove(merge.info);
-    merge.registerDone = false;
+    // It's possible we are called twice, eg if there was an
+    // exception inside mergeInit
+    if (merge.registerDone) {
+      final SegmentInfos sourceSegments = merge.segments;
+      final int end = sourceSegments.size();
+      for(int i=0;i<end;i++)
+        mergingSegments.remove(sourceSegments.info(i));
+      mergingSegments.remove(merge.info);
+      merge.registerDone = false;
+    }
   }
 
   /** Does the actual (time-consuming) work of the merge,



Mime
View raw message