Skip to content

Commit 4e47eb6

Browse files
committed
Revert "HDFS-16540 Data locality is lost when DataNode pod restarts in kubernetes (#4170)"
Revert to add the '.' after HDFS-16540 so commit message format matches precedent This reverts commit bda0881.
1 parent bda0881 commit 4e47eb6

File tree

3 files changed

+1
-45
lines changed

3 files changed

+1
-45
lines changed

.BUILDING.txt.swp

-16 KB
Binary file not shown.

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,6 @@ public void registerDatanode(DatanodeRegistration nodeReg)
11711171
nodeN = null;
11721172
}
11731173

1174-
boolean updateHost2DatanodeMap = false;
11751174
if (nodeS != null) {
11761175
if (nodeN == nodeS) {
11771176
// The same datanode has been just restarted to serve the same data
@@ -1190,11 +1189,7 @@ public void registerDatanode(DatanodeRegistration nodeReg)
11901189
nodes with its data cleared (or user can just remove the StorageID
11911190
value in "VERSION" file under the data directory of the datanode,
11921191
but this is might not work if VERSION file format has changed
1193-
*/
1194-
// Check if nodeS's host information is same as nodeReg's, if not,
1195-
// it needs to update host2DatanodeMap accordringly.
1196-
updateHost2DatanodeMap = !nodeS.getXferAddr().equals(nodeReg.getXferAddr());
1197-
1192+
*/
11981193
NameNode.stateChangeLog.info("BLOCK* registerDatanode: " + nodeS
11991194
+ " is replaced by " + nodeReg + " with the same storageID "
12001195
+ nodeReg.getDatanodeUuid());
@@ -1204,11 +1199,6 @@ nodes with its data cleared (or user can just remove the StorageID
12041199
try {
12051200
// update cluster map
12061201
getNetworkTopology().remove(nodeS);
1207-
1208-
// Update Host2DatanodeMap
1209-
if (updateHost2DatanodeMap) {
1210-
getHost2DatanodeMap().remove(nodeS);
1211-
}
12121202
if(shouldCountVersion(nodeS)) {
12131203
decrementVersionCount(nodeS.getSoftwareVersion());
12141204
}
@@ -1227,11 +1217,6 @@ nodes with its data cleared (or user can just remove the StorageID
12271217
nodeS.setDependentHostNames(
12281218
getNetworkDependenciesWithDefault(nodeS));
12291219
}
1230-
1231-
if (updateHost2DatanodeMap) {
1232-
getHost2DatanodeMap().add(nodeS);
1233-
}
1234-
12351220
getNetworkTopology().add(nodeS);
12361221
resolveUpgradeDomain(nodeS);
12371222

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestDatanodeManager.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -138,35 +138,6 @@ public void testNumVersionsCorrectAfterReregister()
138138
mapToCheck.get("version1").intValue(), 1);
139139
}
140140

141-
/**
142-
* This test checks that if a node is re-registered with a different ip, its
143-
* host2DatanodeMap is correctly updated with the new ip.
144-
*/
145-
@Test
146-
public void testHost2NodeMapCorrectAfterReregister()
147-
throws IOException, InterruptedException {
148-
//Create the DatanodeManager which will be tested
149-
FSNamesystem fsn = Mockito.mock(FSNamesystem.class);
150-
Mockito.when(fsn.hasWriteLock()).thenReturn(true);
151-
Configuration conf = new Configuration();
152-
DatanodeManager dm = mockDatanodeManager(fsn, conf);
153-
154-
String storageID = "someStorageID1";
155-
String ipOld = "someIPOld" + storageID;
156-
String ipNew = "someIPNew" + storageID;
157-
158-
dm.registerDatanode(new DatanodeRegistration(
159-
new DatanodeID(ipOld, "", storageID, 9000, 0, 0, 0),
160-
null, null, "version"));
161-
162-
dm.registerDatanode(new DatanodeRegistration(
163-
new DatanodeID(ipNew, "", storageID, 9000, 0, 0, 0),
164-
null, null, "version"));
165-
166-
assertNull("should be no node with old ip", dm.getDatanodeByHost(ipOld));
167-
assertNotNull("should be a node with new ip", dm.getDatanodeByHost(ipNew));
168-
}
169-
170141
/**
171142
* This test sends a random sequence of node registrations and node removals
172143
* to the DatanodeManager (of nodes with different IDs and versions), and

0 commit comments

Comments
 (0)