Skip to content

HDFS-16842. DatanodeHttpServer does not update config after refreshNamenodes#8291

Open
balodesecurity wants to merge 8 commits intoapache:trunkfrom
balodesecurity:HDFS-16842
Open

HDFS-16842. DatanodeHttpServer does not update config after refreshNamenodes#8291
balodesecurity wants to merge 8 commits intoapache:trunkfrom
balodesecurity:HDFS-16842

Conversation

@balodesecurity
Copy link

@balodesecurity balodesecurity commented Mar 2, 2026

Problem

When DataNode.refreshNamenodes() is called to add a new nameservice it reloads configuration via setConf(new Configuration()), but DatanodeHttpServer kept holding a stale reference to the old Configuration. Subsequent WebHDFS requests for blocks on the newly-added nameservice would fail because the DFSClient created per-request could not resolve the namenode addresses for that nameservice from the stale config.

Root cause: DatanodeHttpServer.conf and confForCreate were final fields set once at construction time. DataNode.refreshNamenodes() never called any update method on httpServer.

Fix

  • Make conf and confForCreate in DatanodeHttpServer volatile (non-final) so Netty I/O threads see updates atomically.
  • Add DatanodeHttpServer.updateConf(Configuration newConf) that refreshes both fields and the embedded Jetty infoServer's servlet-context attributes (CONF_CONTEXT_ATTRIBUTE, CURRENT_CONF).
  • Call httpServer.updateConf(getConf()) at the end of DataNode.refreshNamenodes() after the new configuration has been loaded.

The Netty ChannelInitializer creates a fresh URLDispatcher per connection and reads DatanodeHttpServer.conf at that point, so new connections automatically pick up the updated configuration without requiring a pipeline or server restart.

Testing

  • Added TestDatanodeHttpServerUpdateConf.testUpdateConfRefreshesFields — a unit test (no cluster required) that:
    • Creates a DatanodeHttpServer with an initial configuration.
    • Calls updateConf(newConf).
    • Asserts (via reflection) that the conf and confForCreate instance fields now reference the updated configuration.
    • Asserts that the Jetty infoServer servlet-context attributes have been updated.
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Related

…menodes.

When DataNode.refreshNamenodes() is called to add a new nameservice it
reloads configuration via setConf(new Configuration()), but the
DatanodeHttpServer kept holding a stale reference to the old
Configuration. Subsequent WebHDFS requests for blocks on the newly
added nameservice would fail because the DFSClient created per-request
could not resolve the namenode addresses for that nameservice.

Fix: make the `conf` and `confForCreate` fields in DatanodeHttpServer
volatile (so Netty I/O threads see writes atomically) and expose a new
updateConf(Configuration) method that refreshes both fields plus the
embedded Jetty infoServer's servlet-context attributes. Call
httpServer.updateConf(getConf()) at the end of
DataNode.refreshNamenodes() after the new configuration has been loaded.

The Netty ChannelInitializer creates a fresh URLDispatcher per
connection; because it accesses the DatanodeHttpServer instance fields
at connection-time, new connections automatically pick up the updated
configuration with no pipeline restart required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ docker 0m 22s Docker failed to build run-specific yetus/hadoop:tp-9534}.
Subsystem Report/Notes
GITHUB PR #8291
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/1/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ docker 0m 13s Docker failed to build run-specific yetus/hadoop:tp-4134}.
Subsystem Report/Notes
GITHUB PR #8291
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/2/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ docker 0m 12s Docker failed to build run-specific yetus/hadoop:tp-9976}.
Subsystem Report/Notes
GITHUB PR #8291
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/3/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ docker 0m 13s Docker failed to build run-specific yetus/hadoop:tp-10157}.
Subsystem Report/Notes
GITHUB PR #8291
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/4/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ docker 0m 14s Docker failed to build run-specific yetus/hadoop:tp-25663}.
Subsystem Report/Notes
GITHUB PR #8291
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/5/console
versions git=2.34.1
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@balodesecurity
Copy link
Author

CI failed due to Jenkins Docker infrastructure issue (apt-get failure and yetus/hadoop image pull denied) — unrelated to the patch. Requesting retest.

/retest

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 1m 20s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 43m 15s trunk passed
+1 💚 compile 1m 42s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 1m 43s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 1m 52s trunk passed
+1 💚 mvnsite 1m 53s trunk passed
+1 💚 javadoc 1m 25s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 27s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 4m 11s trunk passed
+1 💚 shadedclient 32m 28s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 21s the patch passed
+1 💚 compile 1m 17s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 1m 17s the patch passed
+1 💚 compile 1m 18s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 1m 18s the patch passed
+1 💚 blanks 0m 1s The patch has no blanks issues.
+1 💚 checkstyle 1m 17s the patch passed
+1 💚 mvnsite 1m 25s the patch passed
+1 💚 javadoc 0m 57s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 0m 59s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 46s the patch passed
+1 💚 shadedclient 31m 54s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 273m 24s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch passed.
+1 💚 asflicense 0m 45s The patch does not generate ASF License warnings.
407m 53s
Reason Tests
Failed junit tests hadoop.hdfs.server.namenode.ha.TestStandbyCheckpoints
hadoop.hdfs.server.balancer.TestBalancerWithHANameNodes
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/6/artifact/out/Dockerfile
GITHUB PR #8291
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 3c619f2554ee 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / b47b0ea
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/6/testReport/
Max. process+thread count 3156 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/6/console
versions git=2.43.0 maven=3.9.11 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 9m 31s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 42m 49s trunk passed
+1 💚 compile 1m 40s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 1m 40s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 1m 45s trunk passed
+1 💚 mvnsite 1m 54s trunk passed
+1 💚 javadoc 1m 26s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 25s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 4m 13s trunk passed
+1 💚 shadedclient 31m 50s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 27s the patch passed
+1 💚 compile 1m 21s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 1m 21s the patch passed
+1 💚 compile 1m 21s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 1m 21s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 18s the patch passed
+1 💚 mvnsite 1m 28s the patch passed
+1 💚 javadoc 1m 3s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 5s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 4m 4s the patch passed
+1 💚 shadedclient 30m 56s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 218m 26s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch failed.
+1 💚 asflicense 0m 44s The patch does not generate ASF License warnings.
359m 18s
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/7/artifact/out/Dockerfile
GITHUB PR #8291
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux b5c73d6d9125 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / edbb45e
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/7/testReport/
Max. process+thread count 3489 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/7/console
versions git=2.43.0 maven=3.9.11 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 34s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 1s codespell was not available.
+0 🆗 detsecrets 0m 1s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 40m 55s trunk passed
+1 💚 compile 1m 46s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 compile 1m 44s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 checkstyle 1m 49s trunk passed
+1 💚 mvnsite 1m 59s trunk passed
+1 💚 javadoc 1m 28s trunk passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 32s trunk passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 4m 14s trunk passed
+1 💚 shadedclient 31m 23s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 21s the patch passed
+1 💚 compile 1m 16s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javac 1m 16s the patch passed
+1 💚 compile 1m 16s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 javac 1m 16s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 1m 16s the patch passed
+1 💚 mvnsite 1m 27s the patch passed
+1 💚 javadoc 0m 58s the patch passed with JDK Ubuntu-21.0.10+7-Ubuntu-124.04
+1 💚 javadoc 1m 2s the patch passed with JDK Ubuntu-17.0.18+8-Ubuntu-124.04.1
+1 💚 spotbugs 3m 49s the patch passed
+1 💚 shadedclient 30m 25s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 217m 57s hadoop-hdfs in the patch passed.
+1 💚 asflicense 0m 45s The patch does not generate ASF License warnings.
346m 49s
Subsystem Report/Notes
Docker ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/8/artifact/out/Dockerfile
GITHUB PR #8291
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux ec999d08dbdc 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 120c696
Default Java Ubuntu-17.0.18+8-Ubuntu-124.04.1
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.10+7-Ubuntu-124.04 /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.18+8-Ubuntu-124.04.1
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/8/testReport/
Max. process+thread count 3490 (vs. ulimit of 5500)
modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8291/8/console
versions git=2.43.0 maven=3.9.11 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

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.

3 participants