HDFS-2720. Fix MiniDFSCluster HA support to work properly on Windows. Contributed by Uma Maheswara Rao G.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1227284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cd81cc6664
commit
d004ddee76
@ -81,3 +81,5 @@ HDFS-2714. Fix test cases which use standalone FSNamesystems (todd)
|
|||||||
HDFS-2692. Fix bugs related to failover from/into safe mode. (todd)
|
HDFS-2692. Fix bugs related to failover from/into safe mode. (todd)
|
||||||
|
|
||||||
HDFS-2716. Configuration needs to allow different dfs.http.addresses for each HA NN (todd)
|
HDFS-2716. Configuration needs to allow different dfs.http.addresses for each HA NN (todd)
|
||||||
|
|
||||||
|
HDFS-2720. Fix MiniDFSCluster HA support to work properly on Windows. (Uma Maheswara Rao G via todd)
|
||||||
|
@ -601,10 +601,13 @@ private void createNameNodesAndSetConf(MiniDFSNNTopology nnTopology,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now start all the NNs in this nameservice.
|
// Now format first NN and copy the storage directory from that node to the others.
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
Collection<URI> prevNNDirs = null;
|
||||||
|
int nnCounterForFormat = nnCounter;
|
||||||
for (NNConf nn : nameservice.getNNs()) {
|
for (NNConf nn : nameservice.getNNs()) {
|
||||||
initNameNodeConf(conf, nsId, nn.getNnId(), manageNameDfsDirs, nnCounter);
|
initNameNodeConf(conf, nsId, nn.getNnId(), manageNameDfsDirs,
|
||||||
|
nnCounterForFormat);
|
||||||
|
|
||||||
boolean formatThisOne = format;
|
boolean formatThisOne = format;
|
||||||
if (format && i++ > 0) {
|
if (format && i++ > 0) {
|
||||||
@ -613,11 +616,21 @@ private void createNameNodesAndSetConf(MiniDFSNNTopology nnTopology,
|
|||||||
// block pool ID, etc. Instead, copy the name dirs
|
// block pool ID, etc. Instead, copy the name dirs
|
||||||
// from the first one.
|
// from the first one.
|
||||||
formatThisOne = false;
|
formatThisOne = false;
|
||||||
copyNameDirs(getConfiguration(nnCounter - 1), conf);
|
assert (null != prevNNDirs);
|
||||||
|
copyNameDirs(prevNNDirs, FSNamesystem.getNamespaceDirs(conf), conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
createNameNode(nnCounter++, conf, numDataNodes, formatThisOne,
|
nnCounterForFormat++;
|
||||||
operation, clusterId, nsId, nn.getNnId());
|
if (formatThisOne) {
|
||||||
|
NameNode.format(conf);
|
||||||
|
}
|
||||||
|
prevNNDirs = FSNamesystem.getNamespaceDirs(conf);
|
||||||
|
}
|
||||||
|
// Start all Namenodes
|
||||||
|
for (NNConf nn : nameservice.getNNs()) {
|
||||||
|
initNameNodeConf(conf, nsId, nn.getNnId(), manageNameDfsDirs, nnCounter);
|
||||||
|
createNameNode(nnCounter++, conf, numDataNodes, false, operation,
|
||||||
|
clusterId, nsId, nn.getNnId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -655,10 +668,8 @@ private void initNameNodeConf(Configuration conf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyNameDirs(Configuration srcConf, Configuration dstConf)
|
private void copyNameDirs(Collection<URI> srcDirs, Collection<URI> dstDirs,
|
||||||
throws IOException {
|
Configuration dstConf) throws IOException {
|
||||||
Collection<URI> srcDirs = FSNamesystem.getNamespaceDirs(srcConf);
|
|
||||||
Collection<URI> dstDirs = FSNamesystem.getNamespaceDirs(dstConf);
|
|
||||||
URI srcDir = Lists.newArrayList(srcDirs).get(0);
|
URI srcDir = Lists.newArrayList(srcDirs).get(0);
|
||||||
FileSystem dstFS = FileSystem.getLocal(dstConf).getRaw();
|
FileSystem dstFS = FileSystem.getLocal(dstConf).getRaw();
|
||||||
for (URI dstDir : dstDirs) {
|
for (URI dstDir : dstDirs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user