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