Package org.apache.hadoop.hdfs.protocol
Class DatanodeInfo
java.lang.Object
org.apache.hadoop.hdfs.protocol.DatanodeID
org.apache.hadoop.hdfs.protocol.DatanodeInfo
- All Implemented Interfaces:
Comparable<DatanodeID>,org.apache.hadoop.net.Node
- Direct Known Subclasses:
DatanodeInfoWithStorage
@Private
@Evolving
public class DatanodeInfo
extends DatanodeID
implements org.apache.hadoop.net.Node
This class extends the primary identifier of a Datanode with ephemeral
state, eg usage information, current administrative state, and the
network location that is communicated to clients.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic classBuilding the DataNodeInfo. -
Field Summary
FieldsFields inherited from class org.apache.hadoop.hdfs.protocol.DatanodeID
EMPTY_DATANODE_ID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDatanodeInfo(DatanodeID nodeID) protectedDatanodeInfo(DatanodeID nodeID, String location) protectedDatanodeInfo(DatanodeInfo from) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDependentHostName(String hostname) Add a hostname to a list of network dependenciesA formatted string for printing the status of the DataNode.booleanRetrieves the admin state of this node.longThe used space by the block pool on data node.floatUsed space by the block pool as percentage of present capacitylonglongfloatlongfloatlongThe raw capacity.A formatted string for reporting the status of the DataNode.List of Network dependencieslongThe used space by the data node.floatThe used space by the data node as percentage of present capacitylongLast block report monotonic time.longLast block report time.longGet the last update timestamp.longThe time when this information was accurate.intgetLevel()Return this node's level in the tree.longgetName()Network location name.network locationlongThe used space by the data node.intorg.apache.hadoop.net.NodeReturn this node's parentlongThe raw free space.floatThe remaining space as percentage of configured capacity.upgrade domainintnumber of active connectionsinthashCode()booleanReturns true if the node has been decommissioned.booleanReturns true if the node is in the process of being decommissionedbooleanReturns true if the node is is entering_maintenancebooleanReturns true if the node is in maintenancebooleanbooleanReturns true if the node is entering or in maintenancebooleanisStale(long staleInterval) Check if the datanode is in stale state.booleanstatic booleanmaintenanceNotExpired(long maintenanceExpireTimeInMS) protected voidsetAdminState(DatanodeInfo.AdminStates newState) Sets the admin state of this node.voidsetBlockPoolUsed(long bpUsed) Sets block pool used spacevoidsetCacheCapacity(long cacheCapacity) Sets cache capacity.voidsetCacheUsed(long cacheUsed) Sets cache used.voidsetCapacity(long capacity) Sets raw capacity.voidSets the admin state to indicate that decommission is complete.voidsetDependentHostNames(List<String> dependencyList) Sets the network dependenciesvoidsetDfsUsed(long dfsUsed) Sets the used space for the datanode.voidPut a node directly to maintenance mode.voidsetLastBlockReportMonotonic(long lastBlockReportMonotonic) Sets the last block report monotonic time.voidsetLastBlockReportTime(long lastBlockReportTime) Sets the last block report time.voidsetLastUpdate(long lastUpdate) Sets time when this information was accurate.voidsetLastUpdateMonotonic(long lastUpdateMonotonic) Set lastUpdate monotonic timevoidsetLevel(int level) voidsetMaintenanceExpireTimeInMS(long maintenanceExpireTimeInMS) voidsetNetworkLocation(String location) Sets the network locationvoidsetNonDfsUsed(long nonDfsUsed) Sets the nondfs-used space for the datanode.voidsetNumBlocks(int blockCount) Sets number of blocks.voidsetParent(org.apache.hadoop.net.Node parent) voidsetRemaining(long remaining) Sets raw free space.voidsetSoftwareVersion(String softwareVersion) voidsetUpgradeDomain(String upgradeDomain) Sets the upgrade domainvoidsetXceiverCount(int xceiverCount) Sets number of active connectionsvoidStart decommissioning a node.voidStart the maintenance operation.voidStop decommissioning a node.voidTake the node out of maintenance mode.Methods inherited from class org.apache.hadoop.hdfs.protocol.DatanodeID
compareTo, getDatanodeUuid, getDatanodeUuidBytes, getHostName, getHostNameBytes, getInfoAddr, getInfoPort, getInfoSecureAddr, getInfoSecurePort, getIpAddr, getIpAddrBytes, getIpcAddr, getIpcPort, getPeerHostName, getResolvedAddress, getXferAddr, getXferAddr, getXferAddrWithHostname, getXferPort, setIpAddr, setPeerHostName, toString, updateRegInfo
-
Field Details
-
EMPTY_ARRAY
-
adminState
-
-
Constructor Details
-
DatanodeInfo
-
DatanodeInfo
-
DatanodeInfo
-
-
Method Details
-
getName
Network location name.- Specified by:
getNamein interfaceorg.apache.hadoop.net.Node
-
getCapacity
public long getCapacity()The raw capacity. -
getDfsUsed
public long getDfsUsed()The used space by the data node. -
getBlockPoolUsed
public long getBlockPoolUsed()The used space by the block pool on data node. -
getNonDfsUsed
public long getNonDfsUsed()The used space by the data node. -
getDfsUsedPercent
public float getDfsUsedPercent()The used space by the data node as percentage of present capacity -
getRemaining
public long getRemaining()The raw free space. -
getBlockPoolUsedPercent
public float getBlockPoolUsedPercent()Used space by the block pool as percentage of present capacity -
getRemainingPercent
public float getRemainingPercent()The remaining space as percentage of configured capacity. -
getCacheCapacity
public long getCacheCapacity()- Returns:
- Amount of cache capacity in bytes
-
getCacheUsed
public long getCacheUsed()- Returns:
- Amount of cache used in bytes
-
getCacheUsedPercent
public float getCacheUsedPercent()- Returns:
- Cache used as a percentage of the datanode's total cache capacity
-
getCacheRemaining
public long getCacheRemaining()- Returns:
- Amount of cache remaining in bytes
-
getCacheRemainingPercent
public float getCacheRemainingPercent()- Returns:
- Cache remaining as a percentage of the datanode's total cache capacity
-
getLastUpdate
public long getLastUpdate()Get the last update timestamp. Return value is suitable for Date conversion. -
getLastUpdateMonotonic
public long getLastUpdateMonotonic()The time when this information was accurate.
Ps: So return value is ideal for calculation of time differences. Should not be used to convert to Date. -
getNumBlocks
public int getNumBlocks()- Returns:
- Num of Blocks
-
setLastUpdateMonotonic
public void setLastUpdateMonotonic(long lastUpdateMonotonic) Set lastUpdate monotonic time -
getXceiverCount
public int getXceiverCount()number of active connections -
setCapacity
public void setCapacity(long capacity) Sets raw capacity. -
setDfsUsed
public void setDfsUsed(long dfsUsed) Sets the used space for the datanode. -
setNonDfsUsed
public void setNonDfsUsed(long nonDfsUsed) Sets the nondfs-used space for the datanode. -
setRemaining
public void setRemaining(long remaining) Sets raw free space. -
setBlockPoolUsed
public void setBlockPoolUsed(long bpUsed) Sets block pool used space -
setCacheCapacity
public void setCacheCapacity(long cacheCapacity) Sets cache capacity. -
setCacheUsed
public void setCacheUsed(long cacheUsed) Sets cache used. -
setLastUpdate
public void setLastUpdate(long lastUpdate) Sets time when this information was accurate. -
setXceiverCount
public void setXceiverCount(int xceiverCount) Sets number of active connections -
setNumBlocks
public void setNumBlocks(int blockCount) Sets number of blocks. -
getNetworkLocation
network location- Specified by:
getNetworkLocationin interfaceorg.apache.hadoop.net.Node
-
setNetworkLocation
Sets the network location- Specified by:
setNetworkLocationin interfaceorg.apache.hadoop.net.Node
-
setUpgradeDomain
Sets the upgrade domain -
getUpgradeDomain
upgrade domain -
addDependentHostName
Add a hostname to a list of network dependencies -
getDependentHostNames
List of Network dependencies -
setDependentHostNames
Sets the network dependencies -
getDatanodeReport
A formatted string for reporting the status of the DataNode. -
dumpDatanode
A formatted string for printing the status of the DataNode. -
startDecommission
public void startDecommission()Start decommissioning a node. old state. -
stopDecommission
public void stopDecommission()Stop decommissioning a node. old state. -
isDecommissionInProgress
public boolean isDecommissionInProgress()Returns true if the node is in the process of being decommissioned -
isDecommissioned
public boolean isDecommissioned()Returns true if the node has been decommissioned. -
setDecommissioned
public void setDecommissioned()Sets the admin state to indicate that decommission is complete. -
startMaintenance
public void startMaintenance()Start the maintenance operation. -
setInMaintenance
public void setInMaintenance()Put a node directly to maintenance mode. -
setMaintenanceExpireTimeInMS
public void setMaintenanceExpireTimeInMS(long maintenanceExpireTimeInMS) - Parameters:
maintenanceExpireTimeInMS- the time that the DataNode is in the maintenance mode until in the unit of milliseconds.
-
getMaintenanceExpireTimeInMS
public long getMaintenanceExpireTimeInMS() -
setLastBlockReportTime
public void setLastBlockReportTime(long lastBlockReportTime) Sets the last block report time. -
setLastBlockReportMonotonic
public void setLastBlockReportMonotonic(long lastBlockReportMonotonic) Sets the last block report monotonic time. -
getLastBlockReportTime
public long getLastBlockReportTime()Last block report time. -
getLastBlockReportMonotonic
public long getLastBlockReportMonotonic()Last block report monotonic time. -
stopMaintenance
public void stopMaintenance()Take the node out of maintenance mode. -
maintenanceNotExpired
public static boolean maintenanceNotExpired(long maintenanceExpireTimeInMS) -
isEnteringMaintenance
public boolean isEnteringMaintenance()Returns true if the node is is entering_maintenance -
isInMaintenance
public boolean isInMaintenance()Returns true if the node is in maintenance -
isMaintenance
public boolean isMaintenance()Returns true if the node is entering or in maintenance -
maintenanceExpired
public boolean maintenanceExpired() -
isInService
public boolean isInService() -
getAdminState
Retrieves the admin state of this node. -
isStale
public boolean isStale(long staleInterval) Check if the datanode is in stale state. Here if the namenode has not received heartbeat msg from a datanode for more than staleInterval, the datanode will be treated as stale node.- Parameters:
staleInterval- the time interval for marking the node as stale. If the last update time is beyond the given time interval, the node will be marked as stale.- Returns:
- true if the node is stale
-
setAdminState
Sets the admin state of this node. -
getParent
public org.apache.hadoop.net.Node getParent()Return this node's parent- Specified by:
getParentin interfaceorg.apache.hadoop.net.Node
-
setParent
public void setParent(org.apache.hadoop.net.Node parent) - Specified by:
setParentin interfaceorg.apache.hadoop.net.Node
-
getLevel
public int getLevel()Return this node's level in the tree. E.g. the root of a tree returns 0 and its children return 1- Specified by:
getLevelin interfaceorg.apache.hadoop.net.Node
-
setLevel
public void setLevel(int level) - Specified by:
setLevelin interfaceorg.apache.hadoop.net.Node
-
hashCode
public int hashCode()- Overrides:
hashCodein classDatanodeID
-
equals
- Overrides:
equalsin classDatanodeID
-
getSoftwareVersion
-
setSoftwareVersion
-