Forráskód Böngészése

HDFS-7217. Better batching of IBRs. Contributed by Kihwal Lee.
(cherry picked from commit db71bb54bcc75b71c5841b25ceb03fb0218c6d4f)

Kihwal Lee 10 éve
szülő
commit
7056e50c21

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -303,6 +303,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)

+ 2 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java

@@ -237,7 +237,7 @@ class BPOfferService {
         delHint);
 
     for (BPServiceActor actor : bpServices) {
-      actor.notifyNamenodeBlockImmediately(bInfo, storageUuid);
+      actor.notifyNamenodeBlock(bInfo, storageUuid, true);
     }
   }
 
@@ -270,7 +270,7 @@ class BPOfferService {
        block.getLocalBlock(), BlockStatus.RECEIVING_BLOCK, null);
     
     for (BPServiceActor actor : bpServices) {
-      actor.notifyNamenodeBlockImmediately(bInfo, storageUuid);
+      actor.notifyNamenodeBlock(bInfo, storageUuid, false);
     }
   }
 

+ 7 - 3
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java

@@ -368,13 +368,17 @@ class BPServiceActor implements Runnable {
    * 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();
+      }
     }
   }
 

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestIncrementalBlockReports.java

@@ -84,7 +84,7 @@ public class TestIncrementalBlockReports {
   private void injectBlockReceived() {
     ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo(
         getDummyBlock(), BlockStatus.RECEIVED_BLOCK, null);
-    actor.notifyNamenodeBlockImmediately(rdbi, storageUuid);
+    actor.notifyNamenodeBlock(rdbi, storageUuid, true);
   }
 
   /**