|
@@ -189,7 +189,8 @@ public class MiniDFSCluster {
|
|
private boolean checkDataNodeHostConfig = false;
|
|
private boolean checkDataNodeHostConfig = false;
|
|
private Configuration[] dnConfOverlays;
|
|
private Configuration[] dnConfOverlays;
|
|
private boolean skipFsyncForTesting = true;
|
|
private boolean skipFsyncForTesting = true;
|
|
-
|
|
|
|
|
|
+ private boolean useConfiguredTopologyMappingClass = false;
|
|
|
|
+
|
|
public Builder(Configuration conf) {
|
|
public Builder(Configuration conf) {
|
|
this.conf = conf;
|
|
this.conf = conf;
|
|
this.storagesPerDatanode =
|
|
this.storagesPerDatanode =
|
|
@@ -433,7 +434,14 @@ public class MiniDFSCluster {
|
|
this.skipFsyncForTesting = val;
|
|
this.skipFsyncForTesting = val;
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ public Builder useConfiguredTopologyMappingClass(
|
|
|
|
+ boolean useConfiguredTopologyMappingClass) {
|
|
|
|
+ this.useConfiguredTopologyMappingClass =
|
|
|
|
+ useConfiguredTopologyMappingClass;
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Construct the actual MiniDFSCluster
|
|
* Construct the actual MiniDFSCluster
|
|
*/
|
|
*/
|
|
@@ -501,7 +509,8 @@ public class MiniDFSCluster {
|
|
builder.checkDataNodeAddrConfig,
|
|
builder.checkDataNodeAddrConfig,
|
|
builder.checkDataNodeHostConfig,
|
|
builder.checkDataNodeHostConfig,
|
|
builder.dnConfOverlays,
|
|
builder.dnConfOverlays,
|
|
- builder.skipFsyncForTesting);
|
|
|
|
|
|
+ builder.skipFsyncForTesting,
|
|
|
|
+ builder.useConfiguredTopologyMappingClass);
|
|
}
|
|
}
|
|
|
|
|
|
public class DataNodeProperties {
|
|
public class DataNodeProperties {
|
|
@@ -756,12 +765,13 @@ public class MiniDFSCluster {
|
|
operation, null, racks, hosts,
|
|
operation, null, racks, hosts,
|
|
null, simulatedCapacities, null, true, false,
|
|
null, simulatedCapacities, null, true, false,
|
|
MiniDFSNNTopology.simpleSingleNN(nameNodePort, 0),
|
|
MiniDFSNNTopology.simpleSingleNN(nameNodePort, 0),
|
|
- true, false, false, null, true);
|
|
|
|
|
|
+ true, false, false, null, true, false);
|
|
}
|
|
}
|
|
|
|
|
|
private void initMiniDFSCluster(
|
|
private void initMiniDFSCluster(
|
|
Configuration conf,
|
|
Configuration conf,
|
|
- int numDataNodes, StorageType[][] storageTypes, boolean format, boolean manageNameDfsDirs,
|
|
|
|
|
|
+ int numDataNodes, StorageType[][] storageTypes, boolean format,
|
|
|
|
+ boolean manageNameDfsDirs,
|
|
boolean manageNameDfsSharedDirs, boolean enableManagedDfsDirsRedundancy,
|
|
boolean manageNameDfsSharedDirs, boolean enableManagedDfsDirsRedundancy,
|
|
boolean manageDataDfsDirs, StartupOption startOpt,
|
|
boolean manageDataDfsDirs, StartupOption startOpt,
|
|
StartupOption dnStartOpt, String[] racks,
|
|
StartupOption dnStartOpt, String[] racks,
|
|
@@ -772,7 +782,8 @@ public class MiniDFSCluster {
|
|
boolean checkDataNodeAddrConfig,
|
|
boolean checkDataNodeAddrConfig,
|
|
boolean checkDataNodeHostConfig,
|
|
boolean checkDataNodeHostConfig,
|
|
Configuration[] dnConfOverlays,
|
|
Configuration[] dnConfOverlays,
|
|
- boolean skipFsyncForTesting)
|
|
|
|
|
|
+ boolean skipFsyncForTesting,
|
|
|
|
+ boolean useConfiguredTopologyMappingClass)
|
|
throws IOException {
|
|
throws IOException {
|
|
boolean success = false;
|
|
boolean success = false;
|
|
try {
|
|
try {
|
|
@@ -797,9 +808,11 @@ public class MiniDFSCluster {
|
|
DFS_NAMENODE_SAFEMODE_EXTENSION_TESTING_KEY, 0);
|
|
DFS_NAMENODE_SAFEMODE_EXTENSION_TESTING_KEY, 0);
|
|
conf.setInt(DFS_NAMENODE_SAFEMODE_EXTENSION_KEY, safemodeExtension);
|
|
conf.setInt(DFS_NAMENODE_SAFEMODE_EXTENSION_KEY, safemodeExtension);
|
|
conf.setInt(DFS_NAMENODE_DECOMMISSION_INTERVAL_KEY, 3); // 3 second
|
|
conf.setInt(DFS_NAMENODE_DECOMMISSION_INTERVAL_KEY, 3); // 3 second
|
|
- conf.setClass(NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
|
|
|
|
- StaticMapping.class, DNSToSwitchMapping.class);
|
|
|
|
-
|
|
|
|
|
|
+ if (!useConfiguredTopologyMappingClass) {
|
|
|
|
+ conf.setClass(NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
|
|
|
|
+ StaticMapping.class, DNSToSwitchMapping.class);
|
|
|
|
+ }
|
|
|
|
+
|
|
// In an HA cluster, in order for the StandbyNode to perform checkpoints,
|
|
// In an HA cluster, in order for the StandbyNode to perform checkpoints,
|
|
// it needs to know the HTTP port of the Active. So, if ephemeral ports
|
|
// it needs to know the HTTP port of the Active. So, if ephemeral ports
|
|
// are chosen, disable checkpoints for the test.
|
|
// are chosen, disable checkpoints for the test.
|