[
https://issues.apache.org/jira/browse/HDFS-1831?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13018904#comment-13018904
]
Suresh Srinivas commented on HDFS-1831:
---------------------------------------
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: HDFS-1831
> URL: https://issues.apache.org/jira/browse/HDFS-1831
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: name-node
> Affects Versions: 0.22.0, 0.23.0
> 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