zeekling commented on code in PR #4139:
URL: https://github.com/apache/hadoop/pull/4139#discussion_r1639098795


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -3403,6 +3407,33 @@ FSPermissionChecker getPermissionChecker()
     return dir.getPermissionChecker();
   }
 
+  /**
+   * If blockDeletionAsync enables, blocks will be deleted asynchronously.

Review Comment:
   use dfs.namenode.block.deletion.async not blockDeletionAsync 



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -3403,6 +3407,33 @@ FSPermissionChecker getPermissionChecker()
     return dir.getPermissionChecker();
   }
 
+  /**
+   * If blockDeletionAsync enables, blocks will be deleted asynchronously.
+   * If not, incrementally remove the blocks from blockManager
+   * Writelock is dropped and reacquired every BLOCK_DELETION_INCREMENT to
+   * ensure that other waiters on the lock can get in. See HDFS-2938
+   *
+   * @param toDeleteList
+   *          a list of blocks that need to be removed from blocksMap
+   */
+  void removeBlocks(List<BlockInfo> toDeleteList) {
+    if (this.blockDeletionAsync) {
+      blockManager.addBLocksToMarkedDeleteQueue(toDeleteList);
+    } else {
+      Iterator<BlockInfo> iter = toDeleteList.iterator();
+      while (iter.hasNext()) {
+        writeLock();
+        try {
+          for (int i = 0; i < blockDeletionIncrement && iter.hasNext(); i++) {
+            blockManager.removeBlock(iter.next());

Review Comment:
   Compared with the previous one, the following code is missing: 
   ```java
   toRemoveBlocks.clear(); 
   ```
   
   
https://github.com/apache/hadoop/pull/3063/files#diff-dac9de4dd225110eff2f29a44000bf32705f02df2b3fcf17b5d89bc236c12f01



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to