带附加功能的 HDFS 是如何工作的
假设一个文件使用默认块大小 (128 MB),并且有一个文件使用 130 MB;因此使用 1 个全尺寸块和 1 个 2 MB 块。然后需要将 20 MB 附加到文件中(现在总计应为 150 MB)。会发生什么?
HDFS 实际上是否将最后一个块的大小从 2MB 调整为 22MB?或者创建一个新块?
向 HDFS 中的文件追加内容如何处理并发性? 是否存在数据丢失的风险?
HDFS是否创建第三个块,将20+2MB放入其中,并删除2MB的块。如果是,它是如何同时工作的?
Let's assume one is using default block size (128 MB), and there is a file using 130 MB ; so using one full size block and one block with 2 MB. Then 20 MB needs to be appended to the file (total should be now of 150 MB). What happens?
Does HDFS actually resize the size of the last block from 2MB to 22MB? Or create a new block?
How does appending to a file in HDFS deal with conccurency?
Is there risk of dataloss ?
Does HDFS create a third block put the 20+2 MB in it, and delete the block with 2MB. If yes, how does this work concurrently?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据最新设计文档中的Jira 问题 前面提到,我们找到您问题的以下答案:
According to the latest design document in the Jira issue mentioned before, we find the following answers to your question:
这是一个非常全面的关于追加的设计文档,它包含并发性问题。
当前的 HDFS 文档给出了链接到该文档,因此我们可以假设它是最新的。 (文档日期为 2009 年)
以及相关的问题。
Here is a very comprehensive design document about append and it contains concurrency issues.
Current HDFS docs gives a link to that document, so we can assume that it is the recent one. (Document date is 2009)
And the related issue.
Hadoop 分布式文件系统支持附加到文件,在这种情况下,它应该将 20 MB 添加到示例中的第二个块(最初包含 2 MB 的块)。这样您最终将得到两个块,一个具有 128 MB,另一个具有 22 MB。
This是HDFS附加java文档的参考。
Hadoop Distributed File System supports appends to files, and in this case it should add the 20 MB to the 2nd block in your example (the one with 2 MB in it initially). That way you will end up with two blocks, one with 128 MB and one with 22 MB.
This is the reference to the append java docs for HDFS.