namenode上对Datanode的表征和管理--Datanode*系列
DatanodeID是继承自WritableComparable,封装了DN的一些基本信息:
namenode在处理心跳FSNamesystem.handleHeartbeat时会调用DatanodeDescriptor.getXXXCommand方法获得BlockCommand,BlockCommand整合了要处理的块和对应的DatanodeInfo信息(XXX可以是Replication、LeaseRecovery、Invalidate)。void readFieldsFromFSEditLog(DataInput in) throws IOException { this.name = UTF8.readString(in); this.storageID = UTF8.readString(in); this.infoPort = in.readShort() & 0x0000ffff; this.capacity = in.readLong(); this.dfsUsed = in.readLong(); this.remaining = in.readLong(); this.lastUpdate = in.readLong(); this.xceiverCount = in.readInt(); this.location = Text.readString(in); this.hostName = Text.readString(in); setAdminState(WritableUtils.readEnum(in, AdminStates.class)); }