HDFS-9354. Fix TestBalancer#testBalancerWithZeroThreadsForMove on Windows. Contributed by Xiaoyu Yao.
(cherry picked from commit 095ac83402
)
Conflicts:
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java
This commit is contained in:
parent
3190446df9
commit
9d11d2a8f2
|
@ -1376,6 +1376,9 @@ Release 2.8.0 - UNRELEASED
|
|||
HDFS-9313. Possible NullPointerException in BlockManager if no excess
|
||||
replica can be chosen. (mingma)
|
||||
|
||||
HDFS-9354. Fix TestBalancer#testBalancerWithZeroThreadsForMove on Windows.
|
||||
(Xiaoyu Yao via cnauroth)
|
||||
|
||||
Release 2.7.2 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -84,6 +84,7 @@ import org.apache.hadoop.test.GenericTestUtils;
|
|||
import org.apache.hadoop.util.Time;
|
||||
import org.apache.hadoop.util.Tool;
|
||||
import org.apache.log4j.Level;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
|
@ -104,6 +105,14 @@ public class TestBalancer {
|
|||
final static Path filePath = new Path(fileName);
|
||||
private MiniDFSCluster cluster;
|
||||
|
||||
@After
|
||||
public void shutdown() throws Exception {
|
||||
if (cluster != null) {
|
||||
cluster.shutdown();
|
||||
cluster = null;
|
||||
}
|
||||
}
|
||||
|
||||
ClientProtocol client;
|
||||
|
||||
static final long TIMEOUT = 40000L; //msec
|
||||
|
@ -348,7 +357,6 @@ public class TestBalancer {
|
|||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(capacities.length)
|
||||
.hosts(hosts).racks(racks).simulatedCapacities(capacities).build();
|
||||
|
||||
try {
|
||||
cluster.waitActive();
|
||||
client = NameNodeProxies.createProxy(conf,
|
||||
cluster.getFileSystem(0).getUri(), ClientProtocol.class).getProxy();
|
||||
|
@ -381,11 +389,6 @@ public class TestBalancer {
|
|||
Collection<URI> namenodes = DFSUtil.getNsServiceRpcUris(conf);
|
||||
int r = Balancer.run(namenodes, BalancerParameters.DEFAULT, conf);
|
||||
assertEquals(ExitStatus.NO_MOVE_PROGRESS.getExitCode(), r);
|
||||
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -865,7 +868,6 @@ public class TestBalancer {
|
|||
.racks(racks)
|
||||
.simulatedCapacities(capacities)
|
||||
.build();
|
||||
try {
|
||||
cluster.waitActive();
|
||||
client = NameNodeProxies.createProxy(conf, cluster.getFileSystem(0).getUri(),
|
||||
ClientProtocol.class).getProxy();
|
||||
|
@ -887,9 +889,6 @@ public class TestBalancer {
|
|||
pBuilder.setRunDuringUpgrade(false);
|
||||
final int r = Balancer.run(namenodes, pBuilder.build(), conf);
|
||||
assertEquals(ExitStatus.SUCCESS.getExitCode(), r);
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1322,7 +1321,6 @@ public class TestBalancer {
|
|||
.storageTypes(new StorageType[] { RAM_DISK, DEFAULT })
|
||||
.build();
|
||||
|
||||
try {
|
||||
cluster.waitActive();
|
||||
// Create few files on RAM_DISK
|
||||
final String METHOD_NAME = GenericTestUtils.getMethodName();
|
||||
|
@ -1343,7 +1341,8 @@ public class TestBalancer {
|
|||
|
||||
// Add another fresh DN with the same type/capacity without files on RAM_DISK
|
||||
StorageType[][] storageTypes = new StorageType[][] {{RAM_DISK, DEFAULT}};
|
||||
long[][] storageCapacities = new long[][]{{ramDiskStorageLimit, diskStorageLimit}};
|
||||
long[][] storageCapacities = new long[][]{{ramDiskStorageLimit,
|
||||
diskStorageLimit}};
|
||||
cluster.startDataNodes(conf, REPL_FACT, storageTypes, true, null,
|
||||
null, null, storageCapacities, null, false, false, false, null);
|
||||
|
||||
|
@ -1360,9 +1359,6 @@ public class TestBalancer {
|
|||
// Verify files are still on RAM_DISK
|
||||
DFSTestUtil.verifyFileReplicasOnStorageType(fs, client, path1, RAM_DISK);
|
||||
DFSTestUtil.verifyFileReplicasOnStorageType(fs, client, path2, RAM_DISK);
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1386,8 +1382,6 @@ public class TestBalancer {
|
|||
.storageTypes(new StorageType[] { DEFAULT })
|
||||
.storagesPerDatanode(1)
|
||||
.build();
|
||||
|
||||
try {
|
||||
cluster.waitActive();
|
||||
// Create a file on the single DN
|
||||
final String METHOD_NAME = GenericTestUtils.getMethodName();
|
||||
|
@ -1427,10 +1421,6 @@ public class TestBalancer {
|
|||
// Should also work after finalization.
|
||||
assertEquals(ExitStatus.SUCCESS.getExitCode(),
|
||||
Balancer.run(namenodes, p, conf));
|
||||
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1452,7 +1442,7 @@ public class TestBalancer {
|
|||
conf.setLong(DFSConfigKeys.DFS_BALANCER_GETBLOCKS_MIN_BLOCK_SIZE_KEY, 1L);
|
||||
|
||||
int numOfDatanodes =2;
|
||||
final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
|
||||
cluster = new MiniDFSCluster.Builder(conf)
|
||||
.numDataNodes(2)
|
||||
.racks(new String[]{"/default/rack0", "/default/rack0"})
|
||||
.storagesPerDatanode(2)
|
||||
|
@ -1463,8 +1453,6 @@ public class TestBalancer {
|
|||
{100 * blockSize, 20 * blockSize},
|
||||
{20 * blockSize, 100 * blockSize}})
|
||||
.build();
|
||||
|
||||
try {
|
||||
cluster.waitActive();
|
||||
|
||||
//set "/bar" directory with ONE_SSD storage policy.
|
||||
|
@ -1492,10 +1480,6 @@ public class TestBalancer {
|
|||
// already has one. Otherwise DN1 will have 2 replicas.
|
||||
// For same reason, no replicas were moved.
|
||||
assertEquals(ExitStatus.NO_MOVE_PROGRESS.getExitCode(), r);
|
||||
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1526,7 +1510,6 @@ public class TestBalancer {
|
|||
int numOfDatanodes = capacities.length;
|
||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(capacities.length)
|
||||
.racks(racks).simulatedCapacities(capacities).build();
|
||||
try {
|
||||
cluster.waitActive();
|
||||
client = NameNodeProxies.createProxy(conf,
|
||||
cluster.getFileSystem(0).getUri(), ClientProtocol.class).getProxy();
|
||||
|
@ -1567,9 +1550,6 @@ public class TestBalancer {
|
|||
exitCode = tool.run(args); // start balancing
|
||||
assertEquals("Exit status code mismatches",
|
||||
ExitStatus.SUCCESS.getExitCode(), exitCode);
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/** Balancer should not move blocks with size < minBlockSize. */
|
||||
|
@ -1589,8 +1569,6 @@ public class TestBalancer {
|
|||
.simulatedCapacities(capacities)
|
||||
.build();
|
||||
final DistributedFileSystem dfs = cluster.getFileSystem();
|
||||
|
||||
try {
|
||||
cluster.waitActive();
|
||||
client = NameNodeProxies.createProxy(conf, dfs.getUri(),
|
||||
ClientProtocol.class).getProxy();
|
||||
|
@ -1680,9 +1658,6 @@ public class TestBalancer {
|
|||
final int r = Balancer.run(namenodes, p, conf);
|
||||
assertEquals(ExitStatus.SUCCESS.getExitCode(), r);
|
||||
}
|
||||
} finally {
|
||||
cluster.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue