HADOOP-12173. NetworkTopology::add calls toString always. Contributed by Inigo Goiri
This commit is contained in:
parent
5fddc5177d
commit
e59f6fad6a
|
@ -396,14 +396,13 @@ public class NetworkTopology {
|
||||||
int newDepth = NodeBase.locationToDepth(node.getNetworkLocation()) + 1;
|
int newDepth = NodeBase.locationToDepth(node.getNetworkLocation()) + 1;
|
||||||
netlock.writeLock().lock();
|
netlock.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
String oldTopoStr = this.toString();
|
|
||||||
if( node instanceof InnerNode ) {
|
if( node instanceof InnerNode ) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Not allow to add an inner node: "+NodeBase.getPath(node));
|
"Not allow to add an inner node: "+NodeBase.getPath(node));
|
||||||
}
|
}
|
||||||
if ((depthOfAllLeaves != -1) && (depthOfAllLeaves != newDepth)) {
|
if ((depthOfAllLeaves != -1) && (depthOfAllLeaves != newDepth)) {
|
||||||
LOG.error("Error: can't add leaf node " + NodeBase.getPath(node) +
|
LOG.error("Error: can't add leaf node " + NodeBase.getPath(node) +
|
||||||
" at depth " + newDepth + " to topology:\n" + oldTopoStr);
|
" at depth " + newDepth + " to topology:\n" + this.toString());
|
||||||
throw new InvalidTopologyException("Failed to add " + NodeBase.getPath(node) +
|
throw new InvalidTopologyException("Failed to add " + NodeBase.getPath(node) +
|
||||||
": You cannot have a rack and a non-rack node at the same " +
|
": You cannot have a rack and a non-rack node at the same " +
|
||||||
"level of the network topology.");
|
"level of the network topology.");
|
||||||
|
|
Loading…
Reference in New Issue