IndexWriter.isLocked() fails on a read-only directory
-----------------------------------------------------

                 Key: LUCENE-2607
                 URL: https://issues.apache.org/jira/browse/LUCENE-2607
             Project: Lucene - Java
          Issue Type: Bug
    Affects Versions: 2.9.2
            Reporter: Trejkaz


This appears to be a regression of some sort because the issue was only 
discovered by us some time after upgrading to the 2.9 series, and was not 
present when we were using 2.3 (big gap between those two, though.)

We had some code like:

{code}
    if (IndexWriter.isLocked(directory))
    {
        IndexWriter.unlock(directory);
    }
{code}

And now we get an exception when this code runs on a read-only location:

{noformat}
java.lang.RuntimeException: Failed to acquire random test lock; please verify 
filesystem for lock directory 'X:\Data\Index' supports locking at
    
org.apache.lucene.store.NativeFSLockFactory.acquireTestLock(NativeFSLockFactory.java:99)
 at
    
org.apache.lucene.store.NativeFSLockFactory.makeLock(NativeFSLockFactory.java:137)
 at
    org.apache.lucene.store.Directory.makeLock(Directory.java:131) at
    org.apache.lucene.index.IndexWriter.isLocked(IndexWriter.java:5672) at
{noformat}

I think it makes more logical sense to return *false* - if locking is not 
possible then it cannot be locked, therefore isLocked should always return 
false.


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

Reply via email to