-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Conversation
💔 -1 overall
This message was automatically generated. |
All test failures seem unrelated and I didn't add any new tests because the code seems to be covered by tests already. |
💔 -1 overall
This message was automatically generated. |
This has now been running in production since September without a problem. I'll update the branch. |
There was a problem hiding this 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<>(); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
I have updated the PR and merged latest changes from trunk |
Makes sense to me. Assuming this patch is tested in production, then this one should be good to go. |
@yakirgb as far as I know you have been running with this in production for months, now. Correct? |
Correct |
The test build failed but I believe it's unrelated. I can't really read/interpret the logs. |
+1 and merged based on the fact it's been tested in production. |
Thank you very much! |
Thank you! |
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 inNamenodeWebHdfsMethods
where it will only call theBlockPlacementPolicy
(which considers all these edge cases) in case theremoteAddr
(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: