diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java index 87911369c7b..871b4fde2f0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/DatanodeProtocolServerSideTranslatorPB.java @@ -52,6 +52,7 @@ import org.apache.hadoop.hdfs.protocol.proto.HdfsServerProtos.VersionResponsePro import org.apache.hadoop.hdfs.server.protocol.DatanodeCommand; import org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol; import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration; +import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage; import org.apache.hadoop.hdfs.server.protocol.HeartbeatResponse; import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo; import org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo; @@ -230,7 +231,8 @@ public class DatanodeProtocolServerSideTranslatorPB implements info[i] = new StorageReceivedDeletedBlocks( PBHelperClient.convert(sBlock.getStorage()), rdBlocks); } else { - info[i] = new StorageReceivedDeletedBlocks(sBlock.getStorageUuid(), rdBlocks); + info[i] = new StorageReceivedDeletedBlocks( + new DatanodeStorage(sBlock.getStorageUuid()), rdBlocks); } } try { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/StorageReceivedDeletedBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/StorageReceivedDeletedBlocks.java index 29216cf063a..12b03514ed1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/StorageReceivedDeletedBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/StorageReceivedDeletedBlocks.java @@ -28,6 +28,9 @@ public class StorageReceivedDeletedBlocks { final DatanodeStorage storage; private final ReceivedDeletedBlockInfo[] blocks; + /** + * @deprecated Use {@link #getStorage()} instead + */ @Deprecated public String getStorageID() { return storage.getStorageID(); @@ -41,6 +44,10 @@ public class StorageReceivedDeletedBlocks { return blocks; } + /** + * @deprecated Use {@link #StorageReceivedDeletedBlocks( + * DatanodeStorage, ReceivedDeletedBlockInfo[])} instead + */ @Deprecated public StorageReceivedDeletedBlocks(final String storageID, final ReceivedDeletedBlockInfo[] blocks) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingReplication.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingReplication.java index 0a4b2353639..afda6e87ae0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingReplication.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingReplication.java @@ -40,6 +40,7 @@ import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; import org.apache.hadoop.hdfs.server.namenode.INodeFile; import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter; import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration; +import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage; import org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo; import org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo.BlockStatus; import org.apache.hadoop.hdfs.server.protocol.StorageReceivedDeletedBlocks; @@ -311,8 +312,9 @@ public class TestPendingReplication { if (!datanodes.get(i).getDatanodeId().equals(existingDn)) { DatanodeRegistration dnR = datanodes.get(i).getDNRegistrationForBP( poolId); - StorageReceivedDeletedBlocks[] report = { - new StorageReceivedDeletedBlocks("Fake-storage-ID-Ignored", + StorageReceivedDeletedBlocks[] report = { + new StorageReceivedDeletedBlocks( + new DatanodeStorage("Fake-storage-ID-Ignored"), new ReceivedDeletedBlockInfo[] { new ReceivedDeletedBlockInfo( blocks[0], BlockStatus.RECEIVED_BLOCK, "") }) }; cluster.getNameNodeRpc().blockReceivedAndDeleted(dnR, poolId, report); @@ -329,10 +331,12 @@ public class TestPendingReplication { if (!datanodes.get(i).getDatanodeId().equals(existingDn)) { DatanodeRegistration dnR = datanodes.get(i).getDNRegistrationForBP( poolId); - StorageReceivedDeletedBlocks[] report = - { new StorageReceivedDeletedBlocks("Fake-storage-ID-Ignored", - new ReceivedDeletedBlockInfo[] { new ReceivedDeletedBlockInfo( - blocks[0], BlockStatus.RECEIVED_BLOCK, "") }) }; + StorageReceivedDeletedBlocks[] report = + { new StorageReceivedDeletedBlocks( + new DatanodeStorage("Fake-storage-ID-Ignored"), + new ReceivedDeletedBlockInfo[] { + new ReceivedDeletedBlockInfo( + blocks[0], BlockStatus.RECEIVED_BLOCK, "")}) }; cluster.getNameNodeRpc().blockReceivedAndDeleted(dnR, poolId, report); reportDnNum++; } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBrVariations.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBrVariations.java index e9d51e93e19..4b20c12b18e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBrVariations.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBrVariations.java @@ -42,6 +42,7 @@ import org.apache.hadoop.hdfs.server.datanode.fsdataset.FsVolumeSpi; import org.apache.hadoop.hdfs.server.namenode.FSNamesystem; import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.hdfs.server.protocol.*; +import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage; import org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo.BlockStatus; import org.apache.hadoop.test.GenericTestUtils; import org.apache.log4j.Level; @@ -172,7 +173,8 @@ public class TestIncrementalBrVariations { assertTrue(foundBlockOnStorage); reports[i] = - new StorageReceivedDeletedBlocks(volume.getStorageID(), rdbi); + new StorageReceivedDeletedBlocks( + new DatanodeStorage(volume.getStorageID()), rdbi); if (splitReports) { // If we are splitting reports then send the report for this storage now. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java index 73f2c8f0a27..a93ec39233b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java @@ -1037,7 +1037,7 @@ public class NNThroughputBenchmark implements Tool { blocks[i], ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null) }; StorageReceivedDeletedBlocks[] report = { new StorageReceivedDeletedBlocks( - targetStorageID, rdBlocks) }; + new DatanodeStorage(targetStorageID), rdBlocks) }; dataNodeProto.blockReceivedAndDeleted(receivedDNReg, bpid, report); } } @@ -1157,7 +1157,8 @@ public class NNThroughputBenchmark implements Tool { loc.getBlock().getLocalBlock(), ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null) }; StorageReceivedDeletedBlocks[] report = { new StorageReceivedDeletedBlocks( - datanodes[dnIdx].storage.getStorageID(), rdBlocks) }; + new DatanodeStorage(datanodes[dnIdx].storage.getStorageID()), + rdBlocks) }; dataNodeProto.blockReceivedAndDeleted(datanodes[dnIdx].dnRegistration, bpid, report); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java index ee625798093..9b6e87496a2 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestDeadDatanode.java @@ -102,7 +102,8 @@ public class TestDeadDatanode { ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK, null) }; StorageReceivedDeletedBlocks[] storageBlocks = { - new StorageReceivedDeletedBlocks(reg.getDatanodeUuid(), blocks) }; + new StorageReceivedDeletedBlocks( + new DatanodeStorage(reg.getDatanodeUuid()), blocks) }; // Ensure blockReceived call from dead datanode is not rejected with // IOException, since it's async, but the node remains unregistered.