LUCENE-2663: don't try to clear prior lock in IndexWriter when create=true

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1003938 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-10-03 09:07:56 +00:00
parent c8b7a21b4b
commit b83a464b9b
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -1073,11 +1073,6 @@ public class IndexWriter implements Closeable {
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