diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index 4e5e123471..e5a6cf73b6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -4128,6 +4128,7 @@ private void chooseExcessRedundancyStriped(BlockCollection bc, BitSet found = new BitSet(groupSize); //indices found BitSet duplicated = new BitSet(groupSize); //indices found more than once HashMap storage2index = new HashMap<>(); + boolean logEmptyExcessType = true; for (DatanodeStorageInfo storage : nonExcess) { int index = sblk.getStorageBlockIndex(storage); assert index >= 0; @@ -4145,6 +4146,7 @@ private void chooseExcessRedundancyStriped(BlockCollection bc, Integer index = storage2index.get(delStorageHint); if (index != null && duplicated.get(index)) { processChosenExcessRedundancy(nonExcess, delStorageHint, storedBlock); + logEmptyExcessType = false; } } @@ -4155,8 +4157,10 @@ private void chooseExcessRedundancyStriped(BlockCollection bc, final List excessTypes = storagePolicy.chooseExcess( (short) numOfTarget, DatanodeStorageInfo.toStorageTypes(nonExcess)); if (excessTypes.isEmpty()) { - LOG.warn("excess types chosen for block {} among storages {} is empty", - storedBlock, nonExcess); + if(logEmptyExcessType) { + LOG.warn("excess types chosen for block {} among storages {} is empty", + storedBlock, nonExcess); + } return; }