You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2010/05/26 14:50:54 UTC

svn commit: r948415 - in /lucene/dev/branches/branch_3x/lucene: backwards/src/test/org/apache/lucene/index/ src/java/org/apache/lucene/index/ src/java/org/apache/lucene/store/ src/test/org/apache/lucene/index/

Author: shaie
Date: Wed May 26 12:50:53 2010
New Revision: 948415

URL: http://svn.apache.org/viewvc?rev=948415&view=rev
Log:
LUCENE-2455: remove indexes from backwards/ and removed more unused methods from IW (3x)

Removed:
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/org/apache/lucene/index/index.30.cfs.zip
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/org/apache/lucene/index/index.30.nocfs.zip
Modified:
    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/store/Directory.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/index.30.cfs.zip
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/index.30.nocfs.zip

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=948415&r1=948414&r2=948415&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 Wed May 26 12:50:53 2010
@@ -300,12 +300,7 @@ public class IndexWriter implements Clos
   private int flushCount;
   private int flushDeletesCount;
 
-  // Used to only allow one addIndexes to proceed at once
-  // TODO: use ReadWriteLock once we are on 5.0
-  private int readCount;                          // count of how many threads are holding read lock
-  private Thread writeThread;                     // non-null if any thread holds write lock
   final ReaderPool readerPool = new ReaderPool();
-  private int upgradeCount;
   
   // This is a "write once" variable (like the organic dye
   // on a DVD-R that may or may not be heated by a laser and
@@ -689,52 +684,6 @@ public class IndexWriter implements Clos
     }
   }
   
-  synchronized void acquireWrite() {
-    assert writeThread != Thread.currentThread();
-    while(writeThread != null || readCount > 0)
-      doWait();
-
-    // We could have been closed while we were waiting:
-    ensureOpen();
-
-    writeThread = Thread.currentThread();
-  }
-
-  synchronized void releaseWrite() {
-    assert Thread.currentThread() == writeThread;
-    writeThread = null;
-    notifyAll();
-  }
-
-  synchronized void acquireRead() {
-    final Thread current = Thread.currentThread();
-    while(writeThread != null && writeThread != current)
-      doWait();
-
-    readCount++;
-  }
-
-  // Allows one readLock to upgrade to a writeLock even if
-  // there are other readLocks as long as all other
-  // readLocks are also blocked in this method:
-  synchronized void upgradeReadToWrite() {
-    assert readCount > 0;
-    upgradeCount++;
-    while(readCount > upgradeCount || writeThread != null) {
-      doWait();
-    }
-    
-    writeThread = Thread.currentThread();
-    readCount--;
-    upgradeCount--;
-  }
-
-  synchronized void releaseRead() {
-    readCount--;
-    assert readCount >= 0;
-    notifyAll();
-  }
-
   /**
    * Used internally to throw an {@link
    * AlreadyClosedException} if this IndexWriter has been
@@ -2784,12 +2733,6 @@ public class IndexWriter implements Clos
         merge.abort();
       }
 
-      // Ensure any running addIndexes finishes.  It's fine
-      // if a new one attempts to start because its merges
-      // will quickly see the stopMerges == true and abort.
-      acquireRead();
-      releaseRead();
-
       // These merges periodically check whether they have
       // been aborted, and stop if so.  We wait here to make
       // sure they all stop.  It should not take very long
@@ -2826,10 +2769,6 @@ public class IndexWriter implements Clos
    *    will have completed once this method completes.</p>
    */
   public synchronized void waitForMerges() {
-    // Ensure any running addIndexes finishes.
-    acquireRead();
-    releaseRead();
-
     while(pendingMerges.size() > 0 || runningMerges.size() > 0) {
       doWait();
     }
@@ -2984,11 +2923,16 @@ public class IndexWriter implements Clos
    * <p>
    * <b>NOTE:</b> this method only copies the segments of the incomning indexes
    * and does not merge them. Therefore deleted documents are not removed and
-   * the new segments are not merged with the existing ones. Alos, the segments 
+   * the new segments are not merged with the existing ones. Also, the segments 
    * are copied as-is, meaning they are not converted to CFS if they aren't, 
    * and vice-versa. If you wish to do that, you can call {@link #maybeMerge} 
    * or {@link #optimize} afterwards.
    * 
+   * <p>
+   * <b>NOTE:</b> if you add indexes that used different codecs that are used
+   * by this IndexWriter, make sure you update this IndexWriter to recognize
+   * them.
+   * 
    * <p>This requires this index not be among those to be added.
    *
    * <p>

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java?rev=948415&r1=948414&r2=948415&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java Wed May 26 12:50:53 2010
@@ -260,7 +260,7 @@ public abstract class Directory implemen
    *        source directory
    * @deprecated should be replaced with calls to
    *             {@link #copy(Directory, String, String)} for every file that
-   *             needs copying. You can use the the following code:
+   *             needs copying. You can use the following code:
    * 
    * <pre>
    * IndexFileNameFilter filter = IndexFileNameFilter.getFilter();

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/index.30.cfs.zip
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/index.30.cfs.zip?rev=948415&r1=948414&r2=948415&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/index.30.nocfs.zip
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/index.30.nocfs.zip?rev=948415&r1=948414&r2=948415&view=diff
==============================================================================
Binary files - no diff available.