Hadoop HDFS源码分析 关于数据块的类
1.BlocksMap
官方代码中的注释为:
/** * This class maintains the map from a block to its metadata. * block's metadata currently includes blockCollection it belongs to and * the datanodes that store the block. */
BlocksMap数据块映射,管理名字节点上的数据块的元数据。数据块的元数据包括数据块所属的INode和那些数据节点保存数据块等信息。也就是定位哪个数据块在哪个数据节点上。
2.DatanodeDescriptor
DatanodeDescriptor数据节点描述符。官方解释为:
/** * This class extends the DatanodeInfo class with ephemeral information (eg * health, capacity, what blocks are associated with the Datanode) that is * private to the Namenode, ie this class is not exposed to clients. */
是名字节点中对数据节点的抽象,继承自DatanodeInfo。
3.BlockInfo
BlockInfo 数据块信息,是Block的子类,它增加了数据块所属的INode信息和保存该数据块的数据节点信息。
/** * BlockInfo class maintains for a given block * the {@link INodeFile} it is part of and datanodes where the replicas of * the block are stored. * BlockInfo class maintains for a given block * the {@link BlockCollection} it is part of and datanodes where the replicas of * the block are stored. */
数据块所在数据节点的信息保存在Object[] triplets。