[ https://issues.apache.org/jira/browse/HDFS-15934?focusedWorklogId=583573&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-583573 ]
ASF GitHub Bot logged work on HDFS-15934: ----------------------------------------- Author: ASF GitHub Bot Created on: 15/Apr/21 16:43 Start Date: 15/Apr/21 16:43 Worklog Time Spent: 10m Work Description: ayushtkn commented on a change in pull request #2833: URL: https://github.com/apache/hadoop/pull/2833#discussion_r614224919 ########## File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java ########## @@ -315,6 +316,40 @@ public DirectoryScanner(FsDatasetSpi<?> dataset, Configuration conf) { masterThread = new ScheduledThreadPoolExecutor(1, new Daemon.DaemonFactory()); + + int reconcileBatchSize = + conf.getInt(DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_SIZE, + DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_SIZE_DEFAULT); + + if (reconcileBatchSize < 0) { + LOG.warn( + "Invalid value configured for dfs.datanode.reconcile.blocks.batch.size, " + + "should be greater than 0, Using default."); + reconcileBatchSize = + DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_SIZE_DEFAULT; + } + + reconcileBlocksBatchSize = reconcileBatchSize; + + long reconcileBatchInterval = + conf.getLong(DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_INTERVAL, + DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_INTERVAL_DEFAULT); Review comment: This should use ``conf.getTimeDuration``, If you need some reference can check HDFS-15107, so as how to add support for time units. ########## File path: hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml ########## @@ -873,6 +873,22 @@ </description> </property> +<property> + <name>dfs.datanode.reconcile.blocks.batch.size</name> + <value>1000</value> + <description>HDFS-14476 to enable running reconcile to checkAndUpdate with batch, Review comment: No need for jira id in the description, and this doesn't enable/disable, it is just to specify the batch size. ########## File path: hadoop-hdfs-project/hadoop-hdfs/src/main/resources/hdfs-default.xml ########## @@ -873,6 +873,22 @@ </description> </property> +<property> + <name>dfs.datanode.reconcile.blocks.batch.size</name> + <value>1000</value> + <description>HDFS-14476 to enable running reconcile to checkAndUpdate with batch, + setting this to define batch size. + </description> +</property> + +<property> + <name>dfs.datanode.reconcile.blocks.batch.interval</name> + <value>2000</value> + <description>Setting this to define interval between + batches defined in dfs.datanode.reconcile.blocks.batch.size. + </description> Review comment: Some grammatical error, Please rectify ########## File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java ########## @@ -315,6 +316,40 @@ public DirectoryScanner(FsDatasetSpi<?> dataset, Configuration conf) { masterThread = new ScheduledThreadPoolExecutor(1, new Daemon.DaemonFactory()); + + int reconcileBatchSize = + conf.getInt(DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_SIZE, + DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_SIZE_DEFAULT); + + if (reconcileBatchSize < 0) { + LOG.warn( + "Invalid value configured for dfs.datanode.reconcile.blocks.batch.size, " + + "should be greater than 0, Using default."); + reconcileBatchSize = + DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_SIZE_DEFAULT; + } + + reconcileBlocksBatchSize = reconcileBatchSize; + + long reconcileBatchInterval = + conf.getLong(DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_INTERVAL, + DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_INTERVAL_DEFAULT); + + if (reconcileBatchInterval < 0) { + LOG.warn( + "Invalid value configured for dfs.datanode.reconcile.blocks.batch.interval, " + + "should be greater than 0, Using default."); + reconcileBatchInterval = + DFSConfigKeys. + DFS_DATANODE_RECONCILE_BLOCKS_BATCH_INTERVAL_DEFAULT; + } + + reconcileBlocksBatchInterval = reconcileBatchInterval; } Review comment: You need to format this code properly -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 583573) Time Spent: 1h 50m (was: 1h 40m) > Make DirectoryScanner reconcile blocks batch size and interval between batch > configurable. > ------------------------------------------------------------------------------------------ > > Key: HDFS-15934 > URL: https://issues.apache.org/jira/browse/HDFS-15934 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: Qi Zhu > Assignee: Qi Zhu > Priority: Major > Labels: pull-request-available > Time Spent: 1h 50m > Remaining Estimate: 0h > > HDFS-14476 Make this batch to avoid lock too much time, but different cluster > has different demand, we should make batch size and batch interval > configurable. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org