[ 
https://issues.apache.org/jira/browse/HDFS-12918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16288485#comment-16288485
 ] 

Xiao Chen commented on HDFS-12918:
----------------------------------

Thanks Zach for reporting this and Manoj for investigating.

As Manoj pointed out, I found this too while fixing HDFS-12682. Although it is 
a mistake there, it was not changed due to the fear of incompatible behavior, 
when discussing whether that should be set to 'DISABLED'. 

According to [protobuf 
doc|https://developers.google.com/protocol-buffers/docs/proto#optional]: {{If 
the default value is not specified for an optional element, a type-specific 
default value is used instead...For enums, the default value is the first value 
listed in the enum's type definition}}.

I think we check whether a state is set in the protobuf by 
{{proto.hasState()}}, so this wrong default shouldn't be visible downstream - 
so also echoing Manoj: where is this observed?

> EC Policy defaults incorrectly to enabled in protobufs
> ------------------------------------------------------
>
>                 Key: HDFS-12918
>                 URL: https://issues.apache.org/jira/browse/HDFS-12918
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Zach Amsden
>            Assignee: Manoj Govindassamy
>            Priority: Critical
>
> According to documentation and code comments, the default setting for erasure 
> coding policy is disabled:
> /** Policy is disabled. It's policy default state. */
>  DISABLED(1),
> However, HDFS-12258 appears to have incorrectly set the policy state in the 
> protobuf to enabled:
> {code:java}
>  message ErasureCodingPolicyProto {
>     ooptional string name = 1;
>     optional ECSchemaProto schema = 2;
>     optional uint32 cellSize = 3;
>     required uint32 id = 4; // Actually a byte - only 8 bits used
>  + optional ErasureCodingPolicyState state = 5 [default = ENABLED];
>   }
> {code}
> This means the parameter can't actually be optional, it must always be 
> included, and existing serialized data without this optional field will be 
> incorrectly interpreted as having erasure coding enabled.
> This unnecessarily breaks compatibility and will require existing HDFS 
> installations that store metadata in protobufs to require reformatting.
> It looks like a simple mistake that was overlooked in code review.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to