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

Tsz-wo Sze commented on HDDS-14673:
-----------------------------------

bq. ... found 76 occurrences (all generated from proto files).  ...

Although there are many proto enums, probably most of them are not passed as a 
parameter directly and requires a ScmCodec.  An example is 
SCMRatisProtocol.RequestType, which was changed to proto3 recently. (Thank you 
again!)  We do not have a proto3 enum codec and everything works.

bq. Protobuf-generated enums (e.g. HddsProtos.PipelineState) still implement 
ProtocolMessageEnum. ...

So, is there an easy way to find out which proto enums requiring a ScmCodec?  
Of course, we may use a trial-and-error approach to find it out.  For example, 
manually add HddsProtos.PipelineState to the factory and see if it can pass all 
the tests.  When a test fails, we discover another proto enum requiring a 
ScmCodec.  However, it may need to iterate the process many times.


> Check if ScmEnumCodec is needed.
> --------------------------------
>
>                 Key: HDDS-14673
>                 URL: https://issues.apache.org/jira/browse/HDDS-14673
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: SCM HA
>            Reporter: Tsz-wo Sze
>            Assignee: Chen-Jheng Sing
>            Priority: Major
>
> Since we don't need a similar codec for 
> org.apache.ratis.thirdparty.com.google.protobuf.ProtocolMessageEnum,
> I suspect that ScmEnumCodec is not used at all.  We should try removing it 
> from ScmCodecFactory.
> {code}
> +++ 
> b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/io/ScmCodecFactory.java
> @@ -40,7 +40,6 @@ public final class ScmCodecFactory {
>    static {
>      codecs.put(com.google.protobuf.Message.class, new 
> ScmNonShadedGeneratedMessageCodec());
>      codecs.put(Message.class, new ScmGeneratedMessageCodec());
> -    codecs.put(ProtocolMessageEnum.class, new ScmEnumCodec());
>      codecs.put(List.class, new ScmListCodec());
> {code}
> If it is not used, just remove the entire ScmEnumCodec class.  Otherwise, we 
> may discuss how to avoid reflection.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to