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

Suresh Srinivas commented on HADOOP-7223:
-----------------------------------------

Currently all the comination of createFlag and the expected behavior is not 
clearly defined in FileContext#create(). Here is my proposal on how the 
combination must behave the behavior a user needs:

CreateFlag specifies the file create semantic. Users can combine flags like:
EnumSet.of(CreateFlag.CREATE, CreateFlag.APPEND)

Use the CreateFlag as follows:
CREATE - to create a file if it does not exist, else throw FileAlreadyExists.
APPEND - to append to a file if it exists, else throw FileNotFoundException.
OVERWRITE - to truncate a file if it exists, else throw FileNotFoundException.
CREATE|APPEND - to create a file if it does not exist, else append to an 
existing file.
CREATE|OVERWRITE - to create a file if it does not exist, else overwrite an 
existing file.

Following combination is not valid and will result in 
HadoopIllegalArgumentException:
APPEND|OVERWRITE
CREATE|APPEND|OVERWRITE


> FileContext createFlag combinations during create are not clearly defined
> -------------------------------------------------------------------------
>
>                 Key: HADOOP-7223
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7223
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>            Reporter: Suresh Srinivas
>            Assignee: Suresh Srinivas
>             Fix For: 0.23.0
>
>
> During file creation with FileContext, the expected behavior is not clearly 
> defined for combination of createFlag EnumSet.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to