LuciferYang opened a new pull request, #8924: URL: https://github.com/apache/hadoop/pull/8924
### Description of PR JIRA: https://issues.apache.org/jira/browse/HDFS-18020 HDFS-13739 added `AddBlockFlag.NO_LOCAL_RACK` (mode 3), but `AddBlockFlagProto` only defines 1 and 2. `PBHelperClient#convertAddBlockFlags` maps flags with `AddBlockFlagProto.forNumber(flag.getMode())` and skips nulls, so the client drops `NO_LOCAL_RACK` and `BlockPlacementPolicyDefault` never sees it over RPC. `HdfsDataOutputStreamBuilder#noLocalRack()` has had no effect since 3.3.0. The HDFS-13739 test calls the in-process `NameNodeRpcServer`, which skips the protobuf conversion. This patch adds `NO_LOCAL_RACK = 3` to the enum. An older NameNode or Router keeps the unknown value in the unknown field set, which is what happens today when the flag is dropped. RBF uses the same converter on both hops. It also fixes the javadoc of `AddBlockFlag.NO_LOCAL_RACK`, which was copied from `NO_LOCAL_WRITE`. With this change, NameNodes start honoring `NO_LOCAL_RACK` for clients that already set it. ### How was this patch tested? Added `TestPBHelper#testConvertAddBlockFlags`: for every `AddBlockFlag`, `AddBlockFlagProto.forNumber(getMode())` must exist and have the same name, and `EnumSet.allOf(AddBlockFlag.class)` must survive a round trip. It fails without the proto change, and it fails again if a new `AddBlockFlag` is added without a proto value. ### For code changes: - [x] Does the title of this PR start with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')? - [ ] Object storage: Have the integration tests been executed and the endpoint declared according to the connector-specific documentation? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? ### AI Tooling - [x] The PR includes the phrase "Contains content generated by Claude Opus". - [x] My use of AI contributions follows the ASF legal policy https://www.apache.org/legal/generative-tooling.html Contains content generated by Claude Opus. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
