You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by Dennis Kubes <nu...@dragonflymc.com> on 2006/05/24 22:48:28 UTC

unprotectedRenameTo and Non-Existent Parent Directory

Currently calls to unprotectedRenameTo in FSDirectory will not create 
parent directories of the rename path.  Should this behavior be changed 
to create the parent directories if they do not exist?

This is effecting the LinkDB install method.  For example if I am 
creating a linkdb by the name of crawl/linkdb the install method calls a 
rename from working directory (something like linkdb-1234...) to 
crawl/linkdb/current.  But if the crawl/linkdb directory does not 
already exist then the rename fails.

Dennis

Re: unprotectedRenameTo and Non-Existent Parent Directory

Posted by Dennis Kubes <nu...@dragonflymc.com>.
That is where I was headed as well.  I was thinking of adding something 
like fs.mkdirs(newLinkDb); in the install method.  I will submit a patch.

Dennis

Konstantin Shvachko wrote:
> This is a standard behavior of "mv". Don't think we should change it.
> I think it is better to call mkdirs before renaming.
>
> --Konst
>
> Dennis Kubes wrote:
>
>> Currently calls to unprotectedRenameTo in FSDirectory will not create 
>> parent directories of the rename path.  Should this behavior be 
>> changed to create the parent directories if they do not exist?
>>
>> This is effecting the LinkDB install method.  For example if I am 
>> creating a linkdb by the name of crawl/linkdb the install method 
>> calls a rename from working directory (something like linkdb-1234...) 
>> to crawl/linkdb/current.  But if the crawl/linkdb directory does not 
>> already exist then the rename fails.
>>
>> Dennis
>>
>>
>>
>

Re: unprotectedRenameTo and Non-Existent Parent Directory

Posted by Dennis Kubes <nu...@dragonflymc.com>.
Sorry that should have been:

fs.mkdirs(current);

Konstantin Shvachko wrote:
> This is a standard behavior of "mv". Don't think we should change it.
> I think it is better to call mkdirs before renaming.
>
> --Konst
>
> Dennis Kubes wrote:
>
>> Currently calls to unprotectedRenameTo in FSDirectory will not create 
>> parent directories of the rename path.  Should this behavior be 
>> changed to create the parent directories if they do not exist?
>>
>> This is effecting the LinkDB install method.  For example if I am 
>> creating a linkdb by the name of crawl/linkdb the install method 
>> calls a rename from working directory (something like linkdb-1234...) 
>> to crawl/linkdb/current.  But if the crawl/linkdb directory does not 
>> already exist then the rename fails.
>>
>> Dennis
>>
>>
>>
>

Re: unprotectedRenameTo and Non-Existent Parent Directory

Posted by Konstantin Shvachko <sh...@yahoo-inc.com>.
This is a standard behavior of "mv". Don't think we should change it.
I think it is better to call mkdirs before renaming.

--Konst

Dennis Kubes wrote:

> Currently calls to unprotectedRenameTo in FSDirectory will not create 
> parent directories of the rename path.  Should this behavior be 
> changed to create the parent directories if they do not exist?
>
> This is effecting the LinkDB install method.  For example if I am 
> creating a linkdb by the name of crawl/linkdb the install method calls 
> a rename from working directory (something like linkdb-1234...) to 
> crawl/linkdb/current.  But if the crawl/linkdb directory does not 
> already exist then the rename fails.
>
> Dennis
>
>
>