Addendum fix for HDFS-7749 to be compatible with HDFS-7993

This commit is contained in:
Zhe Zhang 2015-04-27 11:08:16 -07:00 committed by Zhe Zhang
parent 9f2f583f40
commit 9af1f4779b
1 changed files with 5 additions and 5 deletions

View File

@ -634,9 +634,9 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
report.append(" Live_repl=" + liveReplicas); report.append(" Live_repl=" + liveReplicas);
if (showLocations || showRacks || showReplicaDetails) { if (showLocations || showRacks || showReplicaDetails) {
StringBuilder sb = new StringBuilder("["); StringBuilder sb = new StringBuilder("[");
Iterable<DatanodeStorageInfo> storages = bm.getStorages(block.getLocalBlock()); DatanodeStorageInfo[] storages = bm.getStorages(storedBlock);
for (Iterator<DatanodeStorageInfo> iterator = storages.iterator(); iterator.hasNext();) { for (int i = 0; i < storages.length; i++) {
DatanodeStorageInfo storage = iterator.next(); DatanodeStorageInfo storage = storages[i];
DatanodeDescriptor dnDesc = storage.getDatanodeDescriptor(); DatanodeDescriptor dnDesc = storage.getDatanodeDescriptor();
if (showRacks) { if (showRacks) {
sb.append(NodeBase.getPath(dnDesc)); sb.append(NodeBase.getPath(dnDesc));
@ -645,7 +645,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
.getStorageType())); .getStorageType()));
} }
if (showReplicaDetails) { if (showReplicaDetails) {
LightWeightLinkedSet<Block> blocksExcess = LightWeightLinkedSet<BlockInfo> blocksExcess =
bm.excessReplicateMap.get(dnDesc.getDatanodeUuid()); bm.excessReplicateMap.get(dnDesc.getDatanodeUuid());
Collection<DatanodeDescriptor> corruptReplicas = Collection<DatanodeDescriptor> corruptReplicas =
bm.getCorruptReplicas(block.getLocalBlock()); bm.getCorruptReplicas(block.getLocalBlock());
@ -666,7 +666,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
sb.append("LIVE)"); sb.append("LIVE)");
} }
} }
if (iterator.hasNext()) { if (i < storages.length - 1) {
sb.append(", "); sb.append(", ");
} }
} }