lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1137331 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/ lucene/backwards/src/test-framework/ lucene/backwards/src/test/ lucene/contrib/misc/src/java/org/apache/lucene/index/ lucene/src/java/org/apache/lucene/index/ solr/
Date Sun, 19 Jun 2011 10:36:24 GMT
Author: mikemccand
Date: Sun Jun 19 10:36:24 2011
New Revision: 1137331

URL: http://svn.apache.org/viewvc?rev=1137331&view=rev
Log:
LUCENE-3197: must also count the segment being produced by an in-flight merge as original
(as of when optimize starts) to ensure all deletions against that segment are also merged
away

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/src/test-framework/   (props changed)
    lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
    lucene/dev/branches/branch_3x/solr/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java?rev=1137331&r1=1137330&r2=1137331&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/PKIndexSplitter.java
Sun Jun 19 10:36:24 2011
@@ -32,6 +32,7 @@ import org.apache.lucene.util.Version;
 /**
  * Split an index based on a {@link Filter}.
  */
+
 public class PKIndexSplitter {
   private final Filter docsInFirstIndex;
   private final Directory input;

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1137331&r1=1137330&r2=1137331&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexWriter.java
Sun Jun 19 10:36:24 2011
@@ -2511,11 +2511,13 @@ public class IndexWriter implements Clos
       for(final MergePolicy.OneMerge merge  : pendingMerges) {
         merge.optimize = true;
         merge.maxNumSegmentsOptimize = maxNumSegments;
+        segmentsToOptimize.put(merge.info, Boolean.TRUE);
       }
 
       for ( final MergePolicy.OneMerge merge: runningMerges ) {
         merge.optimize = true;
         merge.maxNumSegmentsOptimize = maxNumSegments;
+        segmentsToOptimize.put(merge.info, Boolean.TRUE);
       }
     }
 
@@ -2728,7 +2730,6 @@ public class IndexWriter implements Clos
     final MergePolicy.MergeSpecification spec;
     if (optimize) {
       spec = mergePolicy.findMergesForOptimize(segmentInfos, maxNumSegmentsOptimize, Collections.unmodifiableMap(segmentsToOptimize));
-
       if (spec != null) {
         final int numMerges = spec.merges.size();
         for(int i=0;i<numMerges;i++) {
@@ -3793,7 +3794,9 @@ public class IndexWriter implements Clos
     
     if (merge.optimize) {
       // cascade the optimize:
-      segmentsToOptimize.put(merge.info, Boolean.FALSE);
+      if (!segmentsToOptimize.containsKey(merge.info)) {
+        segmentsToOptimize.put(merge.info, Boolean.FALSE);
+      }
     }
     
     return true;

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java?rev=1137331&r1=1137330&r2=1137331&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
Sun Jun 19 10:36:24 2011
@@ -285,7 +285,7 @@ public abstract class LogMergePolicy ext
   private MergeSpecification findMergesForOptimizeMaxNumSegments(SegmentInfos infos, int
maxNumSegments, int last) throws IOException {
     MergeSpecification spec = new MergeSpecification();
     final List<SegmentInfo> segments = infos.asList();
-    
+
     // First, enroll all "full" merges (size
     // mergeFactor) to potentially be run concurrently:
     while (last - maxNumSegments + 1 >= mergeFactor) {
@@ -352,6 +352,9 @@ public abstract class LogMergePolicy ext
             int maxNumSegments, Map<SegmentInfo,Boolean> segmentsToOptimize) throws
IOException {
 
     assert maxNumSegments > 0;
+    if (verbose()) {
+      message("findMergesForOptimize: maxNumSegs=" + maxNumSegments + " segsToOptimize="+
segmentsToOptimize);
+    }
 
     // If the segments are already optimized (e.g. there's only 1 segment), or
     // there are <maxNumSegements, all optimized, nothing to do.
@@ -383,7 +386,7 @@ public abstract class LogMergePolicy ext
         break;
       }
     }
-    
+
     if (anyTooLarge) {
       return findMergesForOptimizeSizeLimit(infos, maxNumSegments, last);
     } else {



Mime
View raw message