Skip to content

HDFS-17824. DataNode fails to start when dfs.datanode.directoryscan.t…#8309

Open
deepujain wants to merge 2 commits intoapache:trunkfrom
deepujain:HDFS-17824-directoryscan-threads-validation
Open

HDFS-17824. DataNode fails to start when dfs.datanode.directoryscan.t…#8309
deepujain wants to merge 2 commits intoapache:trunkfrom
deepujain:HDFS-17824-directoryscan-threads-validation

Conversation

@deepujain
Copy link

Summary

When dfs.datanode.directoryscan.threads is set to 0 or a negative value, the DataNode throws IllegalArgumentException from Executors.newFixedThreadPool(threads) during DirectoryScanner initialization and fails to start. This change validates the config and uses the default (1) when the value is non-positive, with a warning log, so the DataNode starts and the operator sees a clear message.

Change

  • DirectoryScanner: After reading dfs.datanode.directoryscan.threads, if the value is ≤ 0, log a warning (parameter name, invalid value, default) and set threads to DFS_DATANODE_DIRECTORYSCAN_THREADS_DEFAULT (1) before creating the thread pool. Matches the existing pattern used for reconcile.blocks.batch.size and reconcile.blocks.batch.interval in the same class.
  • TestDirectoryScanner: New test testInvalidDirectoryScanThreadsUsesDefault() — set directoryscan.threads to 0, build a minimal cluster, create and start DirectoryScanner; verifies no exception and scanner runs (HDFS-17824).

JIRA

Fixes HDFS-17824

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ patch 0m 16s #8309 does not apply to trunk. Rebase required? Wrong Branch? See https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute for help.
Subsystem Report/Notes
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8309/1/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

…hreads is 0 or negative.

Validate directoryscan.threads; if <= 0 log warning and use default (1)
so DataNode starts instead of throwing from newFixedThreadPool.
@deepujain deepujain force-pushed the HDFS-17824-directoryscan-threads-validation branch from 15fe655 to 032cd21 Compare March 8, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants