Skip to content

HDFS-17181 WebHDFS: Route all CREATE requests to the BlockManager #6108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

lfrancke
Copy link
Member

Description of PR

https://issues.apache.org/jira/browse/HDFS-17181

When calling WebHDFS to create a file it will happily redirect to nodes that are in maintenance.

The reason is in the chooseDatanode method in NamenodeWebHdfsMethods where it will only call the BlockPlacementPolicy (which considers all these edge cases) in case the remoteAddr (i.e. the address making the request to WebHDFS) is also running a DataNode.
 
In all other cases it just refers to NetworkTopology#chooseRandom which does not consider any of these circumstances (e.g. load, maintenance).

I don't understand the reason to not just always refer to the placement policy so this PR fixes that

How was this patch tested?

We tested it in production and ran the unit tests (had some issues with those so let's see what the builds here say)

For code changes:

  • Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 40s 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 doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 42m 53s trunk passed
+1 💚 compile 1m 20s trunk passed with JDK Ubuntu-11.0.20+8-post-Ubuntu-1ubuntu120.04
+1 💚 compile 1m 13s trunk passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 checkstyle 1m 12s trunk passed
+1 💚 mvnsite 1m 23s trunk passed
+1 💚 javadoc 1m 8s trunk passed with JDK Ubuntu-11.0.20+8-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 36s trunk passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 spotbugs 3m 11s trunk passed
+1 💚 shadedclient 34m 43s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 1m 7s the patch passed
+1 💚 compile 1m 10s the patch passed with JDK Ubuntu-11.0.20+8-post-Ubuntu-1ubuntu120.04
+1 💚 javac 1m 10s the patch passed
+1 💚 compile 1m 3s the patch passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 javac 1m 3s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 59s hadoop-hdfs-project/hadoop-hdfs: The patch generated 0 new + 55 unchanged - 2 fixed = 55 total (was 57)
+1 💚 mvnsite 1m 12s the patch passed
+1 💚 javadoc 0m 52s the patch passed with JDK Ubuntu-11.0.20+8-post-Ubuntu-1ubuntu120.04
+1 💚 javadoc 1m 25s the patch passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 spotbugs 3m 5s the patch passed
+1 💚 shadedclient 34m 22s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 222m 34s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch passed.
+1 💚 asflicense 0m 53s The patch does not generate ASF License warnings.
359m 18s
Reason Tests
Failed junit tests hadoop.hdfs.server.sps.TestExternalStoragePolicySatisfier
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-6108/1/artifact/out/Dockerfile
GITHUB PR #6108
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux d3f81f0f4e3b 4.15.0-212-generic #223-Ubuntu SMP Tue May 23 13:09:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 20dda3b
Default Java Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.20+8-post-Ubuntu-1ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-6108/1/testReport/
Max. process+thread count 3325 (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-6108/1/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@lfrancke
Copy link
Member Author

All test failures seem unrelated and I didn't add any new tests because the code seems to be covered by tests already.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 27s 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 doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ trunk Compile Tests _
+1 💚 mvninstall 36m 21s trunk passed
+1 💚 compile 0m 51s trunk passed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu120.04
+1 💚 compile 0m 50s trunk passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 checkstyle 0m 48s trunk passed
+1 💚 mvnsite 0m 56s trunk passed
-1 ❌ javadoc 0m 54s /branch-javadoc-hadoop-hdfs-project_hadoop-hdfs-jdkUbuntu-11.0.20.1+1-post-Ubuntu-0ubuntu120.04.txt hadoop-hdfs in trunk failed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu120.04.
+1 💚 javadoc 1m 27s trunk passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 spotbugs 2m 14s trunk passed
+1 💚 shadedclient 28m 24s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 46s the patch passed
+1 💚 compile 0m 53s the patch passed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu120.04
+1 💚 javac 0m 53s the patch passed
+1 💚 compile 0m 46s the patch passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 javac 0m 46s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 40s hadoop-hdfs-project/hadoop-hdfs: The patch generated 0 new + 55 unchanged - 2 fixed = 55 total (was 57)
+1 💚 mvnsite 0m 51s the patch passed
-1 ❌ javadoc 0m 41s /patch-javadoc-hadoop-hdfs-project_hadoop-hdfs-jdkUbuntu-11.0.20.1+1-post-Ubuntu-0ubuntu120.04.txt hadoop-hdfs in the patch failed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu120.04.
+1 💚 javadoc 1m 14s the patch passed with JDK Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
+1 💚 spotbugs 2m 9s the patch passed
+1 💚 shadedclient 26m 31s patch has no errors when building and testing our client artifacts.
_ Other Tests _
-1 ❌ unit 193m 18s /patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt hadoop-hdfs in the patch passed.
+1 💚 asflicense 0m 36s The patch does not generate ASF License warnings.
303m 9s
Reason Tests
Failed junit tests hadoop.hdfs.TestDFSStripedOutputStream
hadoop.hdfs.TestFileChecksum
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hadoop.apache.org/job/hadoop-multibranch-windows-10/job/PR-6108/1/artifact/out/Dockerfile
GITHUB PR #6108
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 53d589382fcd 4.15.0-212-generic #223-Ubuntu SMP Tue May 23 13:09:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 20dda3b
Default Java Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu120.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_382-8u382-ga-1~20.04.1-b05
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch-windows-10/job/PR-6108/1/testReport/
Max. process+thread count 4231 (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-windows-10/job/PR-6108/1/console
versions git=2.25.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.14.0 https://yetus.apache.org

This message was automatically generated.

@lfrancke
Copy link
Member Author

lfrancke commented Feb 5, 2024

This has now been running in production since September without a problem.

I'll update the branch.

Copy link
Member Author

@lfrancke lfrancke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just commenting to make it easier for other reviewers

HashSet<Node> excludes = new HashSet<Node>();

Set<Node> excludes = new HashSet<>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just removes a warning

Node excludeNode = null;
if (idx != -1) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the code easier to read by just switching the != with the == condition. No other code changes

@@ -311,25 +315,15 @@ static DatanodeInfo chooseDatanode(final NameNode namenode,
}
}

if (op == PutOpParam.Op.CREATE) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual change. It used to treat CREATE special by calling the BlockManager.
This removes the special case and instead makes calling the BlockManager the norm for all requests except OPEN, APPEND and GETFILECHECKSUM for which it will pick an actual replica.

@@ -358,13 +364,13 @@ static DatanodeInfo chooseDatanode(final NameNode namenode,
* to return the first element of the node here.
*/
protected static DatanodeInfo bestNode(DatanodeInfo[] nodes,
HashSet<Node> excludes) throws IOException {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: Just removes warnings again and makes code clearer

@lfrancke
Copy link
Member Author

I have updated the PR and merged latest changes from trunk

@jojochuang
Copy link
Contributor

Makes sense to me. Assuming this patch is tested in production, then this one should be good to go.

@lfrancke
Copy link
Member Author

@yakirgb as far as I know you have been running with this in production for months, now. Correct?

@yakirgb
Copy link

yakirgb commented Feb 14, 2024

Correct

@lfrancke
Copy link
Member Author

The test build failed but I believe it's unrelated. I can't really read/interpret the logs.

@jojochuang jojochuang merged commit d1daf26 into apache:trunk Feb 20, 2024
@jojochuang
Copy link
Contributor

+1 and merged based on the fact it's been tested in production.

@jojochuang
Copy link
Contributor

Thanks @lfrancke and @yakirgb !

@lfrancke
Copy link
Member Author

Thank you very much!

@lfrancke lfrancke deleted the fix/HDFS-17181 branch February 20, 2024 19:03
@yakirgb
Copy link

yakirgb commented Feb 20, 2024

Thank you!

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.

4 participants