[
https://issues.apache.org/jira/browse/HDFS-7943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14365720#comment-14365720
]
Jing Zhao commented on HDFS-7943:
---------------------------------
We have two options to fix:
# Change append to support blocks with size greater than the preferred block
size. Specifically, we can update the logic of
{{BlockManager#convertLastBlockToUnderConstruction}}: if the last block size is
greater than or equal to the preferred size, the client should write to a new
block. Since the same function is also used by truncate, the new logic should
also support the scenario that data is truncated from such block.
# Or we can add a new restriction to concat: the source file's preferred block
size cannot be greater than the target. This fix is simpler and keeps the
semantic that the preferred block size is the upper limit of a file's blocks.
> Append cannot handle the last block with length greater than the preferred
> block size
> -------------------------------------------------------------------------------------
>
> Key: HDFS-7943
> URL: https://issues.apache.org/jira/browse/HDFS-7943
> Project: Hadoop HDFS
> Issue Type: Bug
> Affects Versions: 2.7.0
> Reporter: Jing Zhao
> Assignee: Jing Zhao
> Priority: Blocker
>
> In HDFS-3689, we remove the restriction from concat that all the source files
> should have the same preferred block size with the target file. This can
> cause a file to contain blocks with size larger than its preferred block size.
> If such block happens to be the last block of a file, and later we append
> data to the file without the {{CreateFlag.NEW_BLOCK}} flag (i.e., appending
> data to the last block), looks like the current client code will keep writing
> to the last block and never allocate a new block.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)