lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-1464) FSDirectory.getDirectory always creates index path
Date Wed, 04 Feb 2015 09:39:35 GMT

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

ASF GitHub Bot commented on LUCENE-1464:
----------------------------------------

Github user uschindler commented on the pull request:

    https://github.com/apache/lucenenet/pull/70#issuecomment-72822745
  
    Hi,
    I checked the Lucene Core 4.8 code. In fact it does not create the directory. The comment
is just bogus. I removed it in Lucene 4.10: http://svn.apache.org/r1657033
    
    In Lucene 5, the move to Java NIO.2 now creates the direczory in the ctor. This is in
my opinion wrong to do, so I started a discussion. In fact, Mike McCandless stated, that there
was already a bug open about this: https://issues.apache.org/jira/browse/LUCENE-1464
    
    The thread is CC'ed to the dev@lucenenet list.


> FSDirectory.getDirectory always creates index path
> --------------------------------------------------
>
>                 Key: LUCENE-1464
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1464
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/store
>    Affects Versions: 2.4, 2.9
>            Reporter: Andrzej Bialecki 
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>         Attachments: LUCENE-1464.patch
>
>
> This was reported to me as a Luke bug, but going deeper it proved to be a non-intuitive
(broken?) behavior of FSDirectory.
> If you use FSDirectory.getDirectory(File nonexistent) on a nonexistent path, but one
that is located under some existing parent path, then FSDirectory:174 uses file.mkdirs() to
create this directory. One would expect a variant of the method with a boolean flag to decide
whether or not to create the output path. However, the API with "create" flag is now deprecated,
with a comment that points to IndexWriter's "create" flag. This comment is misleading, because
the indicated path is created anyway in the file system just by calling FSDirectory.getDirectory().
> I propose to do one of the following:
> * reinstate the variant of the method with "create" flag. In case if this flag is false,
and the index directory is missing, either return null or throw an IOException,
> * keep the API as it is now, but either return null or throw IOException if the index
dir is missing. This breaks the backwards compatibility, because now users are required to
do file.mkdirs() themselves prior to calling FSDirectory.getDirectory().



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message