关于数据块、副本的介绍,请参考文章《HDFS源码分析之数据块Block、副本Replica》。
一、数据块状态BlockUCState
数据块状态用枚举类BlockUCState来表示,代码如下:
/**
* States, which a block can go through while it is under construction.
* 状态,一个数据块在under construction(即构建)过程中所应有的状态
*/
static public enum BlockUCState {
/**
* Block construction completed.<br>
* The block has at least one {@link ReplicaState#FINALIZED} replica,
* and is not going to be modified.
* 数据块构建完成状态。这个数据块含有至少一个副本,并且不会被修改。
*/
COMPLETE,
/**
* The block is under construction.<br>
* It has been recently allocated for write or append.
* 数据块处于构建状态下。它最近被分配,用于write或append。
*/
UNDER_CONSTRUCTION,
/**
* The block is under recovery.&