Revert "HDFS-10620. StringBuilder created and appended even if logging is disabled. Contributed by Staffan Friberg."

This reverts commit 91f47ab5f9.
This commit is contained in:
Akira Ajisaka 2016-07-26 11:06:10 +09:00
parent 9ab153d7ae
commit e377e94f64
1 changed files with 3 additions and 6 deletions

View File

@ -1210,19 +1210,16 @@ public class BlockManager implements BlockStatsMXBean {
if (!isPopulatingReplQueues()) { if (!isPopulatingReplQueues()) {
return; return;
} }
StringBuilder datanodes = blockLog.isDebugEnabled() StringBuilder datanodes = new StringBuilder();
? 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);
if (datanodes != null) { datanodes.append(node).append(" ");
datanodes.append(node).append(" ");
}
} }
if (datanodes != null & datanodes.length() != 0) { if (datanodes.length() != 0) {
blockLog.debug("BLOCK* addToInvalidates: {} {}", b, datanodes); blockLog.debug("BLOCK* addToInvalidates: {} {}", b, datanodes);
} }
} }