[
https://issues.apache.org/jira/browse/LUCENE-4746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14262129#comment-14262129
]
Uwe Schindler commented on LUCENE-4746:
---------------------------------------
Hi as discussed yesterday in Hangouts: I think we should for now only add the
optimization using Files.copy(), but only if the source directory extends
FSDirectory. We should not do any unwrapping or whatever. As this optimization
mainly only affects index merging (copy/copyFrom is solely used by
{{IndexWriter#addIndexes(Directory...)}} and replication code, where users in
most cases don't wrap directoryies.
Please note: Personally, I hate those Directory.unwrap() method, because it can
lead to bugs! At least (unrelated to this issue), we should add a WARNING to
the javadocs of this method, that you should onlyuseit for "inspection" to
autodetect some specific properties (like spinning disk), but never-ever unwarp
and then start to call methods like openInput/openOutput/... I just mention
this here, if we would unwrap and then call {{FSDirectory#copyFrom}} this would
break all FilterDirectories that, for example, encrypt/decrypt index data! So
we can only optimize file copy if both directories are FSDirectory.
If we write tests for this, we should ensure, that we don't wrap Directory
instances by test framework, so we can really test the FSDirectory specific
copyFrom() implementation.
> Create a move method in Directory.
> ----------------------------------
>
> Key: LUCENE-4746
> URL: https://issues.apache.org/jira/browse/LUCENE-4746
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Mark Miller
> Assignee: Mark Miller
> Fix For: 4.9, Trunk
>
> Attachments: LUCENE-4746.patch, LUCENE-4746.patch
>
>
> I'd like to make a move method for directory.
> We already have a move for Solr in DirectoryFactory, but it seems it belongs
> at the directory level really.
> The default impl can do a copy and delete, but most implementations will be
> able to optimize to a rename.
> Besides the move we do for Solr (to move a replicated index into place), it
> would also be useful for another feature I'd like to add - the ability to
> merge an index with moves rather than copies. In some cases, you don't
> need/want to copy all the files and could just rename/move them.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]