cxzl25 commented on code in PR #4139:
URL: https://github.com/apache/hadoop/pull/4139#discussion_r926235580
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:
##########
@@ -3410,6 +3410,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++) {
Review Comment:
Removed blockDeletionIncrement in HDFS-16554
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java:
##########
@@ -481,6 +481,10 @@ public class DFSConfigKeys extends CommonConfigurationKeys
{
"dfs.namenode.block.deletion.increment";
public static final int DFS_NAMENODE_BLOCK_DELETION_INCREMENT_DEFAULT = 1000;
+ /** Block deletion asynchronous. */
+ public static final String DFS_NAMENODE_BLOCK_DELETION_ASYNC_KEY =
"dfs.namenode.block.deletion.async";
+ public static final boolean DFS_NAMENODE_BLOCK_DELETION_ASYNC_DEFAULT =
false;
Review Comment:
Should it default to true?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]