HDFS-4068. DatanodeID and DatanodeInfo member should be private. Contributed by Eli Collins
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1399443 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f91a2cb14d
commit
4d5600f6c7
@ -396,6 +396,8 @@ Release 2.0.3-alpha - Unreleased
|
|||||||
|
|
||||||
HDFS-4029. GenerationStamp should use an AtomicLong. (eli)
|
HDFS-4029. GenerationStamp should use an AtomicLong. (eli)
|
||||||
|
|
||||||
|
HDFS-4068. DatanodeID and DatanodeInfo member should be private. (eli)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
@ -37,12 +37,12 @@
|
|||||||
public class DatanodeID implements Comparable<DatanodeID> {
|
public class DatanodeID implements Comparable<DatanodeID> {
|
||||||
public static final DatanodeID[] EMPTY_ARRAY = {};
|
public static final DatanodeID[] EMPTY_ARRAY = {};
|
||||||
|
|
||||||
protected String ipAddr; // IP address
|
private String ipAddr; // IP address
|
||||||
protected String hostName; // hostname
|
private String hostName; // hostname
|
||||||
protected String storageID; // unique per cluster storageID
|
private String storageID; // unique per cluster storageID
|
||||||
protected int xferPort; // data streaming port
|
private int xferPort; // data streaming port
|
||||||
protected int infoPort; // info server port
|
private int infoPort; // info server port
|
||||||
protected int ipcPort; // IPC server port
|
private int ipcPort; // IPC server port
|
||||||
|
|
||||||
public DatanodeID(DatanodeID from) {
|
public DatanodeID(DatanodeID from) {
|
||||||
this(from.getIpAddr(),
|
this(from.getIpAddr(),
|
||||||
|
@ -37,13 +37,13 @@
|
|||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
@InterfaceStability.Evolving
|
@InterfaceStability.Evolving
|
||||||
public class DatanodeInfo extends DatanodeID implements Node {
|
public class DatanodeInfo extends DatanodeID implements Node {
|
||||||
protected long capacity;
|
private long capacity;
|
||||||
protected long dfsUsed;
|
private long dfsUsed;
|
||||||
protected long remaining;
|
private long remaining;
|
||||||
protected long blockPoolUsed;
|
private long blockPoolUsed;
|
||||||
protected long lastUpdate;
|
private long lastUpdate;
|
||||||
protected int xceiverCount;
|
private int xceiverCount;
|
||||||
protected String location = NetworkTopology.DEFAULT_RACK;
|
private String location = NetworkTopology.DEFAULT_RACK;
|
||||||
|
|
||||||
// Datanode administrative states
|
// Datanode administrative states
|
||||||
public enum AdminStates {
|
public enum AdminStates {
|
||||||
@ -81,8 +81,7 @@ public DatanodeInfo(DatanodeInfo from) {
|
|||||||
this.lastUpdate = from.getLastUpdate();
|
this.lastUpdate = from.getLastUpdate();
|
||||||
this.xceiverCount = from.getXceiverCount();
|
this.xceiverCount = from.getXceiverCount();
|
||||||
this.location = from.getNetworkLocation();
|
this.location = from.getNetworkLocation();
|
||||||
this.adminState = from.adminState;
|
this.adminState = from.getAdminState();
|
||||||
this.hostName = from.hostName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatanodeInfo(DatanodeID nodeID) {
|
public DatanodeInfo(DatanodeID nodeID) {
|
||||||
|
@ -276,11 +276,11 @@ public BlockInfo replaceBlock(BlockInfo oldBlock, BlockInfo newBlock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void resetBlocks() {
|
public void resetBlocks() {
|
||||||
this.capacity = 0;
|
setCapacity(0);
|
||||||
this.remaining = 0;
|
setRemaining(0);
|
||||||
this.blockPoolUsed = 0;
|
setBlockPoolUsed(0);
|
||||||
this.dfsUsed = 0;
|
setDfsUsed(0);
|
||||||
this.xceiverCount = 0;
|
setXceiverCount(0);
|
||||||
this.blockList = null;
|
this.blockList = null;
|
||||||
this.invalidateBlocks.clear();
|
this.invalidateBlocks.clear();
|
||||||
this.volumeFailures = 0;
|
this.volumeFailures = 0;
|
||||||
@ -303,15 +303,15 @@ public int numBlocks() {
|
|||||||
*/
|
*/
|
||||||
public void updateHeartbeat(long capacity, long dfsUsed, long remaining,
|
public void updateHeartbeat(long capacity, long dfsUsed, long remaining,
|
||||||
long blockPoolUsed, int xceiverCount, int volFailures) {
|
long blockPoolUsed, int xceiverCount, int volFailures) {
|
||||||
this.capacity = capacity;
|
setCapacity(capacity);
|
||||||
this.dfsUsed = dfsUsed;
|
setRemaining(remaining);
|
||||||
this.remaining = remaining;
|
setBlockPoolUsed(blockPoolUsed);
|
||||||
this.blockPoolUsed = blockPoolUsed;
|
setDfsUsed(dfsUsed);
|
||||||
this.lastUpdate = Time.now();
|
setXceiverCount(xceiverCount);
|
||||||
this.xceiverCount = xceiverCount;
|
setLastUpdate(Time.now());
|
||||||
this.volumeFailures = volFailures;
|
this.volumeFailures = volFailures;
|
||||||
this.heartbeatedSinceFailover = true;
|
this.heartbeatedSinceFailover = true;
|
||||||
rollBlocksScheduled(lastUpdate);
|
rollBlocksScheduled(getLastUpdate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -567,7 +567,7 @@ private static boolean checkInList(final DatanodeID node,
|
|||||||
/**
|
/**
|
||||||
* Decommission the node if it is in exclude list.
|
* Decommission the node if it is in exclude list.
|
||||||
*/
|
*/
|
||||||
private void checkDecommissioning(DatanodeDescriptor nodeReg, String ipAddr) {
|
private void checkDecommissioning(DatanodeDescriptor nodeReg) {
|
||||||
// If the registered node is in exclude list, then decommission it
|
// If the registered node is in exclude list, then decommission it
|
||||||
if (inExcludedHostsList(nodeReg)) {
|
if (inExcludedHostsList(nodeReg)) {
|
||||||
startDecommission(nodeReg);
|
startDecommission(nodeReg);
|
||||||
@ -713,7 +713,7 @@ nodes with its data cleared (or user can just remove the StorageID
|
|||||||
|
|
||||||
// also treat the registration message as a heartbeat
|
// also treat the registration message as a heartbeat
|
||||||
heartbeatManager.register(nodeS);
|
heartbeatManager.register(nodeS);
|
||||||
checkDecommissioning(nodeS, dnAddress);
|
checkDecommissioning(nodeS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,7 +733,7 @@ nodes with its data cleared (or user can just remove the StorageID
|
|||||||
= new DatanodeDescriptor(nodeReg, NetworkTopology.DEFAULT_RACK);
|
= new DatanodeDescriptor(nodeReg, NetworkTopology.DEFAULT_RACK);
|
||||||
resolveNetworkLocation(nodeDescr);
|
resolveNetworkLocation(nodeDescr);
|
||||||
addDatanode(nodeDescr);
|
addDatanode(nodeDescr);
|
||||||
checkDecommissioning(nodeDescr, dnAddress);
|
checkDecommissioning(nodeDescr);
|
||||||
|
|
||||||
// also treat the registration message as a heartbeat
|
// also treat the registration message as a heartbeat
|
||||||
// no need to update its timestamp
|
// no need to update its timestamp
|
||||||
|
@ -82,9 +82,9 @@ public String getAddress() {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName()
|
return getClass().getSimpleName()
|
||||||
+ "(" + getIpAddr()
|
+ "(" + getIpAddr()
|
||||||
+ ", storageID=" + storageID
|
+ ", storageID=" + getStorageID()
|
||||||
+ ", infoPort=" + infoPort
|
+ ", infoPort=" + getInfoPort()
|
||||||
+ ", ipcPort=" + ipcPort
|
+ ", ipcPort=" + getIpcPort()
|
||||||
+ ", storageInfo=" + storageInfo
|
+ ", storageInfo=" + storageInfo
|
||||||
+ ")";
|
+ ")";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user