在NameNode看来,块(Block)主要有以下4种状态:
// HdfsServerConstants
enum BlockUCState {
COMPLETE,
UNDER_CONSTRUCTION,
UNDER_RECOVERY,
COMMITTED
}
在DataNode看来,块(Block)应该称为“副本 (Replica)”比较合适,在DataNode种,副本主要有以下5种状态:
enum ReplicaState {
/** Replica is finalized. The state when replica is not modified. */
FINALIZED(0),
/** Replica is being written to. */
RBW(1),
/** Replica is waiting to be recovered. */
RWR(2),
/** Replica is under recovery. */
RUR(3),
/** Temporary replica: created for replication and relocation only. */
TEMPORARY(4);
}
参考文章: