[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-24 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


I'll mark it @lucene.internal.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch, 
> LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-24 Thread Earwin Burrfoot (JIRA)

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

Earwin Burrfoot commented on LUCENE-2339:
-

bq. closeSafely is not exactly what I had in mind about closeNoException 
because it forces you to catch the IOE if you don't declare you throw it
closeSafely wraps Closeable.close(), which declares IOException. Thus, you 
don't have to declare or discard anything new. As a matter of fact it 
encapsulates exact same code we're seeing copypasted (with varying degrees of 
success) all around Lucene.

As for RuntimeExceptions, I had ones in my Directory implementation, and it 
flew right through Lucene. When I asked our brainiacs if that is okay, they 
said that anything expected should be wrapped with IOException, as the 
operation is zero-cost (for no-exception-happened case), and anything 
unexpected should kill your app in a blaze of glory. I see the point in that, 
if I squint hard enough.

Mike, please mark that closeSagely with whatever.experimental? I think the 
signature may change, as it gets used in more places, like that type parameter 
may be an overkill.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch, 
> LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-24 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


Do we want to suppress only IOExceptions? What about any RuntimeExceptions - 
upon hitting any of them the code will fly away? Not saying it's a bad thing, 
but pointing it out.

Other than that, the patch looks good. closeSafely is not exactly what I had in 
mind about closeNoException because it forces you to catch the IOE if you don't 
declare you throw it, or you need to move on, discarding it. But I guess this 
is a matter for another issue. 

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch, 
> LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-24 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


Oooh!  I like the priorException solution :)

I think this is ready to commit?  I'll add a CHANGES entry, and I added missing 
copyright to IOUtils.java.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch, 
> LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Earwin Burrfoot (JIRA)

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

Earwin Burrfoot commented on LUCENE-2339:
-

I'll get back to the issue in N hours and code something neat. : )

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


Ok that's indeed different :). I guess we can introduce it now, in this issue 
(it's tiny and simple). A closeAll which documents it throws the first 
exception it hits.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


bq. My assumption is that when you call closeNoException you already know that 
you've hit an exception and just want to close the stream w/o getting more 
exceptions. If you don't know that, don't call closeNoException?

Right, for this issue, let's do that.

At some point in the future I'd like a "closeAllAndThrowFirstExceptionYouHit" :)

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


bq. But there is still a need to "close everything, but do throw the 1st 
exception you hit".

Ohh I see what you mean. My assumption is that when you call closeNoException 
you already know that you've hit an exception and just want to close the stream 
w/o getting more exceptions. If you don't know that, don't call 
closeNoException?

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


bq. So how about we call it closeNoException, document that it does not throw 
any exception and intentionally suppresses them, and if you don't want them to 
be suppressed, you can call io.close() yourself?

But there is still a need to "close everything, but do throw the 1st exception 
you hit".  We do this in a number of places in Lucene, ad-hoc today.

However, that need is different from what we're doing here, so I agree, let's 
postpone it and have this issue only create the "closeNoException" method.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


Mike, that's what I wrote above "if someone does not want to suppress, he 
should call close". I think that closeSafely (or as I prefer it - 
closeNoException) should be closed only when you know you've hit an exception 
and you want to close the stream suppressing any exceptions. Otherwise call 
close().

bq. can we add a boolean arg (suppressExceptions) to control that?

That would beat the purpose of the method no? I mean, currently it does not 
throw any exception, not even declaring one, and if we add that boolean it will 
need to declare "throws IOException", which will force the caller to try-catch 
that exception and ... suppress it or document "// cannot happen because I've 
passed false"?

So how about we call it closeNoException, document that it does not throw any 
exception and intentionally suppresses them, and if you don't want them to be 
suppressed, you can call io.close() yourself?

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


Urgh... can we add a boolean arg (suppressExceptions) to control that?  
Because, if you did not hit an exception when copying, but then hit one when 
closing, we want to throw it in that case...



> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Earwin Burrfoot (JIRA)

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

Earwin Burrfoot commented on LUCENE-2339:
-

Not right.
Imagine exception is thrown when copying, then I try to close the channels. If 
that close throws another exception, I either has to suppress it, or to throw 
and thus hide initial exception.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


bq. Let's mask it? That way the user may get the wrong exception, but he's not 
getting a situation when something failed but looks okay on the surface.

By "mask it" you mean hold onto the first exception you hit, continue closing & 
ignoring any further exceptions, then throw that first exception, right?

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


I don't want to block the issue. If LUCENE-1482 will advance somewhere, we'll 
log a message in closeSafely. Otherwise between suppressing to always printing 
I agree we should suppress. If someone does not want to suppress he should call 
close(). Which makes me think we should call this method closeNoException 
because closeSafely is not exactly what it does :).

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Earwin Burrfoot (JIRA)

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

Earwin Burrfoot commented on LUCENE-2339:
-

bq. So unless LUCENE-1482 springs back to life again, what do you suggest we 
do? Suppressing the exceptions seems wrong to me.
bq. But can we change it to throw the first exception it encounters? 
That's exactly what most of lucene is doing when closing something. If you 
can't log, you either suppress, or mask the previous exception.
Let's mask it? That way the user may get the wrong exception, but he's not 
getting a situation when something failed but looks okay on the surface.

bq. I love CloseSafely! We do that in a number of places and should simply call 
it, instead.
I did this for readers in my reopen patch, except new utility method does 
decRef.

bq. I also prefer Arrays.asList to be explicit
ok :/

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


I love CloseSafely!  We do that in a number of places and should simply call 
it, instead.  But can we change it to throw the first exception it encounters?

I also prefer Arrays.asList to be explicit.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


Sorry ... I was confused w/ the for loop of Java 5 :). Let's keep it Collection 
then. Sorry for the hassle.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-23 Thread Uwe Schindler (JIRA)

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

Uwe Schindler commented on LUCENE-2339:
---

bq. I just wanted to avoid converting arrays to a Collection, just so that they 
can be iterated on. 

Sorry, for the dumb question: In which JDK do arrays implement Iterable? From 
my knowledge and a quick check with Java 5, it does not. Passing an array to a 
method taking Iterable does not work. Arrays only work in extended for 
statement, but not because they are Itearble. The generated code by javac is 
also totally different (and more effective than creating an iterator, it just 
uses the conventional for(i=0; ihttp://stackoverflow.com/questions/1160081/why-is-an-array-not-assignable-to-iterable]
- [http://72.5.124.102/thread.jspa?threadID=558036&tstart=607]

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


I personally haven't seen problem using NIO on Windows, but that's perhaps just 
because I haven't run into them yet :). I think your proposal makes sense - 
let's start w/ NIO bulk-copy and then we can disable if people complain or 
report errors.

Consistency is important, I agree. So let's keep Collection there. I just 
wanted to avoid converting arrays to a Collection, just so that they can be 
iterated on. Seems a waste to me, but not so much to argue about :).

Re (7), I hate such libraries too. But I hate more the ones that just hide 
problems away from me :). The ideal thing was if Lucene would use a logging 
mechanism (I once started it on LUCENE-1482) so that you could include the 
stacktrace print if logging is enabled. But currently the code just hides the 
problem away ... and I'd hate to debug such thing, not realizing an IO 
exception is thrown from close().

So unless LUCENE-1482 springs back to life again, what do you suggest we do? 
Suppressing the exceptions seems wrong to me.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Shai Erera (JIRA)

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

Shai Erera commented on LUCENE-2339:


Patch looks good! Few comments:

# is it safe to use NIO for all FSDirs? I thought that on Windows NIO has some 
bugs/limitations. In that case, would it be safer if just NIOFSDir used NIO?
# Can copyTo(Directory, Collection) be changed to copyTo(Directory, 
Iterable)? Unless we think that someone would want to use size() or 
something.
# I know it's a matter of style, but you "import static Arrays.asList", and 
then use asList directly in copyTo(Dir). It confuses me because I expect asList 
to be a method declared on Dir, and so I prefer to see Arrays.asList. But it's 
just style, don't know how others feel about that.
# On copyTo(Dir), perhaps instead of converting the listAll() to List and then 
remove elements from it, you can just iterate on whatever listAll() returns and 
add the files that pass the filter to a list? You can even optimize and if all 
the files Dir returned pass the filter, you can just pass the array to 
copyTo(Dir, Iterable), assuming we change the method to accept Iterable. But 
that's a minor optimization.
# copy(src, dest, boolean) - can you add a message to @deprecated so users will 
know what to replace it with more easily?
# I see that copy(src, dest) also accepts a boolean of whether to close the src 
directory. But copyTo(dIr) doesn't. I personally think it's ok, as someone can 
call close on src himself, but am wondering if it wouldn't be more convenient. 
I.e. instead of change calls from Directory.copy(src, dest, true), I now need 
to do src.copyTo(dest) followed by a src.close().
# closeSafely - perhaps print the stacktrace, even if you don't throw it?

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch, LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Earwin Burrfoot (JIRA)

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

Earwin Burrfoot commented on LUCENE-2339:
-

bq. Google says that with certain restrictions on the size of the chunk 
transferred at once (eg. one huge chunk for linux, 64mb-something chunks for 
windows), this works crossplatform.
Heh. The bug existed only on 1.4 and was fixed. So I guess it works everywhere.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


OK this sounds like a good plan!

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Earwin Burrfoot (JIRA)

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

Earwin Burrfoot commented on LUCENE-2339:
-

bq. NIO's transferTo, right?
I didn't remember this at the point of writing, but yes, transferTo.
Google says that with certain restrictions on the size of the chunk transferred 
at once (eg. one huge chunk for linux, 64mb-something chunks for windows), this 
works crossplatform.
n...@java7 has an even more simple Path.copyTo() method, so happy 7 users can 
use this.

bq. For backups I wonder if we should make a copyTo/From that takes an 
IndexCommit
Ohmigosh, no! : }
You can get file list from IC and feed it into copy(). More power with less API 
surface.

I'm going to add two methods copyTo(target) and copyTo(target, filenames), 
rewrite copy(source, target, close) to use these and deprecate it.
There's no point in keeping around slightly different versions of the same 
thing, and I believe people can easily close their source dirs by themselves, 
what a stupid option.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


bq. I wonder if we could convert these methods from static to members, so it 
becomes 'from.copyTo(to, files)' ?

I like this approach.

bq. I believe you can rig some nio-based file copier that bypasses Java 
completely, so you don't have to pass multi-gb indexes through your heap when, 
say, backing up.

NIO's transferTo, right?

For backups I wonder if we should make a copyTo/From that takes an 
IndexCommit... but maybe that's going too far.  EG you'd also want it to be 
incremental (only copy new files, maybe delete no longer referenced ones, etc.).

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Earwin Burrfoot (JIRA)

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

Earwin Burrfoot commented on LUCENE-2339:
-

I wonder if we could convert these methods from static to members, so it 
becomes  'from.copyTo(to, files)' ?
This opens up the possibility to override.. and.. hmm.. optimize somehow, if 
'to' is of the same type as 'this'.
I believe you can rig some nio-based file copier that bypasses Java completely, 
so you don't have to pass multi-gb indexes through your heap when, say, backing 
up.

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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



[jira] Commented: (LUCENE-2339) Allow Directory.copy() to accept a collection of file names to be copied

2010-03-22 Thread Michael McCandless (JIRA)

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

Michael McCandless commented on LUCENE-2339:


Patch looks good Earwin -- simple addition.  I'll commit later today...  thanks!

> Allow Directory.copy() to accept a collection of file names to be copied
> 
>
> Key: LUCENE-2339
> URL: https://issues.apache.org/jira/browse/LUCENE-2339
> Project: Lucene - Java
>  Issue Type: Improvement
>Reporter: Earwin Burrfoot
>Assignee: Michael McCandless
> Attachments: LUCENE-2339.patch
>
>
> Par example, I want to copy files pertaining to a certain commit, and not 
> everything there is in a Directory.

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