HADOOP-14369. NetworkTopology calls expensive toString() when logging. Contributed by Inigo Goiri.
(cherry picked from commitdcc292d7de
) (cherry picked from commit484bab3944
)
This commit is contained in:
parent
305a9d886a
commit
ab511286fd
|
@ -409,8 +409,8 @@ public class NetworkTopology {
|
||||||
"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 {} at depth {} to topology:{}\n",
|
||||||
" at depth " + newDepth + " to topology:\n" + this.toString());
|
NodeBase.getPath(node), newDepth, this);
|
||||||
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.");
|
||||||
|
@ -432,7 +432,7 @@ public class NetworkTopology {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.debug("NetworkTopology became:\n{}", this.toString());
|
LOG.debug("NetworkTopology became:\n{}", this);
|
||||||
} finally {
|
} finally {
|
||||||
netlock.writeLock().unlock();
|
netlock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ public class NetworkTopology {
|
||||||
numOfRacks--;
|
numOfRacks--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.debug("NetworkTopology became:\n{}", this.toString());
|
LOG.debug("NetworkTopology became:\n{}", this);
|
||||||
} finally {
|
} finally {
|
||||||
netlock.writeLock().unlock();
|
netlock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
@ -764,7 +764,7 @@ public class NetworkTopology {
|
||||||
}
|
}
|
||||||
if (numOfDatanodes == 0) {
|
if (numOfDatanodes == 0) {
|
||||||
LOG.debug("Failed to find datanode (scope=\"{}\" excludedScope=\"{}\").",
|
LOG.debug("Failed to find datanode (scope=\"{}\" excludedScope=\"{}\").",
|
||||||
String.valueOf(scope), String.valueOf(excludedScope));
|
scope, excludedScope);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Node ret = null;
|
Node ret = null;
|
||||||
|
@ -777,7 +777,7 @@ public class NetworkTopology {
|
||||||
}
|
}
|
||||||
LOG.debug("Choosing random from {} available nodes on node {},"
|
LOG.debug("Choosing random from {} available nodes on node {},"
|
||||||
+ " scope={}, excludedScope={}, excludeNodes={}", availableNodes,
|
+ " scope={}, excludedScope={}, excludeNodes={}", availableNodes,
|
||||||
innerNode.toString(), scope, excludedScope, excludedNodes);
|
innerNode, scope, excludedScope, excludedNodes);
|
||||||
if (availableNodes > 0) {
|
if (availableNodes > 0) {
|
||||||
do {
|
do {
|
||||||
int leaveIndex = r.nextInt(numOfDatanodes);
|
int leaveIndex = r.nextInt(numOfDatanodes);
|
||||||
|
|
Loading…
Reference in New Issue