【HDFS】什么叫块恢复
来源:互联网 发布:www.windows.com 编辑:程序博客网 时间:2024/06/02 14:38
从租约管理注释,看写入一致性的一种基本算法
**
* LeaseManager does the lease housekeeping for writing on files.* This class also provides useful static methods for lease recovery.
* 租约管理器主要目的是为了写一致性
* Lease Recovery Algorithm 租约恢复算法
* 1) Namenode retrieves lease information namenode获得租约信息
* 2) For each file f in the lease, consider the last block b of f 一个租约可能是为了写多个文件向fsnamesystem申请的
* 对于每一个文件的最后一个块,考虑以下几种问题
* 2.1) Get the datanodes which contains b知道最后一个块在哪些datanode上
* 2.2) Assign one of the datanodes as the primary datanode p
在拥有最后一个块的dn中选主
* 2.3) p obtains a new generation stamp form the namenode 这个主dn跟namenode要最新的块时间戳,目的是找到哪个dn的最后一个块是更后更新的
* 2.4) p get the block info from each datanode 主dn要掌握其余有最后一个块的dn的关于这个块的信息,为啥是最后一个块?
*
* 因为最后一个块往往有可能因为写的时候出现不一致的情况,有的写得差不多,有的可能还没写完。
* 2.5) p computes the minimum block length 主dn根据掌握的其它dn上这最后一个块的情况,找到目前已经写了的最小长度
* 2.6) p updates the datanodes, which have a valid generation stamp,
* with the new generation stamp and the minimum block length
* 主dn,找到那个最后向nn汇报的dn,并且它的块长度是最短的,这个块应该是最准确的
* 2.7) p acknowledges the namenode the update results
主机告诉nn,上面的结果
* 2.8) Namenode updates the BlockInfo nn更新关于这个块的元信息
* 2.9) Namenode removes f from the lease 把这个文件从租约里剔除,没有了租约,就没法写了,如果这个租约不对应任何文件,连这个租约一起干掉
* and removes the lease once all files have been removed
* 2.10) Namenode commit changes to edit log nn写editslog,这也是改变元数据的一部分
*
* 从上面的块恢复可以看出来,所谓块恢复是在写块的时候,为了保证一致性,找到最后一个块的基准块的过程,那些写得可能比较多的块就会被删除
*/
未完,待续。。
0 0
- 【HDFS】什么叫块恢复
- HDFS上块恢复机制
- HDFS数据块恢复算法的思考
- hadoop之HDFS:数据块恢复与文件上传测试
- 什么叫模式 什么叫框架
- 什么叫"工作流"?什么叫"信息流"?
- 解释什么叫老公?什么叫老婆?
- 什么叫断章取义,什么叫曲解
- 什么叫表达式?什么叫语句? ~
- 什么叫白领?
- 这叫什么
- 什么叫牛B
- 什么叫关键字密度?
- 什么叫可扩展性?
- 什么叫 执行力?
- 什么叫"修炼"
- 什么叫web services
- 什么叫ISO9000
- 我该抛弃桌面程序么?
- Linux下Python代码运行--王艺桦
- 多用GCD,少用PerformSelector
- Java基础的线程概念
- Codeforces Round #240 (Div. 2) A. Mashmokh and Lights
- 【HDFS】什么叫块恢复
- Java线程同步于并发
- <Lua程序设计(第二版)>书摘-2
- TemplateMethod(模版方法)
- android开发从零开始1
- 句柄知识
- Java线程死锁的概念
- Java线程通信
- 线程的中断阻塞与控制