[
https://issues.apache.org/jira/browse/LUCENE-2104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788611#action_12788611
]
Shai Erera commented on LUCENE-2104:
------------------------------------
Uwe, the problem is that unlock does nothing when NativeFSLock is used. So I
open an IndexWriter and receive a LockObtainFailedException, and then call
unlock because I'm sure no one else holds the lock, I expect to be able to open
the writer after unlock returns. With NativeFSLock, I cannot fail to obtain the
lock if it's there but nobody uses it, so if I hit the exception, I shouldn't
be allowed to call unlock.
If you use SimpleFSLockFactory and call IndexWriter.unlock(), but
SimpleFSLock.release() fails, you hit an exception. With NativeFSLock it's not
the same, simply because NativeFSLockFactory.makeLock creates a new instance
with a 'lock = null', and therefore calling release() is always a no-op.
I think the symmetry is broken and that's what the issue and patch attempt to
fix.
> IndexWriter.unlock does does nothing if NativeFSLockFactory is used
> -------------------------------------------------------------------
>
> Key: LUCENE-2104
> URL: https://issues.apache.org/jira/browse/LUCENE-2104
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Shai Erera
> Fix For: 3.1
>
> Attachments: LUCENE-2104.patch
>
>
> If NativeFSLockFactory is used, IndexWriter.unlock will return, silently
> doing nothing. The reason is that NativeFSLockFactory's makeLock always
> creates a new NativeFSLock. NativeFSLock's release first checks if its lock
> is not null. However, only if obtain() is called, that lock is not null. So
> release actually does nothing, and so IndexWriter.unlock does not delete the
> lock, or fail w/ exception.
> This is only a problem in NativeFSLock, and not in other Lock
> implementations, at least as I was able to see.
> Need to think first how to reproduce in a test, and then fix it. I'll work on
> it.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]