lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r1210041 [2/4] - in /lucene/dev/branches/solrcloud: ./ dev-tools/eclipse/ dev-tools/idea/lucene/contrib/ dev-tools/maven/ dev-tools/maven/solr/core/ lucene/ lucene/contrib/ lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appendi...
Date Sun, 04 Dec 2011 01:14:58 GMT
Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FieldInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FieldInfos.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FieldInfos.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FieldInfos.java Sun Dec  4 01:14:52 2011
@@ -17,23 +17,15 @@ package org.apache.lucene.index;
  * limitations under the License.
  */
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
-import java.util.Map.Entry;
 
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.values.ValueType;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.util.CodecUtil;
 
 /** Access to the Field Info file that describes document fields and whether or
  *  not they are indexed. Each segment has a separate Field Info file. Objects
@@ -45,18 +37,9 @@ import org.apache.lucene.util.CodecUtil;
 public final class FieldInfos implements Iterable<FieldInfo> {
   static final class FieldNumberBiMap {
     
-    final static String CODEC_NAME = "GLOBAL_FIELD_MAP";
-    
-    // Initial format
-    private static final int VERSION_START = 0;
-
-    private static final int VERSION_CURRENT = VERSION_START;
-
     private final Map<Integer,String> numberToName;
     private final Map<String,Integer> nameToNumber;
     private int lowestUnassignedFieldNumber = -1;
-    private long lastVersion = 0;
-    private long version = 0;
     
     FieldNumberBiMap() {
       this.nameToNumber = new HashMap<String, Integer>();
@@ -85,7 +68,6 @@ public final class FieldInfos implements
           fieldNumber = lowestUnassignedFieldNumber;
         }
         
-        version++;
         numberToName.put(fieldNumber, fieldName);
         nameToNumber.put(fieldName, fieldNumber);
         
@@ -101,7 +83,6 @@ public final class FieldInfos implements
       final Integer boxedFieldNumber = Integer.valueOf(fieldNumber);
       if (!numberToName.containsKey(boxedFieldNumber)
           && !nameToNumber.containsKey(fieldName)) {
-        version++;
         numberToName.put(boxedFieldNumber, fieldName);
         nameToNumber.put(fieldName, boxedFieldNumber);
       } else {
@@ -109,70 +90,6 @@ public final class FieldInfos implements
       }
     }
     
-    /**
-     * Writes this {@link FieldNumberBiMap} to the given output and returns its
-     * version.
-     */
-    public synchronized long write(IndexOutput output) throws IOException{
-      Set<Entry<String, Integer>> entrySet = nameToNumber.entrySet();
-      CodecUtil.writeHeader(output, CODEC_NAME, VERSION_CURRENT); 
-      output.writeVInt(entrySet.size());
-      for (Entry<String, Integer> entry : entrySet) {
-        output.writeVInt(entry.getValue().intValue());
-        output.writeString(entry.getKey());
-      }
-      return version;
-    }
-
-    /**
-     * Reads the {@link FieldNumberBiMap} from the given input and resets the
-     * version to 0.
-     */
-    public synchronized void read(IndexInput input) throws IOException{
-      CodecUtil.checkHeader(input, CODEC_NAME,
-          VERSION_START,
-          VERSION_CURRENT);
-      final int size = input.readVInt();
-      for (int i = 0; i < size; i++) {
-        final int num = input.readVInt();
-        final String name = input.readString();
-        setIfNotSet(num, name);
-      }
-      version = lastVersion = 0;
-    }
-    
-    /**
-     * Returns <code>true</code> iff the last committed version differs from the
-     * current version, otherwise <code>false</code>
-     * 
-     * @return <code>true</code> iff the last committed version differs from the
-     *         current version, otherwise <code>false</code>
-     */
-    public synchronized boolean isDirty() {
-      return lastVersion != version;
-    }
-    
-    /**
-     * commits the given version if the given version is greater than the previous committed version
-     * 
-     * @param version
-     *          the version to commit
-     * @return <code>true</code> iff the version was successfully committed otherwise <code>false</code>
-     * @see #write(IndexOutput)
-     */
-    public synchronized boolean commitLastVersion(long version) {
-      if (version > lastVersion) {
-        lastVersion = version;
-        return true;
-      }
-      return false;
-    }
-    
-    // just for testing
-    Set<Entry<String, Integer>> entries() {
-      return new HashSet<Entry<String, Integer>>(nameToNumber.entrySet());
-    }
-    
     // used by assert
     synchronized boolean containsConsistent(Integer number, String name) {
       return name.equals(numberToName.get(number))

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java Sun Dec  4 01:14:52 2011
@@ -227,16 +227,6 @@ public class FilterIndexReader extends I
     public int advance(int target) throws IOException {
       return in.advance(target);
     }
-
-    @Override
-    public BulkReadResult getBulkResult() {
-      return in.getBulkResult();
-    }
-
-    @Override
-    public int read() throws IOException {
-      return in.read();
-    }
   }
 
   /** Base class for filtering {@link DocsAndPositionsEnum} implementations. */

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushByRamOrCountsPolicy.java Sun Dec  4 01:14:52 2011
@@ -63,7 +63,7 @@ public class FlushByRamOrCountsPolicy ex
     if ((flushOnRAM() &&
         control.getDeleteBytesUsed() > (1024*1024*indexWriterConfig.getRAMBufferSizeMB()))) {
       control.setApplyAllDeletes();
-     if (writer.infoStream != null) {
+     if (writer.infoStream.isEnabled("FP")) {
        writer.infoStream.message("FP", "force apply deletes bytesUsed=" + control.getDeleteBytesUsed() + " vs ramBuffer=" + (1024*1024*indexWriterConfig.getRAMBufferSizeMB()));
      }
    }
@@ -81,7 +81,7 @@ public class FlushByRamOrCountsPolicy ex
       final long totalRam = control.activeBytes() + control.getDeleteBytesUsed();
       if (totalRam >= limit) {
         final DocumentsWriter writer = this.writer.get();
-        if (writer.infoStream != null) {
+        if (writer.infoStream.isEnabled("FP")) {
           writer.infoStream.message("FP", "flush: activeBytes=" + control.activeBytes() + " deleteBytes=" + control.getDeleteBytesUsed() + " vs limit=" + limit);
         }
         markLargestWriterPending(control, state, totalRam);

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushPolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushPolicy.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushPolicy.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/FlushPolicy.java Sun Dec  4 01:14:52 2011
@@ -129,10 +129,7 @@ public abstract class FlushPolicy {
   }
   
   private boolean assertMessage(String s) {
-    InfoStream infoStream = writer.get().infoStream;
-    if (infoStream != null) {
-      infoStream.message("FP", s);
-    }
+    writer.get().infoStream.message("FP", s);
     return true;
   }
 

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileDeleter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileDeleter.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileDeleter.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileDeleter.java Sun Dec  4 01:14:52 2011
@@ -102,7 +102,7 @@ final class IndexFileDeleter {
   private SegmentInfos lastSegmentInfos;
 
   /** Change to true to see details of reference counts when
-   *  infoStream != null */
+   *  infoStream is enabled */
   public static boolean VERBOSE_REF_COUNTS = false;
 
   // Used only for assert
@@ -128,7 +128,7 @@ final class IndexFileDeleter {
 
     final String currentSegmentsFile = segmentInfos.getCurrentSegmentFileName();
 
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IFD")) {
       infoStream.message("IFD", "init: current segments file is \"" + currentSegmentsFile + "\"; deletionPolicy=" + policy);
     }
 
@@ -160,7 +160,7 @@ final class IndexFileDeleter {
           // This is a commit (segments or segments_N), and
           // it's valid (<= the max gen).  Load it, then
           // incref all files it refers to:
-          if (infoStream != null) {
+          if (infoStream.isEnabled("IFD")) {
             infoStream.message("IFD", "init: load commit \"" + fileName + "\"");
           }
           SegmentInfos sis = new SegmentInfos();
@@ -174,7 +174,7 @@ final class IndexFileDeleter {
             // file segments_X exists when in fact it
             // doesn't.  So, we catch this and handle it
             // as if the file does not exist
-            if (infoStream != null) {
+            if (infoStream.isEnabled("IFD")) {
               infoStream.message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point");
             }
             sis = null;
@@ -205,7 +205,7 @@ final class IndexFileDeleter {
               } catch (FileNotFoundException e) {
                 refresh(segmentInfo.name);
                 sis = null;
-                if (infoStream != null) {
+                if (infoStream.isEnabled("IFD")) {
                   infoStream.message("IFD", "init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point");
                 }
               }
@@ -242,7 +242,7 @@ final class IndexFileDeleter {
       } catch (IOException e) {
         throw new CorruptIndexException("failed to locate current segments_N file");
       }
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IFD")) {
         infoStream.message("IFD", "forced open of current segments file " + segmentInfos.getCurrentSegmentFileName());
       }
       currentCommitPoint = new CommitPoint(commitsToDelete, directory, sis);
@@ -260,7 +260,7 @@ final class IndexFileDeleter {
       RefCount rc = entry.getValue();
       final String fileName = entry.getKey();
       if (0 == rc.count) {
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IFD")) {
           infoStream.message("IFD", "init: removing unreferenced file \"" + fileName + "\"");
         }
         deleteFile(fileName);
@@ -300,7 +300,7 @@ final class IndexFileDeleter {
       // the now-deleted commits:
       for(int i=0;i<size;i++) {
         CommitPoint commit = commitsToDelete.get(i);
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IFD")) {
           infoStream.message("IFD", "deleteCommits: now decRef commit \"" + commit.getSegmentsFileName() + "\"");
         }
         for (final String file : commit.files) {
@@ -360,7 +360,7 @@ final class IndexFileDeleter {
           !refCounts.containsKey(fileName) &&
           !fileName.equals(IndexFileNames.SEGMENTS_GEN)) {
         // Unreferenced file, so remove it
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IFD")) {
           infoStream.message("IFD", "refresh [prefix=" + segmentName + "]: removing newly created unreferenced file \"" + fileName + "\"");
         }
         deleteFile(fileName);
@@ -402,7 +402,7 @@ final class IndexFileDeleter {
    */
   void revisitPolicy() throws IOException {
     assert locked();
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IFD")) {
       infoStream.message("IFD", "now revisitPolicy");
     }
 
@@ -419,7 +419,7 @@ final class IndexFileDeleter {
       deletable = null;
       int size = oldDeletable.size();
       for(int i=0;i<size;i++) {
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IFD")) {
           infoStream.message("IFD", "delete pending file " + oldDeletable.get(i));
         }
         deleteFile(oldDeletable.get(i));
@@ -450,7 +450,7 @@ final class IndexFileDeleter {
   public void checkpoint(SegmentInfos segmentInfos, boolean isCommit) throws IOException {
     assert locked();
 
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IFD")) {
       infoStream.message("IFD", "now checkpoint \"" + segmentInfos.toString(directory) + "\" [" + segmentInfos.size() + " segments " + "; isCommit = " + isCommit + "]");
     }
 
@@ -501,7 +501,7 @@ final class IndexFileDeleter {
   void incRef(String fileName) throws IOException {
     assert locked();
     RefCount rc = getRefCount(fileName);
-    if (infoStream != null && VERBOSE_REF_COUNTS) {
+    if (infoStream.isEnabled("IFD") && VERBOSE_REF_COUNTS) {
       infoStream.message("IFD", "  IncRef \"" + fileName + "\": pre-incr count is " + rc.count);
     }
     rc.IncRef();
@@ -517,7 +517,7 @@ final class IndexFileDeleter {
   void decRef(String fileName) throws IOException {
     assert locked();
     RefCount rc = getRefCount(fileName);
-    if (infoStream != null && VERBOSE_REF_COUNTS) {
+    if (infoStream.isEnabled("IFD") && VERBOSE_REF_COUNTS) {
       infoStream.message("IFD", "  DecRef \"" + fileName + "\": pre-decr count is " + rc.count);
     }
     if (0 == rc.DecRef()) {
@@ -569,7 +569,7 @@ final class IndexFileDeleter {
     assert locked();
     for (final String fileName: files) {
       if (!refCounts.containsKey(fileName)) {
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IFD")) {
           infoStream.message("IFD", "delete new file \"" + fileName + "\"");
         }
         deleteFile(fileName);
@@ -581,7 +581,7 @@ final class IndexFileDeleter {
        throws IOException {
     assert locked();
     try {
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IFD")) {
         infoStream.message("IFD", "delete \"" + fileName + "\"");
       }
       directory.deleteFile(fileName);
@@ -595,7 +595,7 @@ final class IndexFileDeleter {
         // the file is open in another process, and queue
         // the file for subsequent deletion.
 
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IFD")) {
           infoStream.message("IFD", "unable to remove file \"" + fileName + "\": " + e.toString() + "; Will re-try later.");
         }
         if (deletable == null) {

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileNames.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileNames.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileNames.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexFileNames.java Sun Dec  4 01:14:52 2011
@@ -68,9 +68,6 @@ public final class IndexFileNames {
   /** Extension of separate norms */
   public static final String SEPARATE_NORMS_EXTENSION = "s";
 
-  /** Extension of global field numbers */
-  public static final String GLOBAL_FIELD_NUM_MAP_EXTENSION = "fnx";
-
   /**
    * This array contains all filename extensions used by
    * Lucene's index files, with one exception, namely the
@@ -85,7 +82,6 @@ public final class IndexFileNames {
     GEN_EXTENSION,
     NORMS_EXTENSION,
     COMPOUND_FILE_STORE_EXTENSION,
-    GLOBAL_FIELD_NUM_MAP_EXTENSION,
   };
 
   public static final String[] NON_STORE_INDEX_EXTENSIONS = new String[] {

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexUpgrader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexUpgrader.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexUpgrader.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexUpgrader.java Sun Dec  4 01:14:52 2011
@@ -131,11 +131,11 @@ public final class IndexUpgrader {
     final IndexWriter w = new IndexWriter(dir, c);
     try {
       InfoStream infoStream = c.getInfoStream();
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IndexUpgrader")) {
         infoStream.message("IndexUpgrader", "Upgrading all pre-" + Constants.LUCENE_MAIN_VERSION + " segments of index directory '" + dir + "' to version " + Constants.LUCENE_MAIN_VERSION + "...");
       }
       w.forceMerge(1);
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IndexUpgrader")) {
         infoStream.message("IndexUpgrader", "All segments upgraded to version " + Constants.LUCENE_MAIN_VERSION);
       }
     } finally {

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriter.java Sun Dec  4 01:14:52 2011
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -52,7 +51,6 @@ import org.apache.lucene.util.BitVector;
 import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.InfoStream;
-import org.apache.lucene.util.StringHelper;
 import org.apache.lucene.util.ThreadInterruptedException;
 import org.apache.lucene.util.MapBackedSet;
 import org.apache.lucene.util.TwoPhaseCommit;
@@ -212,6 +210,8 @@ public class IndexWriter implements Clos
   volatile SegmentInfos pendingCommit;            // set when a commit is pending (after prepareCommit() & before commit())
   volatile long pendingCommitChangeCount;
 
+  private Collection<String> filesToCommit;
+
   final SegmentInfos segmentInfos;       // the segments
   final FieldNumberBiMap globalFieldNumberMap;
 
@@ -331,9 +331,7 @@ public class IndexWriter implements Clos
 
     final long tStart = System.currentTimeMillis();
 
-    if (infoStream != null) {
-      infoStream.message("IW", "flush at getReader");
-    }
+    infoStream.message("IW", "flush at getReader");
     // Do this up front before flushing so that the readers
     // obtained during this flush are pooled, the first time
     // this method is called:
@@ -364,7 +362,7 @@ public class IndexWriter implements Clos
         synchronized(this) {
           maybeApplyDeletes(applyAllDeletes);
           r = new DirectoryReader(this, segmentInfos, applyAllDeletes);
-          if (infoStream != null) {
+          if (infoStream.isEnabled("IW")) {
             infoStream.message("IW", "return reader version=" + r.getVersion() + " reader=" + r);
           }
         }
@@ -373,7 +371,7 @@ public class IndexWriter implements Clos
         // never reached but javac disagrees:
         return null;
       } finally {
-        if (!success && infoStream != null) {
+        if (!success && infoStream.isEnabled("IW")) {
           infoStream.message("IW", "hit exception during NRT reader");
         }
         // Done: finish the full flush!
@@ -384,7 +382,7 @@ public class IndexWriter implements Clos
     if (anySegmentFlushed) {
       maybeMerge();
     }
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "getReader took " + (System.currentTimeMillis() - tStart) + " msec");
     }
     return r;
@@ -874,7 +872,7 @@ public class IndexWriter implements Clos
           segmentInfos.replace(oldInfos);
           changeCount++;
           segmentInfos.changed();
-          if (infoStream != null)
+          if (infoStream.isEnabled("IW"))
             infoStream.message("IW", "init: loaded commit \"" + commit.getSegmentsFileName() + "\"");
         }
       }
@@ -882,7 +880,7 @@ public class IndexWriter implements Clos
       rollbackSegments = segmentInfos.createBackupSegmentInfos(true);
 
       // start with previous field numbers, but new FieldInfos
-      globalFieldNumberMap = segmentInfos.getOrLoadGlobalFieldNumberMap(directory);
+      globalFieldNumberMap = segmentInfos.getOrLoadGlobalFieldNumberMap();
       docWriter = new DocumentsWriter(codec, config, directory, this, globalFieldNumberMap, bufferedDeletesStream);
 
       // Default deleter (for backwards compatibility) is
@@ -902,7 +900,7 @@ public class IndexWriter implements Clos
         segmentInfos.changed();
       }
 
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "init: create=" + create);
         messageState();
       }
@@ -911,9 +909,7 @@ public class IndexWriter implements Clos
 
     } finally {
       if (!success) {
-        if (infoStream != null) {
-          infoStream.message("IW", "init: hit exception on init; releasing write lock");
-        }
+        infoStream.message("IW", "init: hit exception on init; releasing write lock");
         try {
           writeLock.release();
         } catch (Throwable t) {
@@ -941,7 +937,7 @@ public class IndexWriter implements Clos
   }
 
   private void messageState() throws IOException {
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "\ndir=" + directory + "\n" +
             "index=" + segString() + "\n" +
             "version=" + Constants.LUCENE_VERSION + "\n" +
@@ -949,11 +945,6 @@ public class IndexWriter implements Clos
     }
   }
 
-  /** Returns true if verbosing is enabled (i.e., infoStream != null). */
-  public boolean verbose() {
-    return infoStream != null;
-  }
-
   /**
    * Commits all changes to an index and closes all
    * associated files.  Note that this may be a costly
@@ -1060,7 +1051,7 @@ public class IndexWriter implements Clos
   private void closeInternal(boolean waitForMerges) throws CorruptIndexException, IOException {
 
     try {
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "now flush at close waitForMerges=" + waitForMerges);
       }
 
@@ -1086,14 +1077,13 @@ public class IndexWriter implements Clos
 
       mergeScheduler.close();
 
-      if (infoStream != null)
-        infoStream.message("IW", "now call final commit()");
+      infoStream.message("IW", "now call final commit()");
 
       if (!hitOOM) {
         commitInternal(null);
       }
 
-      if (infoStream != null)
+      if (infoStream.isEnabled("IW"))
         infoStream.message("IW", "at close: " + segString());
       // used by assert below
       final DocumentsWriter oldWriter = docWriter;
@@ -1118,8 +1108,7 @@ public class IndexWriter implements Clos
         closing = false;
         notifyAll();
         if (!closed) {
-          if (infoStream != null)
-            infoStream.message("IW", "hit exception while closing");
+          infoStream.message("IW", "hit exception while closing");
         }
       }
     }
@@ -1348,7 +1337,7 @@ public class IndexWriter implements Clos
         anySegmentFlushed = docWriter.updateDocuments(docs, analyzer, delTerm);
         success = true;
       } finally {
-        if (!success && infoStream != null) {
+        if (!success && infoStream.isEnabled("IW")) {
           infoStream.message("IW", "hit exception updating document");
         }
       }
@@ -1495,8 +1484,9 @@ public class IndexWriter implements Clos
         anySegmentFlushed = docWriter.updateDocument(doc, analyzer, term);
         success = true;
       } finally {
-        if (!success && infoStream != null)
+        if (!success && infoStream.isEnabled("IW")) {
           infoStream.message("IW", "hit exception updating document");
+        }
       }
 
       if (anySegmentFlushed) {
@@ -1644,7 +1634,7 @@ public class IndexWriter implements Clos
     if (maxNumSegments < 1)
       throw new IllegalArgumentException("maxNumSegments must be >= 1; got " + maxNumSegments);
 
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "forceMerge: index now " + segString());
       infoStream.message("IW", "now flush at forceMerge");
     }
@@ -1753,7 +1743,7 @@ public class IndexWriter implements Clos
 
     flush(true, true);
 
-    if (infoStream != null)
+    if (infoStream.isEnabled("IW"))
       infoStream.message("IW", "forceMergeDeletes: index now " + segString());
 
     MergePolicy.MergeSpecification spec;
@@ -1947,9 +1937,7 @@ public class IndexWriter implements Clos
 
     boolean success = false;
 
-    if (infoStream != null ) {
-      infoStream.message("IW", "rollback");
-    }
+    infoStream.message("IW", "rollback");
 
     try {
       synchronized(this) {
@@ -1957,9 +1945,7 @@ public class IndexWriter implements Clos
         stopMerges = true;
       }
 
-      if (infoStream != null ) {
-        infoStream.message("IW", "rollback: done finish merges");
-      }
+      infoStream.message("IW", "rollback: done finish merges");
 
       // Must pre-close these two, in case they increment
       // changeCount so that we can then set it to false
@@ -1984,7 +1970,7 @@ public class IndexWriter implements Clos
         // will always write to a new generation ("write
         // once").
         segmentInfos.rollbackSegmentInfos(rollbackSegments);
-        if (infoStream != null ) {
+        if (infoStream.isEnabled("IW") ) {
           infoStream.message("IW", "rollback: infos=" + segString(segmentInfos));
         }
 
@@ -2011,8 +1997,7 @@ public class IndexWriter implements Clos
         if (!success) {
           closing = false;
           notifyAll();
-          if (infoStream != null)
-            infoStream.message("IW", "hit exception during rollback");
+          infoStream.message("IW", "hit exception during rollback");
         }
       }
     }
@@ -2064,7 +2049,7 @@ public class IndexWriter implements Clos
     } catch (OutOfMemoryError oom) {
       handleOOM(oom, "deleteAll");
     } finally {
-      if (!success && infoStream != null) {
+      if (!success && infoStream.isEnabled("IW")) {
         infoStream.message("IW", "hit exception during deleteAll");
       }
     }
@@ -2077,7 +2062,7 @@ public class IndexWriter implements Clos
 
       // Abort all pending & running merges:
       for (final MergePolicy.OneMerge merge : pendingMerges) {
-        if (infoStream != null)
+        if (infoStream.isEnabled("IW"))
           infoStream.message("IW", "now abort pending merge " + merge.segString(directory));
         merge.abort();
         mergeFinish(merge);
@@ -2085,7 +2070,7 @@ public class IndexWriter implements Clos
       pendingMerges.clear();
 
       for (final MergePolicy.OneMerge merge : runningMerges) {
-        if (infoStream != null)
+        if (infoStream.isEnabled("IW"))
           infoStream.message("IW", "now abort running merge " + merge.segString(directory));
         merge.abort();
       }
@@ -2096,7 +2081,7 @@ public class IndexWriter implements Clos
       // because the merge threads periodically check if
       // they are aborted.
       while(runningMerges.size() > 0) {
-        if (infoStream != null)
+        if (infoStream.isEnabled("IW"))
           infoStream.message("IW", "now wait for " + runningMerges.size() + " running merge to abort");
         doWait();
       }
@@ -2106,8 +2091,7 @@ public class IndexWriter implements Clos
 
       assert 0 == mergingSegments.size();
 
-      if (infoStream != null)
-        infoStream.message("IW", "all running merges have aborted");
+      infoStream.message("IW", "all running merges have aborted");
 
     } else {
       // waitForMerges() will ensure any running addIndexes finishes.
@@ -2127,9 +2111,7 @@ public class IndexWriter implements Clos
    */
   public synchronized void waitForMerges() {
     ensureOpen(false);
-    if (infoStream != null) {
-      infoStream.message("IW", "waitForMerges");
-    }
+    infoStream.message("IW", "waitForMerges");
     while(pendingMerges.size() > 0 || runningMerges.size() > 0) {
       doWait();
     }
@@ -2137,9 +2119,7 @@ public class IndexWriter implements Clos
     // sanity check
     assert 0 == mergingSegments.size();
 
-    if (infoStream != null) {
-      infoStream.message("IW", "waitForMerges done");
-    }
+    infoStream.message("IW", "waitForMerges done");
   }
 
   /**
@@ -2175,7 +2155,7 @@ public class IndexWriter implements Clos
     try {
       if (useCompoundFile(newSegment)) {
         String compoundFileName = IndexFileNames.segmentFileName(newSegment.name, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IW")) {
           infoStream.message("IW", "creating compound file " + compoundFileName);
         }
         // Now build compound file
@@ -2207,7 +2187,7 @@ public class IndexWriter implements Clos
         newSegment.setDelCount(delCount);
         newSegment.advanceDelGen();
         final String delFileName = newSegment.getDelFileName();
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IW")) {
           infoStream.message("IW", "flush: write " + delCount + " deletes to " + delFileName);
         }
         boolean success2 = false;
@@ -2234,7 +2214,7 @@ public class IndexWriter implements Clos
       success = true;
     } finally {
       if (!success) {
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IW")) {
           infoStream.message("IW", "hit exception " +
               "reating compound file for newly flushed segment " + newSegment.name);
         }
@@ -2266,9 +2246,7 @@ public class IndexWriter implements Clos
       FrozenBufferedDeletes packet, FrozenBufferedDeletes globalPacket) throws IOException {
     // Lock order IW -> BDS
     synchronized (bufferedDeletesStream) {
-      if (infoStream != null) {
-        infoStream.message("IW", "publishFlushedSegment");  
-      }
+      infoStream.message("IW", "publishFlushedSegment");  
       
       if (globalPacket != null && globalPacket.any()) {
         bufferedDeletesStream.push(globalPacket);
@@ -2283,7 +2261,7 @@ public class IndexWriter implements Clos
         // generation right away
         nextGen = bufferedDeletesStream.getNextGen();
       }
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "publish sets newSegment delGen=" + nextGen);
       }
       newSegment.setBufferedDeletesGen(nextGen);
@@ -2362,13 +2340,12 @@ public class IndexWriter implements Clos
     noDupDirs(dirs);
 
     try {
-      if (infoStream != null)
-        infoStream.message("IW", "flush at addIndexes(Directory...)");
+      infoStream.message("IW", "flush at addIndexes(Directory...)");
       flush(false, true);
 
       List<SegmentInfo> infos = new ArrayList<SegmentInfo>();
       for (Directory dir : dirs) {
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IW")) {
           infoStream.message("IW", "addIndexes: process directory " + dir);
         }
         SegmentInfos sis = new SegmentInfos(); // read infos from dir
@@ -2381,7 +2358,7 @@ public class IndexWriter implements Clos
           String newSegName = newSegmentName();
           String dsName = info.getDocStoreSegment();
 
-          if (infoStream != null) {
+          if (infoStream.isEnabled("IW")) {
             infoStream.message("IW", "addIndexes: process segment origName=" + info.name + " newName=" + newSegName + " dsName=" + dsName + " info=" + info);
           }
 
@@ -2432,8 +2409,7 @@ public class IndexWriter implements Clos
     int numDocs = 0;
 
     try {
-      if (infoStream != null)
-        infoStream.message("IW", "flush at addIndexes(IndexReader...)");
+      infoStream.message("IW", "flush at addIndexes(IndexReader...)");
       flush(false, true);
 
       String mergedName = newSegmentName();
@@ -2600,7 +2576,7 @@ public class IndexWriter implements Clos
   public final void prepareCommit(Map<String,String> commitUserData) throws CorruptIndexException, IOException {
     ensureOpen(false);
 
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "prepareCommit: flush");
       infoStream.message("IW", "  index before flush " + segString());
     }
@@ -2654,12 +2630,13 @@ public class IndexWriter implements Clos
             // to commit.  This is important in case, eg, while
             // we are trying to sync all referenced files, a
             // merge completes which would otherwise have
-            // removed the files we are now syncing.
-            deleter.incRef(toCommit, false);
+            // removed the files we are now syncing.    
+            filesToCommit = toCommit.files(directory, false);
+            deleter.incRef(filesToCommit);
           }
           success = true;
         } finally {
-          if (!success && infoStream != null) {
+          if (!success) {
             infoStream.message("IW", "hit exception during prepareCommit");
           }
           // Done: finish the full flush!
@@ -2680,7 +2657,8 @@ public class IndexWriter implements Clos
     } finally {
       if (!success) {
         synchronized (this) {
-          deleter.decRef(toCommit);
+          deleter.decRef(filesToCommit);
+          filesToCommit = null;
         }
       }
     }
@@ -2743,21 +2721,15 @@ public class IndexWriter implements Clos
 
   private final void commitInternal(Map<String,String> commitUserData) throws CorruptIndexException, IOException {
 
-    if (infoStream != null) {
-      infoStream.message("IW", "commit: start");
-    }
+    infoStream.message("IW", "commit: start");
 
     synchronized(commitLock) {
-      if (infoStream != null) {
-        infoStream.message("IW", "commit: enter lock");
-      }
+      infoStream.message("IW", "commit: enter lock");
 
       if (pendingCommit == null) {
-        if (infoStream != null) {
-          infoStream.message("IW", "commit: now prepare");
-        }
+        infoStream.message("IW", "commit: now prepare");
         prepareCommit(commitUserData);
-      } else if (infoStream != null) {
+      } else {
         infoStream.message("IW", "commit: already prepared");
       }
 
@@ -2769,10 +2741,9 @@ public class IndexWriter implements Clos
 
     if (pendingCommit != null) {
       try {
-        if (infoStream != null)
-          infoStream.message("IW", "commit: pendingCommit != null");
+        infoStream.message("IW", "commit: pendingCommit != null");
         pendingCommit.finishCommit(directory, codec);
-        if (infoStream != null)
+        if (infoStream.isEnabled("IW"))
           infoStream.message("IW", "commit: wrote segments file \"" + pendingCommit.getCurrentSegmentFileName() + "\"");
         lastCommitChangeCount = pendingCommitChangeCount;
         segmentInfos.updateGeneration(pendingCommit);
@@ -2780,19 +2751,18 @@ public class IndexWriter implements Clos
         rollbackSegments = pendingCommit.createBackupSegmentInfos(true);
         deleter.checkpoint(pendingCommit, true);
       } finally {
-        // Matches the incRef done in startCommit:
-        deleter.decRef(pendingCommit);
+        // Matches the incRef done in prepareCommit:
+        deleter.decRef(filesToCommit);
+        filesToCommit = null;
         pendingCommit = null;
         notifyAll();
       }
 
-    } else if (infoStream != null) {
+    } else {
       infoStream.message("IW", "commit: pendingCommit == null; skip");
     }
 
-    if (infoStream != null) {
-      infoStream.message("IW", "commit: done");
-    }
+    infoStream.message("IW", "commit: done");
   }
 
   // Ensures only one flush() is actually flushing segments
@@ -2832,7 +2802,7 @@ public class IndexWriter implements Clos
     boolean success = false;
     try {
 
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "  start flush: applyAllDeletes=" + applyAllDeletes);
         infoStream.message("IW", "  index before flush " + segString());
       }
@@ -2862,18 +2832,16 @@ public class IndexWriter implements Clos
       // never hit
       return false;
     } finally {
-      if (!success && infoStream != null)
+      if (!success)
         infoStream.message("IW", "hit exception during flush");
     }
   }
   
   final synchronized void maybeApplyDeletes(boolean applyAllDeletes) throws IOException {
     if (applyAllDeletes) {
-      if (infoStream != null) {
-        infoStream.message("IW", "apply all deletes during flush");
-      }
+      infoStream.message("IW", "apply all deletes during flush");
       applyAllDeletes();
-    } else if (infoStream != null) {
+    } else if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "don't apply deletes now delTermCount=" + bufferedDeletesStream.numTerms() + " bytesUsed=" + bufferedDeletesStream.bytesUsed());
     }
   }
@@ -2886,7 +2854,7 @@ public class IndexWriter implements Clos
       checkpoint();
     }
     if (!keepFullyDeletedSegments && result.allDeleted != null) {
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "drop 100% deleted segments: " + segString(result.allDeleted));
       }
       for (SegmentInfo info : result.allDeleted) {
@@ -2951,7 +2919,7 @@ public class IndexWriter implements Clos
 
     final List<SegmentInfo> sourceSegments = merge.segments;
 
-    if (infoStream != null)
+    if (infoStream.isEnabled("IW"))
       infoStream.message("IW", "commitMergeDeletes " + merge.segString(directory));
 
     // Carefully merge deletes that occurred after we
@@ -3049,7 +3017,7 @@ public class IndexWriter implements Clos
       throw new IllegalStateException("this writer hit an OutOfMemoryError; cannot complete merge");
     }
 
-    if (infoStream != null)
+    if (infoStream.isEnabled("IW"))
       infoStream.message("IW", "commitMerge: " + merge.segString(directory) + " index=" + segString());
 
     assert merge.registerDone;
@@ -3061,7 +3029,7 @@ public class IndexWriter implements Clos
     // file that current segments does not reference), we
     // abort this merge
     if (merge.isAborted()) {
-      if (infoStream != null)
+      if (infoStream.isEnabled("IW"))
         infoStream.message("IW", "commitMerge: skipping merge " + merge.segString(directory) + ": it was aborted");
       return false;
     }
@@ -3077,7 +3045,7 @@ public class IndexWriter implements Clos
 
     final boolean allDeleted = mergedReader.numDocs() == 0;
 
-    if (infoStream != null && allDeleted) {
+    if (allDeleted && infoStream.isEnabled("IW")) {
       infoStream.message("IW", "merged segment " + merge.info + " is 100% deleted" +  (keepFullyDeletedSegments ? "" : "; skipping insert"));
     }
 
@@ -3088,7 +3056,7 @@ public class IndexWriter implements Clos
       readerPool.drop(merge.info);
     }
     
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "after commit: " + segString());
     }
 
@@ -3115,7 +3083,7 @@ public class IndexWriter implements Clos
 
   final private void handleMergeException(Throwable t, MergePolicy.OneMerge merge) throws IOException {
 
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "handleMergeException: merge=" + merge.segString(directory) + " exc=" + t);
     }
 
@@ -3164,7 +3132,7 @@ public class IndexWriter implements Clos
         try {
           mergeInit(merge);
 
-          if (infoStream != null)
+          if (infoStream.isEnabled("IW"))
             infoStream.message("IW", "now merge\n  merge=" + merge.segString(directory) + "\n  index=" + segString());
 
           mergeMiddle(merge);
@@ -3178,8 +3146,7 @@ public class IndexWriter implements Clos
           mergeFinish(merge);
 
           if (!success) {
-            if (infoStream != null)
-              infoStream.message("IW", "hit exception during merge");
+            infoStream.message("IW", "hit exception during merge");
             if (merge.info != null && !segmentInfos.contains(merge.info))
               deleter.refresh(merge.info.name);
           }
@@ -3195,7 +3162,7 @@ public class IndexWriter implements Clos
     } catch (OutOfMemoryError oom) {
       handleOOM(oom, "merge");
     }
-    if (infoStream != null && merge.info != null) {
+    if (merge.info != null && infoStream.isEnabled("IW")) {
       infoStream.message("IW", "merge time " + (System.currentTimeMillis()-t0) + " msec for " + merge.info.docCount + " docs");
     }
     //System.out.println(Thread.currentThread().getName() + ": merge end");
@@ -3241,7 +3208,7 @@ public class IndexWriter implements Clos
 
     pendingMerges.add(merge);
 
-    if (infoStream != null)
+    if (infoStream.isEnabled("IW"))
       infoStream.message("IW", "add merge to pendingMerges: " + merge.segString(directory) + " [total " + pendingMerges.size() + " pending]");
 
     merge.mergeGen = mergeGen;
@@ -3251,7 +3218,7 @@ public class IndexWriter implements Clos
     // is running (while synchronized) to avoid race
     // condition where two conflicting merges from different
     // threads, start
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       StringBuilder builder = new StringBuilder("registerMerge merging= [");
       for (SegmentInfo info : mergingSegments) {
         builder.append(info.name).append(", ");  
@@ -3262,7 +3229,7 @@ public class IndexWriter implements Clos
       infoStream.message("IW", builder.toString());  
     }
     for(SegmentInfo info : merge.segments) {
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "registerMerge info=" + info);
       }
       mergingSegments.add(info);
@@ -3283,9 +3250,7 @@ public class IndexWriter implements Clos
       success = true;
     } finally {
       if (!success) {
-        if (infoStream != null) {
-          infoStream.message("IW", "hit exception in mergeInit");
-        }
+        infoStream.message("IW", "hit exception in mergeInit");
         mergeFinish(merge);
       }
     }
@@ -3325,7 +3290,7 @@ public class IndexWriter implements Clos
     }
 
     if (!keepFullyDeletedSegments && result.allDeleted != null) {
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "drop 100% deleted segments: " + result.allDeleted);
       }
       for(SegmentInfo info : result.allDeleted) {
@@ -3350,7 +3315,7 @@ public class IndexWriter implements Clos
     details.put("mergeFactor", Integer.toString(merge.segments.size()));
     setDiagnostics(merge.info, "merge", details);
 
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "merge seg=" + merge.info.name);
     }
 
@@ -3492,7 +3457,7 @@ public class IndexWriter implements Clos
     SegmentMerger merger = new SegmentMerger(infoStream, directory, config.getTermIndexInterval(), mergedName, checkAbort,
                                              payloadProcessorProvider, merge.info.getFieldInfos(), codec, context);
 
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "merging " + merge.segString(directory) + " mergeVectors=" + merge.info.getFieldInfos().hasVectors());
     }
 
@@ -3526,7 +3491,7 @@ public class IndexWriter implements Clos
         segUpto++;
       }
 
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "merge: total " + totDocCount + " docs");
       }
 
@@ -3539,7 +3504,7 @@ public class IndexWriter implements Clos
       // Record which codec was used to write the segment
       merge.info.setCodec(codec);
 
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", "merge codec=" + codec);
       }
 
@@ -3559,7 +3524,7 @@ public class IndexWriter implements Clos
         final String compoundFileName = IndexFileNames.segmentFileName(mergedName, "", IndexFileNames.COMPOUND_FILE_EXTENSION);
 
         try {
-          if (infoStream != null) {
+          if (infoStream.isEnabled("IW")) {
             infoStream.message("IW", "create compound file " + compoundFileName);
           }
           createCompoundFile(directory, compoundFileName, checkAbort, merge.info, new IOContext(merge.getMergeInfo()));
@@ -3578,9 +3543,7 @@ public class IndexWriter implements Clos
           handleMergeException(t, merge);
         } finally {
           if (!success) {
-            if (infoStream != null) {
-              infoStream.message("IW", "hit exception creating compound file during merge");
-            }
+            infoStream.message("IW", "hit exception creating compound file during merge");
 
             synchronized(this) {
               deleter.deleteFile(compoundFileName);
@@ -3599,9 +3562,7 @@ public class IndexWriter implements Clos
           deleter.deleteNewFiles(merge.info.files());
 
           if (merge.isAborted()) {
-            if (infoStream != null) {
-              infoStream.message("IW", "abort merge after building CFS");
-            }
+            infoStream.message("IW", "abort merge after building CFS");
             deleter.deleteFile(compoundFileName);
             return 0;
           }
@@ -3610,7 +3571,7 @@ public class IndexWriter implements Clos
         merge.info.setUseCompoundFile(true);
       }
 
-      if (infoStream != null) {
+      if (infoStream.isEnabled("IW")) {
         infoStream.message("IW", String.format("merged segment size=%.3f MB vs estimate=%.3f MB", merge.info.sizeInBytes()/1024./1024., merge.estimatedMergeBytes/1024/1024.));
       }
 
@@ -3784,23 +3745,20 @@ public class IndexWriter implements Clos
 
     try {
 
-      if (infoStream != null) {
-        infoStream.message("IW", "startCommit(): start");
-      }
+      infoStream.message("IW", "startCommit(): start");
 
       synchronized(this) {
 
         assert lastCommitChangeCount <= changeCount;
 
         if (pendingCommitChangeCount == lastCommitChangeCount) {
-          if (infoStream != null) {
-            infoStream.message("IW", "  skip startCommit(): no changes pending");
-          }
-          deleter.decRef(toSync);
+          infoStream.message("IW", "  skip startCommit(): no changes pending");
+          deleter.decRef(filesToCommit);
+          filesToCommit = null;
           return;
         }
 
-        if (infoStream != null) {
+        if (infoStream.isEnabled("IW")) {
           infoStream.message("IW", "startCommit index=" + segString(toSync) + " changeCount=" + changeCount);
         }
 
@@ -3837,9 +3795,7 @@ public class IndexWriter implements Clos
           pendingCommit = toSync;
         }
 
-        if (infoStream != null) {
-          infoStream.message("IW", "done all syncs");
-        }
+        infoStream.message("IW", "done all syncs");
 
         assert testPoint("midStartCommitSuccess");
 
@@ -3852,12 +3808,11 @@ public class IndexWriter implements Clos
           segmentInfos.updateGeneration(toSync);
 
           if (!pendingCommitSet) {
-            if (infoStream != null) {
-              infoStream.message("IW", "hit exception committing segments file");
-            }
+            infoStream.message("IW", "hit exception committing segments file");
 
             // Hit exception
-            deleter.decRef(toSync);
+            deleter.decRef(filesToCommit);
+            filesToCommit = null;
           }
         }
       }
@@ -3905,7 +3860,7 @@ public class IndexWriter implements Clos
   }
 
   private void handleOOM(OutOfMemoryError oom, String location) {
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "hit OutOfMemoryError inside " + location);
     }
     hitOOM = true;
@@ -3930,7 +3885,7 @@ public class IndexWriter implements Clos
   synchronized boolean nrtIsCurrent(SegmentInfos infos) {
     //System.out.println("IW.nrtIsCurrent " + (infos.version == segmentInfos.version && !docWriter.anyChanges() && !bufferedDeletesStream.any()));
     ensureOpen();
-    if (infoStream != null) {
+    if (infoStream.isEnabled("IW")) {
       infoStream.message("IW", "nrtIsCurrent: infoVersion matches: " + (infos.version == segmentInfos.version) + " DW changes: " + docWriter.anyChanges() + " BD changes: "+bufferedDeletesStream.any());
 
     }

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/IndexWriterConfig.java Sun Dec  4 01:14:52 2011
@@ -695,6 +695,10 @@ public final class IndexWriterConfig imp
    * to this.
    */
   public IndexWriterConfig setInfoStream(InfoStream infoStream) {
+    if (infoStream == null) {
+      throw new IllegalArgumentException("Cannot set InfoStream implementation to null. "+
+        "To disable logging use InfoStream.NO_OUTPUT");
+    }
     this.infoStream = infoStream;
     return this;
   }
@@ -703,8 +707,7 @@ public final class IndexWriterConfig imp
    * Convenience method that uses {@link PrintStreamInfoStream}
    */
   public IndexWriterConfig setInfoStream(PrintStream printStream) {
-    this.infoStream = printStream == null ? null : new PrintStreamInfoStream(printStream);
-    return this;
+    return setInfoStream(printStream == null ? InfoStream.NO_OUTPUT : new PrintStreamInfoStream(printStream));
   }
 
   @Override
@@ -725,7 +728,7 @@ public final class IndexWriterConfig imp
     sb.append("maxBufferedDocs=").append(maxBufferedDocs).append("\n");
     sb.append("mergedSegmentWarmer=").append(mergedSegmentWarmer).append("\n");
     sb.append("codec=").append(codec).append("\n");
-    sb.append("infoStream=").append(infoStream == null ? "null" : infoStream.getClass().getName()).append("\n");
+    sb.append("infoStream=").append(infoStream.getClass().getName()).append("\n");
     sb.append("mergePolicy=").append(mergePolicy).append("\n");
     sb.append("indexerThreadPool=").append(indexerThreadPool).append("\n");
     sb.append("readerPooling=").append(readerPooling).append("\n");

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/LogMergePolicy.java Sun Dec  4 01:14:52 2011
@@ -84,8 +84,8 @@ public abstract class LogMergePolicy ext
   }
 
   protected boolean verbose() {
-    IndexWriter w = writer.get();
-    return w != null && w.verbose();
+    final IndexWriter w = writer.get();
+    return w != null && w.infoStream.isEnabled("LMP");
   }
 
   /** @see #setNoCFSRatio */
@@ -107,10 +107,7 @@ public abstract class LogMergePolicy ext
   
   protected void message(String message) {
     if (verbose()) {
-      final InfoStream infoStream = writer.get().infoStream;
-      if (infoStream != null) {
-        infoStream.message("LMP", message);
-      }
+      writer.get().infoStream.message("LMP", message);
     }
   }
 

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiDocsEnum.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiDocsEnum.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiDocsEnum.java Sun Dec  4 01:14:52 2011
@@ -19,6 +19,7 @@ package org.apache.lucene.index;
 
 import org.apache.lucene.util.ReaderUtil;
 import java.io.IOException;
+import java.util.Arrays;
 
 /**
  * Exposes flex API, merged from flex API of sub-segments.
@@ -123,6 +124,16 @@ public final class MultiDocsEnum extends
   public final static class EnumWithSlice {
     public DocsEnum docsEnum;
     public ReaderUtil.Slice slice;
+    
+    @Override
+    public String toString() {
+      return slice.toString()+":"+docsEnum;
+    }
+  }
+
+  @Override
+  public String toString() {
+    return "MultiDocsEnum(" + Arrays.toString(getSubs()) + ")";
   }
 }
 

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiFields.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiFields.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiFields.java Sun Dec  4 01:14:52 2011
@@ -250,7 +250,7 @@ public final class MultiFields extends F
 
   @Override
   public int getUniqueFieldCount() {
-    return terms.size();
+    return -1;
   }
 }
 

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiNorms.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiNorms.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiNorms.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiNorms.java Sun Dec  4 01:14:52 2011
@@ -39,6 +39,9 @@ import org.apache.lucene.util.ReaderUtil
  * @lucene.experimental
  */
 public class MultiNorms {
+  // no need to instantiate this
+  private MultiNorms() { }
+  
   /**
    * Warning: this is heavy! Do not use in a loop, or implement norms()
    * in your own reader with this (you should likely cache the result).

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiTermsEnum.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiTermsEnum.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/MultiTermsEnum.java Sun Dec  4 01:14:52 2011
@@ -25,6 +25,7 @@ import org.apache.lucene.util.MultiBits;
 import org.apache.lucene.util.ReaderUtil;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Comparator;
 
 /**
@@ -506,6 +507,11 @@ public final class MultiTermsEnum extend
       this.terms = terms;
       current = term;
     }
+
+    @Override
+    public String toString() {
+      return subSlice.toString()+":"+terms;
+    }
   }
 
   private final static class TermMergeQueue extends PriorityQueue<TermsEnumWithSlice> {
@@ -524,4 +530,9 @@ public final class MultiTermsEnum extend
       }
     }
   }
+
+  @Override
+  public String toString() {
+    return "MultiTermsEnum(" + Arrays.toString(subs) + ")";
+  }
 }

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentInfos.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentInfos.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentInfos.java Sun Dec  4 01:14:52 2011
@@ -33,7 +33,6 @@ import java.util.Set;
 
 import org.apache.lucene.index.FieldInfos.FieldNumberBiMap;
 import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.codecs.DefaultSegmentInfosWriter;
 import org.apache.lucene.index.codecs.SegmentInfosReader;
 import org.apache.lucene.index.codecs.SegmentInfosWriter;
 import org.apache.lucene.store.ChecksumIndexInput;
@@ -61,6 +60,36 @@ public final class SegmentInfos implemen
    * be removed, however the numbers should continue to decrease. 
    */
 
+  // TODO: i don't think we need *all* these version numbers here?
+  // most codecs only need FORMAT_CURRENT? and we should rename it 
+  // to FORMAT_FLEX? because the 'preamble' is just FORMAT_CURRENT + codecname
+  // after that the codec takes over. 
+  
+  // also i think this class should write this, somehow we let 
+  // preflexrw hackishly override this (like seek backwards and overwrite it)
+
+  /** This format adds optional per-segment String
+   *  diagnostics storage, and switches userData to Map */
+  public static final int FORMAT_DIAGNOSTICS = -9;
+
+  /** Each segment records whether it has term vectors */
+  public static final int FORMAT_HAS_VECTORS = -10;
+
+  /** Each segment records the Lucene version that created it. */
+  public static final int FORMAT_3_1 = -11;
+
+  /** Each segment records whether its postings are written
+   *  in the new flex format */
+  public static final int FORMAT_4_0 = -12;
+
+  /** This must always point to the most recent file format.
+   * whenever you add a new format, make it 1 smaller (negative version logic)! */
+  // TODO: move this, as its currently part of required preamble
+  public static final int FORMAT_CURRENT = FORMAT_4_0;
+  
+  /** This must always point to the first supported file format. */
+  public static final int FORMAT_MINIMUM = FORMAT_DIAGNOSTICS;
+  
   /** Used for the segments.gen file only!
    * Whenever you add a new format, make it 1 smaller (negative version logic)! */
   public static final int FORMAT_SEGMENTS_GEN_CURRENT = -2;
@@ -73,11 +102,6 @@ public final class SegmentInfos implemen
    */
   public long version = System.currentTimeMillis();
   
-  private long globalFieldMapVersion = 0; // version of the GFNM for the next commit
-  private long lastGlobalFieldMapVersion = 0; // version of the GFNM file we last successfully read or wrote
-  private long pendingMapVersion = -1; // version of the GFNM itself that we have last successfully written
-                                       // or -1 if we it was not written. This is set during prepareCommit 
-
   private long generation = 0;     // generation of the "segments_N" for the next commit
   private long lastGeneration = 0; // generation of the "segments_N" file we last successfully read
                                    // or wrote; this is normally the same as generation except if
@@ -184,15 +208,6 @@ public final class SegmentInfos implemen
                                                  lastGeneration);
   }
   
-  private String getGlobalFieldNumberName(long version) {
-    /*
-     * This creates a file name ${version}.fnx without a leading underscore
-     * since this file might belong to more than one segment (global map) and
-     * could otherwise easily be confused with a per-segment file.
-     */
-    return IndexFileNames.segmentFileName("_"+ version, "", IndexFileNames.GLOBAL_FIELD_NUM_MAP_EXTENSION);
-  }
-
   /**
    * Parse the generation off the segments file name and
    * return it.
@@ -254,14 +269,14 @@ public final class SegmentInfos implemen
       setFormat(format);
     
       // check that it is a format we can understand
-      if (format > DefaultSegmentInfosWriter.FORMAT_MINIMUM)
+      if (format > FORMAT_MINIMUM)
         throw new IndexFormatTooOldException(input, format,
-          DefaultSegmentInfosWriter.FORMAT_MINIMUM, DefaultSegmentInfosWriter.FORMAT_CURRENT);
-      if (format < DefaultSegmentInfosWriter.FORMAT_CURRENT)
+          FORMAT_MINIMUM, FORMAT_CURRENT);
+      if (format < FORMAT_CURRENT)
         throw new IndexFormatTooNewException(input, format,
-          DefaultSegmentInfosWriter.FORMAT_MINIMUM, DefaultSegmentInfosWriter.FORMAT_CURRENT);
+          FORMAT_MINIMUM, FORMAT_CURRENT);
 
-      if (format <= DefaultSegmentInfosWriter.FORMAT_4_0) {
+      if (format <= FORMAT_4_0) {
         codecFormat = Codec.forName(input.readString());
       } else {
         codecFormat = Codec.forName("Lucene3x");
@@ -297,8 +312,6 @@ public final class SegmentInfos implemen
         return null;
       }
     }.run();
-    // either we are on 4.0 or we don't have a lastGlobalFieldMapVersion i.e. its still set to 0
-    assert DefaultSegmentInfosWriter.FORMAT_4_0 <= format || (DefaultSegmentInfosWriter.FORMAT_4_0 > format && lastGlobalFieldMapVersion == 0); 
   }
 
   // Only non-null after prepareCommit has been called and
@@ -308,14 +321,6 @@ public final class SegmentInfos implemen
   private void write(Directory directory, Codec codec) throws IOException {
 
     String segmentFileName = getNextSegmentFileName();
-    final String globalFieldMapFile;
-    if (globalFieldNumberMap != null && globalFieldNumberMap.isDirty()) {
-      globalFieldMapFile = getGlobalFieldNumberName(++globalFieldMapVersion);
-      pendingMapVersion = writeGlobalFieldMap(globalFieldNumberMap, directory, globalFieldMapFile);
-    } else {
-      globalFieldMapFile = null;
-    }
-    
     
     // Always advance the generation on write:
     if (generation == -1) {
@@ -347,16 +352,6 @@ public final class SegmentInfos implemen
         } catch (Throwable t) {
           // Suppress so we keep throwing the original exception
         }
-        if (globalFieldMapFile != null) { // delete if written here
-          try {
-            // Try not to leave global field map in
-            // the index:
-            directory.deleteFile(globalFieldMapFile);
-          } catch (Throwable t) {
-            // Suppress so we keep throwing the original exception
-          }
-        }
-        pendingMapVersion = -1;
       }
     }
   }
@@ -767,8 +762,6 @@ public final class SegmentInfos implemen
   void updateGeneration(SegmentInfos other) {
     lastGeneration = other.lastGeneration;
     generation = other.generation;
-    lastGlobalFieldMapVersion = other.lastGlobalFieldMapVersion;
-    globalFieldMapVersion = other.globalFieldMapVersion;
   }
 
   final void rollbackCommit(Directory dir) throws IOException {
@@ -792,16 +785,6 @@ public final class SegmentInfos implemen
         // in our caller
       }
       pendingSegnOutput = null;
-      if (pendingMapVersion != -1) {
-        try {
-          final String fieldMapName = getGlobalFieldNumberName(globalFieldMapVersion--);
-          dir.deleteFile(fieldMapName);
-        } catch (Throwable t) {
-          // Suppress so we keep throwing the original exception
-          // in our caller
-        }
-        pendingMapVersion = -1;
-      }
     }
   }
 
@@ -820,44 +803,6 @@ public final class SegmentInfos implemen
       throw new IllegalStateException("prepareCommit was already called");
     write(dir, codec);
   }
-  
-  private final long writeGlobalFieldMap(FieldNumberBiMap map, Directory dir, String name) throws IOException {
-    final IndexOutput output = dir.createOutput(name, IOContext.READONCE);
-    boolean success = false;
-    long version;
-    try {
-      version = map.write(output);
-      success = true;
-    } finally {
-      try {
-        output.close();
-      } catch (Throwable t) {
-        // throw orig excp
-      }
-      if (!success) {
-        try {
-          dir.deleteFile(name);
-        } catch (Throwable t) {
-          // throw orig excp
-        }
-      } else {
-        // we must sync here explicitly since during a commit
-        // IW will not sync the global field map. 
-        dir.sync(Collections.singleton(name));
-      }
-    }
-    return version;
-  }
-  
-  private void readGlobalFieldMap(FieldNumberBiMap map, Directory dir) throws IOException {
-    final String name = getGlobalFieldNumberName(lastGlobalFieldMapVersion);
-    final IndexInput input = dir.openInput(name, IOContext.READONCE);
-    try {
-      map.read(input);
-    } finally {
-      input.close();
-    }
-  }
 
   /** Returns all file names referenced by SegmentInfo
    *  instances matching the provided Directory (ie files
@@ -875,9 +820,6 @@ public final class SegmentInfos implemen
          */
         files.add(segmentFileName);
       }
-      if (lastGlobalFieldMapVersion > 0) {
-        files.add(getGlobalFieldNumberName(lastGlobalFieldMapVersion));
-      }
     }
     final int size = size();
     for(int i=0;i<size;i++) {
@@ -929,17 +871,6 @@ public final class SegmentInfos implemen
     }
 
     lastGeneration = generation;
-    if (pendingMapVersion != -1) {
-      /*
-       * TODO is it possible that the commit does not succeed here? if another
-       * commit happens at the same time and we lost the race between the
-       * prepareCommit and finishCommit the latest version is already
-       * incremented.
-       */
-      globalFieldNumberMap.commitLastVersion(pendingMapVersion);
-      pendingMapVersion = -1;
-      lastGlobalFieldMapVersion = globalFieldMapVersion;
-    }
 
     try {
       IndexOutput genOutput = dir.createOutput(IndexFileNames.SEGMENTS_GEN, IOContext.READONCE);
@@ -1003,7 +934,6 @@ public final class SegmentInfos implemen
   void replace(SegmentInfos other) {
     rollbackSegmentInfos(other.asList());
     lastGeneration = other.lastGeneration;
-    lastGlobalFieldMapVersion = other.lastGlobalFieldMapVersion;
     format = other.format;
   }
 
@@ -1027,47 +957,24 @@ public final class SegmentInfos implemen
    * Loads or returns the already loaded the global field number map for this {@link SegmentInfos}.
    * If this {@link SegmentInfos} has no global field number map the returned instance is empty
    */
-  FieldNumberBiMap getOrLoadGlobalFieldNumberMap(Directory dir) throws IOException {
+  FieldNumberBiMap getOrLoadGlobalFieldNumberMap() throws IOException {
     if (globalFieldNumberMap != null) {
       return globalFieldNumberMap;
     }
     final FieldNumberBiMap map  = new FieldNumberBiMap();
     
-    if (lastGlobalFieldMapVersion > 0) {
-      // if we don't have a global map or this is a SI from a earlier version we just return the empty map;
-      readGlobalFieldMap(map, dir);
-    }
     if (size() > 0) {
-      if (format > DefaultSegmentInfosWriter.FORMAT_4_0) {
-        assert lastGlobalFieldMapVersion == 0;
-        // build the map up if we open a pre 4.0 index
-        for (SegmentInfo info : this) {
-          final FieldInfos segFieldInfos = info.getFieldInfos();
-          for (FieldInfo fi : segFieldInfos) {
-            map.addOrGet(fi.name, fi.number);
-          }
+      // build the map up
+      for (SegmentInfo info : this) {
+        final FieldInfos segFieldInfos = info.getFieldInfos();
+        for (FieldInfo fi : segFieldInfos) {
+          map.addOrGet(fi.name, fi.number);
         }
       }
     }
     return globalFieldNumberMap = map;
   }
 
-  /**
-   * Called by {@link SegmentInfosReader} when reading the global field map version
-   */
-  public void setGlobalFieldMapVersion(long version) {
-    lastGlobalFieldMapVersion = globalFieldMapVersion = version;
-  }
-
-  public long getGlobalFieldMapVersion() {
-    return globalFieldMapVersion;
-  }
-  
-  // for testing
-  long getLastGlobalFieldMapVersion() {
-    return lastGlobalFieldMapVersion;
-  }
-  
   /** applies all changes caused by committing a merge to this SegmentInfos */
   void applyMergeChanges(MergePolicy.OneMerge merge, boolean dropSegment) {
     final Set<SegmentInfo> mergedAway = new HashSet<SegmentInfo>(merge.segments);

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentMerger.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentMerger.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/SegmentMerger.java Sun Dec  4 01:14:52 2011
@@ -175,7 +175,7 @@ final class SegmentMerger {
       }
     }
 
-    if (mergeState.infoStream != null) {
+    if (mergeState.infoStream.isEnabled("SM")) {
       mergeState.infoStream.message("SM", "merge store matchedCount=" + mergeState.matchedCount + " vs " + mergeState.readers.size());
       if (mergeState.matchedCount != mergeState.readers.size()) {
         mergeState.infoStream.message("SM", "" + (mergeState.readers.size() - mergeState.matchedCount) + " non-bulk merges");

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/TieredMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/TieredMergePolicy.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/TieredMergePolicy.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/TieredMergePolicy.java Sun Dec  4 01:14:52 2011
@@ -644,16 +644,13 @@ public class TieredMergePolicy extends M
   }
 
   private boolean verbose() {
-    IndexWriter w = writer.get();
-    return w != null && w.verbose();
+    final IndexWriter w = writer.get();
+    return w != null && w.infoStream.isEnabled("TMP");
   }
 
   private void message(String message) {
     if (verbose()) {
-      final InfoStream infoStream = writer.get().infoStream;
-      if (infoStream != null) {
-        infoStream.message("TMP", message);
-      }
+      writer.get().infoStream.message("TMP", message);
     }
   }
 

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/UpgradeIndexMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/UpgradeIndexMergePolicy.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/UpgradeIndexMergePolicy.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/UpgradeIndexMergePolicy.java Sun Dec  4 01:14:52 2011
@@ -147,16 +147,13 @@ public class UpgradeIndexMergePolicy ext
   }
   
   private boolean verbose() {
-    IndexWriter w = writer.get();
-    return w != null && w.verbose();
+    final IndexWriter w = writer.get();
+    return w != null && w.infoStream.isEnabled("UPGMP");
   }
 
   private void message(String message) {
     if (verbose()) {
-      final InfoStream infoStream = writer.get().infoStream;
-      if (infoStream != null) {
-        infoStream.message("UPGMP", message);
-      }
+      writer.get().infoStream.message("UPGMP", message);
     }
   }
   

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/BlockTreeTermsReader.java Sun Dec  4 01:14:52 2011
@@ -47,6 +47,7 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.CodecUtil;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.RamUsageEstimator;
+import org.apache.lucene.util.StringHelper;
 import org.apache.lucene.util.automaton.CompiledAutomaton;
 import org.apache.lucene.util.automaton.RunAutomaton;
 import org.apache.lucene.util.automaton.Transition;
@@ -929,7 +930,7 @@ public class BlockTreeTermsReader extend
             }
             System.arraycopy(currentFrame.suffixBytes, currentFrame.startBytePos, term.bytes, currentFrame.prefix, currentFrame.suffix);
 
-            if (isSubBlock && target.startsWith(term)) {
+            if (isSubBlock && StringHelper.startsWith(target, term)) {
               // Recurse
               //if (DEBUG) System.out.println("      recurse!");
               currentFrame = pushFrame(getState());

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/DocValuesReaderBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/DocValuesReaderBase.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/DocValuesReaderBase.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/DocValuesReaderBase.java Sun Dec  4 01:14:52 2011
@@ -76,7 +76,7 @@ public abstract class DocValuesReaderBas
           final String field = fieldInfo.name;
           // TODO can we have a compound file per segment and codec for
           // docvalues?
-          final String id = DefaultDocValuesConsumer.docValuesId(segment,
+          final String id = DocValuesWriterBase.docValuesId(segment,
               fieldInfo.number);
           values.put(field,
               loadDocValues(docCount, dir, id, fieldInfo.getDocValues(), context));

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java Sun Dec  4 01:14:52 2011
@@ -24,10 +24,6 @@ import org.apache.lucene.index.PerDocWri
 import org.apache.lucene.index.SegmentInfo;
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.codecs.DefaultFieldInfosFormat;
-import org.apache.lucene.index.codecs.DefaultStoredFieldsFormat;
-import org.apache.lucene.index.codecs.DefaultSegmentInfosFormat;
-import org.apache.lucene.index.codecs.DefaultTermVectorsFormat;
 import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldInfosFormat;
 import org.apache.lucene.index.codecs.StoredFieldsFormat;
@@ -36,6 +32,10 @@ import org.apache.lucene.index.codecs.Pe
 import org.apache.lucene.index.codecs.PostingsFormat;
 import org.apache.lucene.index.codecs.SegmentInfosFormat;
 import org.apache.lucene.index.codecs.TermVectorsFormat;
+import org.apache.lucene.index.codecs.lucene40.Lucene40FieldInfosFormat;
+import org.apache.lucene.index.codecs.lucene40.Lucene40SegmentInfosFormat;
+import org.apache.lucene.index.codecs.lucene40.Lucene40StoredFieldsFormat;
+import org.apache.lucene.index.codecs.lucene40.Lucene40TermVectorsFormat;
 import org.apache.lucene.store.Directory;
 
 /**
@@ -49,18 +49,18 @@ public class Lucene3xCodec extends Codec
   private final PostingsFormat postingsFormat = new Lucene3xPostingsFormat();
   
   // TODO: this should really be a different impl
-  private final StoredFieldsFormat fieldsFormat = new DefaultStoredFieldsFormat();
+  private final StoredFieldsFormat fieldsFormat = new Lucene40StoredFieldsFormat();
   
   // TODO: this should really be a different impl
-  private final TermVectorsFormat vectorsFormat = new DefaultTermVectorsFormat();
+  private final TermVectorsFormat vectorsFormat = new Lucene40TermVectorsFormat();
   
   // TODO: this should really be a different impl
-  private final FieldInfosFormat fieldInfosFormat = new DefaultFieldInfosFormat();
+  private final FieldInfosFormat fieldInfosFormat = new Lucene40FieldInfosFormat();
 
   // TODO: this should really be a different impl
   // also if we want preflex to *really* be read-only it should throw exception for the writer?
   // this way IR.commit fails on delete/undelete/setNorm/etc ?
-  private final SegmentInfosFormat infosFormat = new DefaultSegmentInfosFormat();
+  private final SegmentInfosFormat infosFormat = new Lucene40SegmentInfosFormat();
   
   // 3.x doesn't support docvalues
   private final DocValuesFormat docValuesFormat = new DocValuesFormat() {

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xFields.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xFields.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xFields.java Sun Dec  4 01:14:52 2011
@@ -1025,16 +1025,6 @@ public class Lucene3xFields extends Fiel
     public int docID() {
       return docID;
     }
-
-    @Override
-    public int read() throws IOException {
-      if (bulkResult == null) {
-        initBulkResult();
-        bulkResult.docs.ints = new int[32];
-        bulkResult.freqs.ints = new int[32];
-      }
-      return this.docs.read(bulkResult.docs.ints, bulkResult.freqs.ints);
-    }
   }
 
   private final class PreDocsAndPositionsEnum extends DocsAndPositionsEnum {

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermDocs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermDocs.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermDocs.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/SegmentTermDocs.java Sun Dec  4 01:14:52 2011
@@ -23,7 +23,7 @@ import org.apache.lucene.index.FieldInfo
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.FieldInfos;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.codecs.lucene40.DefaultSkipListReader;
+import org.apache.lucene.index.codecs.lucene40.Lucene40SkipListReader;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.util.Bits;
 
@@ -43,7 +43,7 @@ public class SegmentTermDocs {
 
   private int skipInterval;
   private int maxSkipLevels;
-  private DefaultSkipListReader skipListReader;
+  private Lucene40SkipListReader skipListReader;
   
   private long freqBasePointer;
   private long proxBasePointer;
@@ -201,7 +201,7 @@ public class SegmentTermDocs {
     // don't skip if the target is close (within skipInterval docs away)
     if ((target - skipInterval) >= doc && df >= skipInterval) {                      // optimized case
       if (skipListReader == null)
-        skipListReader = new DefaultSkipListReader((IndexInput) freqStream.clone(), maxSkipLevels, skipInterval); // lazily clone
+        skipListReader = new Lucene40SkipListReader((IndexInput) freqStream.clone(), maxSkipLevels, skipInterval); // lazily clone
 
       if (!haveSkipped) {                          // lazily initialize skip stream
         skipListReader.init(skipPointer, freqBasePointer, proxBasePointer, df, currentFieldStoresPayloads);

Modified: lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java?rev=1210041&r1=1210040&r2=1210041&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java (original)
+++ lucene/dev/branches/solrcloud/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java Sun Dec  4 01:14:52 2011
@@ -18,11 +18,6 @@ package org.apache.lucene.index.codecs.l
  */
 
 import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.codecs.DefaultDocValuesFormat;
-import org.apache.lucene.index.codecs.DefaultFieldInfosFormat;
-import org.apache.lucene.index.codecs.DefaultStoredFieldsFormat;
-import org.apache.lucene.index.codecs.DefaultSegmentInfosFormat;
-import org.apache.lucene.index.codecs.DefaultTermVectorsFormat;
 import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldInfosFormat;
 import org.apache.lucene.index.codecs.StoredFieldsFormat;
@@ -32,9 +27,7 @@ import org.apache.lucene.index.codecs.Te
 import org.apache.lucene.index.codecs.perfield.PerFieldPostingsFormat;
 
 /**
- * Implements the Lucene 4.0 index format, with configurable per-field postings formats
- * and using {@link DefaultStoredFieldsFormat} for stored fields and {@link
- * DefaultDocValuesFormat} for doc values.
+ * Implements the Lucene 4.0 index format, with configurable per-field postings formats.
  *
  * @lucene.experimental
  */
@@ -42,11 +35,11 @@ import org.apache.lucene.index.codecs.pe
 // if they are backwards compatible or smallish we can probably do the backwards in the postingsreader
 // (it writes a minor version, etc).
 public class Lucene40Codec extends Codec {
-  private final StoredFieldsFormat fieldsFormat = new DefaultStoredFieldsFormat();
-  private final TermVectorsFormat vectorsFormat = new DefaultTermVectorsFormat();
-  private final DocValuesFormat docValuesFormat = new DefaultDocValuesFormat();
-  private final FieldInfosFormat fieldInfosFormat = new DefaultFieldInfosFormat();
-  private final SegmentInfosFormat infosFormat = new DefaultSegmentInfosFormat();
+  private final StoredFieldsFormat fieldsFormat = new Lucene40StoredFieldsFormat();
+  private final TermVectorsFormat vectorsFormat = new Lucene40TermVectorsFormat();
+  private final FieldInfosFormat fieldInfosFormat = new Lucene40FieldInfosFormat();
+  private final DocValuesFormat docValuesFormat = new Lucene40DocValuesFormat();
+  private final SegmentInfosFormat infosFormat = new Lucene40SegmentInfosFormat();
   private final PostingsFormat postingsFormat = new PerFieldPostingsFormat() {
     @Override
     public PostingsFormat getPostingsFormatForField(String field) {



Mime
View raw message