HADOOP-14369. NetworkTopology calls expensive toString() when logging. Contributed by Inigo Goiri.
This commit is contained in:
parent
dc77255a7b
commit
dcc292d7de
@ -130,8 +130,8 @@ public void add(Node node) {
|
||||
"Not allow to add an inner node: "+NodeBase.getPath(node));
|
||||
}
|
||||
if ((depthOfAllLeaves != -1) && (depthOfAllLeaves != newDepth)) {
|
||||
LOG.error("Error: can't add leaf node " + NodeBase.getPath(node) +
|
||||
" at depth " + newDepth + " to topology:\n" + this.toString());
|
||||
LOG.error("Error: can't add leaf node {} at depth {} to topology:{}\n",
|
||||
NodeBase.getPath(node), newDepth, this);
|
||||
throw new InvalidTopologyException("Failed to add " + NodeBase.getPath(node) +
|
||||
": You cannot have a rack and a non-rack node at the same " +
|
||||
"level of the network topology.");
|
||||
@ -153,7 +153,7 @@ public void add(Node node) {
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG.debug("NetworkTopology became:\n{}", this.toString());
|
||||
LOG.debug("NetworkTopology became:\n{}", this);
|
||||
} finally {
|
||||
netlock.writeLock().unlock();
|
||||
}
|
||||
@ -226,7 +226,7 @@ public void remove(Node node) {
|
||||
numOfRacks--;
|
||||
}
|
||||
}
|
||||
LOG.debug("NetworkTopology became:\n{}", this.toString());
|
||||
LOG.debug("NetworkTopology became:\n{}", this);
|
||||
} finally {
|
||||
netlock.writeLock().unlock();
|
||||
}
|
||||
@ -525,7 +525,7 @@ protected Node chooseRandom(final String scope, String excludedScope,
|
||||
}
|
||||
if (numOfDatanodes == 0) {
|
||||
LOG.debug("Failed to find datanode (scope=\"{}\" excludedScope=\"{}\").",
|
||||
String.valueOf(scope), String.valueOf(excludedScope));
|
||||
scope, excludedScope);
|
||||
return null;
|
||||
}
|
||||
Node ret = null;
|
||||
@ -538,7 +538,7 @@ protected Node chooseRandom(final String scope, String excludedScope,
|
||||
}
|
||||
LOG.debug("Choosing random from {} available nodes on node {},"
|
||||
+ " scope={}, excludedScope={}, excludeNodes={}", availableNodes,
|
||||
innerNode.toString(), scope, excludedScope, excludedNodes);
|
||||
innerNode, scope, excludedScope, excludedNodes);
|
||||
if (availableNodes > 0) {
|
||||
do {
|
||||
int leaveIndex = r.nextInt(numOfDatanodes);
|
||||
|
Loading…
Reference in New Issue
Block a user