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

Gustavo Anatoly commented on HBASE-11045:
-----------------------------------------

Hi, Steve. Sorry for delay.

About your question:

bq. Is there any barrier to using a check for the parent dir existing before 
calling create?

I think there are no problem, but the validations to check if the parent path 
doesn't exist more is responsibility of Hadoop. So your idea is good if 
encapsulated into HFileSystem#createNonRecursive():

{code}
if (!fs.exists(f.getParent())) {
      String exceptionMsg = "Path doesn't exist: " + f.getParent().toString();
      LOG.error(exceptionMsg);
      throw new IOException(exceptionMsg);
    }
    return fs.create(f, overwrite, bufferSize, replication, blockSize, 
progress);
{code}

And following the adjustments, ProtobufLogWriter#init() line 79:
{code}
...
HFileSystem hFS = new HFileSystem(fs);
output = hFS.createNonRecursive(path, overwritable, bufferSize, replication, 
blockSize, null);
output.write(ProtobufLogReader.PB_WAL_MAGIC);
...
{code}

But I prefer put this validations on Hadoop :) But what do you think? 
[~ste...@apache.org] [~tedyu] [~enis-2]

> Replace deprecated method FileSystem#createNonRecursive
> -------------------------------------------------------
>
>                 Key: HBASE-11045
>                 URL: https://issues.apache.org/jira/browse/HBASE-11045
>             Project: HBase
>          Issue Type: Task
>            Reporter: Gustavo Anatoly
>            Assignee: Gustavo Anatoly
>            Priority: Minor
>             Fix For: 0.99.0
>
>
> This change affect directly ProtobufLogWriter#init() associated to 
> TestHLog#testFailedToCreateHLogIfParentRenamed.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to