HDFS-9112. Improve error message for Haadmin when multiple name service IDs are configured. Contributed by Anu Engineer.
(cherry picked from commit 83e99d06d0
)
This commit is contained in:
parent
bc5ee80794
commit
aca014ea67
|
@ -617,6 +617,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HDFS-5795. RemoteBlockReader2#checkSuccess() shoud print error status.
|
HDFS-5795. RemoteBlockReader2#checkSuccess() shoud print error status.
|
||||||
(Xiao Chen via Yongjun Zhang)
|
(Xiao Chen via Yongjun Zhang)
|
||||||
|
|
||||||
|
HDFS-9112. Improve error message for Haadmin when multiple name service IDs
|
||||||
|
are configured. (Anu Engineer via jing9)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.hadoop.hdfs.tools;
|
package org.apache.hadoop.hdfs.tools;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
@ -34,6 +35,8 @@ import org.apache.hadoop.net.NetUtils;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMESERVICES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One of the NN NameNodes acting as the target of an administrative command
|
* One of the NN NameNodes acting as the target of an administrative command
|
||||||
* (e.g. failover).
|
* (e.g. failover).
|
||||||
|
@ -56,12 +59,19 @@ public class NNHAServiceTarget extends HAServiceTarget {
|
||||||
public NNHAServiceTarget(Configuration conf,
|
public NNHAServiceTarget(Configuration conf,
|
||||||
String nsId, String nnId) {
|
String nsId, String nnId) {
|
||||||
Preconditions.checkNotNull(nnId);
|
Preconditions.checkNotNull(nnId);
|
||||||
|
|
||||||
if (nsId == null) {
|
if (nsId == null) {
|
||||||
nsId = DFSUtil.getOnlyNameServiceIdOrNull(conf);
|
nsId = DFSUtil.getOnlyNameServiceIdOrNull(conf);
|
||||||
if (nsId == null) {
|
if (nsId == null) {
|
||||||
throw new IllegalArgumentException(
|
String errorString = "Unable to determine the name service ID.";
|
||||||
"Unable to determine the nameservice id.");
|
String[] dfsNames = conf.getStrings(DFS_NAMESERVICES);
|
||||||
|
if ((dfsNames != null) && (dfsNames.length > 1)) {
|
||||||
|
errorString = "Unable to determine the name service ID. " +
|
||||||
|
"This is an HA configuration with multiple name services " +
|
||||||
|
"configured. " + DFS_NAMESERVICES + " is set to " +
|
||||||
|
Arrays.toString(dfsNames) + ". Please re-run with the -ns option.";
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException(errorString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert nsId != null;
|
assert nsId != null;
|
||||||
|
|
Loading…
Reference in New Issue