You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2010/10/03 11:07:57 UTC

svn commit: r1003938 - in /lucene/dev/trunk/lucene: CHANGES.txt src/java/org/apache/lucene/index/IndexWriter.java

Author: mikemccand
Date: Sun Oct  3 09:07:56 2010
New Revision: 1003938

URL: http://svn.apache.org/viewvc?rev=1003938&view=rev
Log:
LUCENE-2663: don't try to clear prior lock in IndexWriter when create=true

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

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1003938&r1=1003937&r2=1003938&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Sun Oct  3 09:07:56 2010
@@ -132,6 +132,13 @@ Changes in Runtime Behavior
   changed to enable unmapping by default if supported by the JRE.
   (Mike McCandless, Uwe Schindler, Robert Muir)
 
+* LUCENE-2663: IndexWriter no longer forcefully clears any existing
+  locks when create=true.  This was a holdover from when
+  SimpleFSLockFactory was the default locking implementation, and,
+  even then it was dangerous since it could mask bugs in IndexWriter's
+  usage, allowing applications to accidentally open two writers on the
+  same directory.  (Mike McCandless)
+
 API Changes
 
 * LUCENE-2302, LUCENE-1458, LUCENE-2111, LUCENE-2514: Terms are no longer

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java?rev=1003938&r1=1003937&r2=1003938&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/IndexWriter.java Sun Oct  3 09:07:56 2010
@@ -1073,11 +1073,6 @@ public class IndexWriter implements Clos
       create = !IndexReader.indexExists(directory);
     }
 
-    if (create) {
-      // Clear the write lock in case it's leftover:
-      directory.clearLock(WRITE_LOCK_NAME);
-    }
-
     writeLock = directory.makeLock(WRITE_LOCK_NAME);
 
     if (!writeLock.obtain(writeLockTimeout)) // obtain write lock