diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index e2c278e981..8fc4fc7260 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -660,6 +660,8 @@ Release 2.6.0 - UNRELEASED HDFS-7169. Add SE_BAD_FIELD to findbugsExcludeFile.xml. (szetszwo) + HDFS-7217. Better batching of IBRs. (kihwal) + OPTIMIZATIONS HDFS-6690. Deduplicate xattr names in memory. (wang) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java index 25e89ff460..4a54bed404 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java @@ -236,7 +236,7 @@ void notifyNamenodeReceivedBlock( delHint); for (BPServiceActor actor : bpServices) { - actor.notifyNamenodeBlockImmediately(bInfo, storageUuid); + actor.notifyNamenodeBlock(bInfo, storageUuid, true); } } @@ -264,7 +264,7 @@ void notifyNamenodeReceivingBlock(ExtendedBlock block, String storageUuid) { block.getLocalBlock(), BlockStatus.RECEIVING_BLOCK, null); for (BPServiceActor actor : bpServices) { - actor.notifyNamenodeBlockImmediately(bInfo, storageUuid); + actor.notifyNamenodeBlock(bInfo, storageUuid, false); } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java index 7d3068879b..2961698625 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java @@ -368,13 +368,17 @@ void addPendingReplicationBlockInfo(ReceivedDeletedBlockInfo bInfo, * till namenode is informed before responding with success to the * client? For now we don't. */ - void notifyNamenodeBlockImmediately( - ReceivedDeletedBlockInfo bInfo, String storageUuid) { + void notifyNamenodeBlock(ReceivedDeletedBlockInfo bInfo, + String storageUuid, boolean now) { synchronized (pendingIncrementalBRperStorage) { addPendingReplicationBlockInfo( bInfo, dn.getFSDataset().getStorage(storageUuid)); sendImmediateIBR = true; - pendingIncrementalBRperStorage.notifyAll(); + // If now is true, the report is sent right away. + // Otherwise, it will be sent out in the next heartbeat. + if (now) { + pendingIncrementalBRperStorage.notifyAll(); + } } } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBlockReports.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBlockReports.java index 81dc13cc05..b5aa93f6e6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBlockReports.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBlockReports.java @@ -84,7 +84,7 @@ private static Block getDummyBlock() { private void injectBlockReceived() { ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo( getDummyBlock(), BlockStatus.RECEIVED_BLOCK, null); - actor.notifyNamenodeBlockImmediately(rdbi, storageUuid); + actor.notifyNamenodeBlock(rdbi, storageUuid, true); } /**