|
18 | 18 | package org.apache.hadoop.hdfs.server.balancer;
|
19 | 19 |
|
20 | 20 | import static org.apache.hadoop.fs.CommonConfigurationKeys.IPC_CLIENT_CONNECT_MAX_RETRIES_ON_SASL_KEY;
|
| 21 | +import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.NET_TOPOLOGY_IMPL_KEY; |
21 | 22 | import static org.apache.hadoop.fs.StorageType.DEFAULT;
|
22 | 23 | import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_CLIENT_HTTPS_KEYSTORE_RESOURCE_KEY;
|
23 | 24 | import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_SERVER_HTTPS_KEYSTORE_RESOURCE_KEY;
|
|
40 | 41 |
|
41 | 42 | import java.lang.reflect.Field;
|
42 | 43 | import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy;
|
| 44 | +import org.apache.hadoop.hdfs.server.blockmanagement.BlockPlacementPolicyWithNodeGroup; |
| 45 | +import org.apache.hadoop.net.NetworkTopologyWithNodeGroup; |
43 | 46 | import org.junit.AfterClass;
|
44 | 47 |
|
45 | 48 | import static org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset.CONFIG_PROPERTY_NONDFSUSED;
|
@@ -1645,6 +1648,22 @@ public void testBalancerCliWithIncludeListWithPortsInAFile() throws Exception {
|
1645 | 1648 | CAPACITY, RACK2, new PortNumberBasedNodes(3, 0, 1), true, true);
|
1646 | 1649 | }
|
1647 | 1650 |
|
| 1651 | + /** |
| 1652 | + * Test a cluster with BlockPlacementPolicyWithNodeGroup |
| 1653 | + */ |
| 1654 | + @Test(timeout=100000) |
| 1655 | + public void testBalancerCliWithBlockPlacementPolicyWithNodeGroup() throws Exception { |
| 1656 | + Configuration conf = new HdfsConfiguration(); |
| 1657 | + initConf(conf); |
| 1658 | + conf.setBoolean(DFSConfigKeys.DFS_USE_DFS_NETWORK_TOPOLOGY_KEY, false); |
| 1659 | + conf.set(NET_TOPOLOGY_IMPL_KEY, NetworkTopologyWithNodeGroup.class.getName()); |
| 1660 | + conf.set(DFSConfigKeys.DFS_BLOCK_REPLICATOR_CLASSNAME_KEY, |
| 1661 | + BlockPlacementPolicyWithNodeGroup.class.getName()); |
| 1662 | + String rackWithNodeGroup = "/rack0/nodegroup0"; |
| 1663 | + doTest(conf, new long[] {CAPACITY}, new String[] {rackWithNodeGroup}, CAPACITY / 2, |
| 1664 | + rackWithNodeGroup, true); |
| 1665 | + } |
| 1666 | + |
1648 | 1667 | /**
|
1649 | 1668 | * Check that the balancer exits when there is an unfinalized upgrade.
|
1650 | 1669 | */
|
|
0 commit comments