HDFS-13959. TestUpgradeDomainBlockPlacementPolicy is flaky. Contributed by Ayush Saxena.

(cherry picked from commit 1851d06eb3)
This commit is contained in:
Kihwal Lee 2019-09-18 16:45:29 -05:00
parent 6af1ecc8e4
commit 2661c32c06
1 changed files with 13 additions and 9 deletions

View File

@ -65,14 +65,8 @@ public class TestUpgradeDomainBlockPlacementPolicy {
private static final int DEFAULT_BLOCK_SIZE = 1024; private static final int DEFAULT_BLOCK_SIZE = 1024;
static final String[] racks = static final String[] racks =
{ "/RACK1", "/RACK1", "/RACK1", "/RACK2", "/RACK2", "/RACK2" }; { "/RACK1", "/RACK1", "/RACK1", "/RACK2", "/RACK2", "/RACK2" };
/**
* Use host names that can be resolved (
* InetSocketAddress#isUnresolved == false). Otherwise,
* CombinedHostFileManager won't allow those hosts.
*/
static final String[] hosts = static final String[] hosts =
{"127.0.0.1", "127.0.0.1", "127.0.0.1", "127.0.0.1", {"host1", "host2", "host3", "host4", "host5", "host6"};
"127.0.0.1", "127.0.0.1"};
static final String[] upgradeDomains = static final String[] upgradeDomains =
{"ud5", "ud2", "ud3", "ud1", "ud2", "ud4"}; {"ud5", "ud2", "ud3", "ud1", "ud2", "ud4"};
static final Set<DatanodeID> expectedDatanodeIDs = new HashSet<>(); static final Set<DatanodeID> expectedDatanodeIDs = new HashSet<>();
@ -134,7 +128,12 @@ public class TestUpgradeDomainBlockPlacementPolicy {
for (int i = 0; i < hosts.length; i++) { for (int i = 0; i < hosts.length; i++) {
datanodes[i] = new DatanodeAdminProperties(); datanodes[i] = new DatanodeAdminProperties();
DatanodeID datanodeID = cluster.getDataNodes().get(i).getDatanodeId(); DatanodeID datanodeID = cluster.getDataNodes().get(i).getDatanodeId();
datanodes[i].setHostName(datanodeID.getHostName()); /*
* Use host names that can be resolved (
* InetSocketAddress#isUnresolved == false). Otherwise,
* CombinedHostFileManager won't allow those hosts.
*/
datanodes[i].setHostName(datanodeID.getIpAddr());
datanodes[i].setPort(datanodeID.getXferPort()); datanodes[i].setPort(datanodeID.getXferPort());
datanodes[i].setUpgradeDomain(upgradeDomains[i]); datanodes[i].setUpgradeDomain(upgradeDomains[i]);
} }
@ -168,7 +167,12 @@ public class TestUpgradeDomainBlockPlacementPolicy {
for (int i = 0; i < hosts.length; i++) { for (int i = 0; i < hosts.length; i++) {
datanodes[i] = new DatanodeAdminProperties(); datanodes[i] = new DatanodeAdminProperties();
DatanodeID datanodeID = cluster.getDataNodes().get(i).getDatanodeId(); DatanodeID datanodeID = cluster.getDataNodes().get(i).getDatanodeId();
datanodes[i].setHostName(datanodeID.getHostName()); /*
* Use host names that can be resolved (
* InetSocketAddress#isUnresolved == false). Otherwise,
* CombinedHostFileManager won't allow those hosts.
*/
datanodes[i].setHostName(datanodeID.getIpAddr());
datanodes[i].setPort(datanodeID.getXferPort()); datanodes[i].setPort(datanodeID.getXferPort());
datanodes[i].setUpgradeDomain(upgradeDomains[i]); datanodes[i].setUpgradeDomain(upgradeDomains[i]);
} }