HDFS-10620. StringBuilder created and appended even if logging is disabled. Contributed by Staffan Friberg.
This commit is contained in:
parent
7ddef0fee4
commit
f7dabe3add
|
@ -1319,7 +1319,8 @@ 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(storedBlock)) {
|
for (DatanodeStorageInfo storage : blocksMap.getStorages(storedBlock)) {
|
||||||
if (storage.getState() != State.NORMAL) {
|
if (storage.getState() != State.NORMAL) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1328,10 +1329,12 @@ public class BlockManager implements BlockStatsMXBean {
|
||||||
final Block b = getBlockOnStorage(storedBlock, storage);
|
final Block b = getBlockOnStorage(storedBlock, storage);
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
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: {} {}", storedBlock, datanodes);
|
blockLog.debug("BLOCK* addToInvalidates: {} {}", storedBlock, datanodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue