HDFS-10620. StringBuilder created and appended even if logging is disabled. Contributed by Staffan Friberg.
This commit is contained in:
parent
19c5b3d622
commit
bd3c2a2ee9
|
@ -1303,16 +1303,19 @@ public class BlockManager implements BlockStatsMXBean {
|
||||||
if (!isPopulatingReplQueues()) {
|
if (!isPopulatingReplQueues()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StringBuilder datanodes = new StringBuilder();
|
StringBuilder datanodes = blockLog.isDebugEnabled()
|
||||||
|
? new StringBuilder() : null;
|
||||||
for (DatanodeStorageInfo storage : blocksMap.getStorages(b)) {
|
for (DatanodeStorageInfo storage : blocksMap.getStorages(b)) {
|
||||||
if (storage.getState() != State.NORMAL) {
|
if (storage.getState() != State.NORMAL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final DatanodeDescriptor node = storage.getDatanodeDescriptor();
|
final DatanodeDescriptor node = storage.getDatanodeDescriptor();
|
||||||
invalidateBlocks.add(b, node, false);
|
invalidateBlocks.add(b, node, false);
|
||||||
datanodes.append(node).append(" ");
|
if (datanodes != null) {
|
||||||
|
datanodes.append(node).append(" ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (datanodes.length() != 0) {
|
if (datanodes != null && datanodes.length() != 0) {
|
||||||
blockLog.debug("BLOCK* addToInvalidates: {} {}", b, datanodes);
|
blockLog.debug("BLOCK* addToInvalidates: {} {}", b, datanodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue