tomscut commented on a change in pull request #3880:
URL: https://github.com/apache/hadoop/pull/3880#discussion_r784007211
##########
File path:
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestReplicationPolicy.java
##########
@@ -1018,6 +1018,69 @@ public void testChooseReplicaToDelete() throws Exception
{
assertEquals(chosen, storages[1]);
}
+ /**
+ * Test for the chooseReplicaToDelete are processed based on
+ * EC and STRIPED Policy.
+ */
+ @Test
+ public void testStripedChooseReplicaToDelete() throws Exception {
+ List<DatanodeStorageInfo> replicaList = new ArrayList<>();
+ List<DatanodeStorageInfo> candidate = new ArrayList<>();
+ final Map<String, List<DatanodeStorageInfo>> rackMap
+ = new HashMap<String, List<DatanodeStorageInfo>>();
+
+ replicaList.add(storages[0]);
+ replicaList.add(storages[1]);
+ replicaList.add(storages[2]);
+ replicaList.add(storages[4]);
+
+ candidate.add(storages[0]);
+ candidate.add(storages[2]);
+ candidate.add(storages[4]);
+
+ // Refresh the last update time for all the datanodes
+ for (int i = 0; i < dataNodes.length; i++) {
+ DFSTestUtil.resetLastUpdatesWithOffset(dataNodes[i], 0);
+ }
+
+ List<DatanodeStorageInfo> first = new ArrayList<>();
+ List<DatanodeStorageInfo> second = new ArrayList<>();
+ striptedPolicy.splitNodesWithRack(replicaList, candidate, rackMap, first,
+ second);
+ // storages[0] and storages[1] are in first set as their rack has two
Review comment:
Good catch. The whole thing looks good to me. We should modify several
comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]