Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDFS-17752. Host2DatanodeMap will not update when re-register a node … #7468

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,11 @@
return host2DatanodeMap.getDatanodeByHost(host);
}

/** @return the datanode descriptor for the host. */
public DatanodeDescriptor getDatanodeByHostName(final String hostname) {

Check failure on line 707 in hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java

View check run for this annotation

ASF Cloudbees Jenkins ci-hadoop / Apache Yetus

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java#L707

javadoc: warning: no @param for hostname
return host2DatanodeMap.getDataNodeByHostName(hostname);
}

/** @return the datanode descriptor for the host. */
public DatanodeDescriptor getDatanodeByXferAddr(String host, int xferPort) {
return host2DatanodeMap.getDatanodeByXferAddr(host, xferPort);
Expand Down Expand Up @@ -1236,6 +1241,10 @@
+ " is replaced by " + nodeReg + " with the same storageID "
+ nodeReg.getDatanodeUuid());
}

if (!updateHost2DatanodeMap) {
updateHost2DatanodeMap = !nodeS.getHostName().equals(nodeReg.getHostName());
}

boolean success = false;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ public void testHost2NodeMapCorrectAfterReregister()

assertNull("should be no node with old ip", dm.getDatanodeByHost(ipOld));
assertNotNull("should be a node with new ip", dm.getDatanodeByHost(ipNew));

storageID = "someStorageID2";
String hostnameOld = "someHostNameOld" + storageID;
String hostnameNew = "someHostNameNew" + storageID;

dm.registerDatanode(new DatanodeRegistration(
new DatanodeID("ip", hostnameOld, storageID, 9000, 0, 0, 0),
null, null, "version"));

dm.registerDatanode(new DatanodeRegistration(
new DatanodeID("ip", hostnameNew, storageID, 9000, 0, 0, 0),
null, null, "version"));

assertNull("should be no node with old hostname", dm.getDatanodeByHostName(hostnameOld));
assertNotNull("should be a node with new hostname", dm.getDatanodeByHostName(hostnameNew));
}

/**
Expand Down