You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shai Erera (JIRA)" <ji...@apache.org> on 2009/12/09 14:03:18 UTC

[jira] Commented: (LUCENE-2104) IndexWriter.unlock does does nothing if NativeFSLockFactory is used

    [ https://issues.apache.org/jira/browse/LUCENE-2104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788077#action_12788077 ] 

Shai Erera commented on LUCENE-2104:
------------------------------------

I think that if I move those lines (in NativeFSLock.release()):
{code}
      if (!path.delete())
        throw new LockReleaseFailedException("failed to delete " + path);
{code}
to outside the if(lockExists()) section, this should work? Because then the new NativeFSLock will attempt to release an lock that's held by someone else, and fail. If the lock exists for some reason, but nobody is holding it, that line should succeed.

In order to test it, I think I'll need to spawn two processes, which is trickier. Let me know what you think about the fix in the meantime.

> 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
>
>
> 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org