Yang Jie created HDFS-18020:
-------------------------------

             Summary: AddBlockFlag.NO_LOCAL_RACK is dropped over RPC because 
AddBlockFlagProto has no value 3
                 Key: HDFS-18020
                 URL: https://issues.apache.org/jira/browse/HDFS-18020
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: hdfs-client
            Reporter: Yang Jie


HDFS-13739 added {{CreateFlag.NO_LOCAL_RACK}} and 
{{AddBlockFlag.NO_LOCAL_RACK}} (mode 3) together with the placement logic in 
BlockPlacementPolicyDefault, but {{AddBlockFlagProto}} in 
ClientNamenodeProtocol.proto only has NO_LOCAL_WRITE = 1 and 
IGNORE_CLIENT_LOCALITY = 2. PBHelperClient#convertAddBlockFlags maps each flag 
with {{AddBlockFlagProto.forNumber(flag.getMode())}} and skips nulls, so the 
client silently drops NO_LOCAL_RACK and the NameNode never sees it. 
{{HdfsDataOutputStreamBuilder#noLocalRack()}} has had no effect over RPC since 
it was added in 3.3.0. The HDFS-13739 test calls the in-process 
NameNodeRpcServer directly, which skips the protobuf conversion.

The fix adds {{NO_LOCAL_RACK = 3}} to the proto enum. An older NameNode or 
Router keeps the unknown value in the unknown field set, which behaves as 
today. Router-based federation uses the same converter on both hops, so it gets 
the fix too.

The test now checks that every AddBlockFlag has a proto value with the same 
number and name, so a future flag added without a proto value fails it. The 
change also corrects the javadoc of AddBlockFlag.NO_LOCAL_RACK, which was 
copied from NO_LOCAL_WRITE.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to