[ 
https://issues.apache.org/jira/browse/HDDS-14647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz-wo Sze updated HDDS-14647:
------------------------------
    Description: 
The SCM Codec interface and the subclass implements are for 
serialize/deserialize Java objects to/from protobuf ByteString. The current 
implementation is inefficient since the Codec interface it not type specific 
and the implementations use Java reflection to handle the objects. In other 
words,
 - the static object type is available in the beginning
 - but, since the parameter is declared by Object, the type is forgotten,
 - then the Codec implementations use reflection to find out the type in 
runtime.

A better way to use generic type in the Codec interface and a Codec 
implementation only has to handle a specific class. This idea is similar to 
org.apache.hadoop.hdds.utils.db.Codec<T>.

BTW, we should rename classes in org.apache.hadoop.hdds.scm.ha.io.* to avoid 
confusion with the classes in org.apache.hadoop.hdds.utils.db.*.

  was:
The SCM Codec interface and the subclass implements are for 
serialize/deserialize Java objects to/from protobuf ByteString.  The current 
implementation is inefficient since the Codec interface it not type specific 
and the implementations use Java reflection to handle the objects.  In other 
words,
- the static object type is available in the beginning
- but, since the parameter is Object, the type is forgotten,
- then the Codec implementations use reflection to find out the type in runtime.

A better way to use generic type in the Codec interface and a Codec 
implementation only has to handle a specific class.  This idea is similar to  
org.apache.hadoop.hdds.utils.db.Codec<T>.

BTW, we should rename classes in org.apache.hadoop.hdds.scm.ha.io.* to avoid 
confusion with the classes in org.apache.hadoop.hdds.utils.db.*.


> Umbrella: Improve SCM codec
> ---------------------------
>
>                 Key: HDDS-14647
>                 URL: https://issues.apache.org/jira/browse/HDDS-14647
>             Project: Apache Ozone
>          Issue Type: Improvement
>          Components: SCM, SCM HA
>            Reporter: Tsz-wo Sze
>            Priority: Major
>
> The SCM Codec interface and the subclass implements are for 
> serialize/deserialize Java objects to/from protobuf ByteString. The current 
> implementation is inefficient since the Codec interface it not type specific 
> and the implementations use Java reflection to handle the objects. In other 
> words,
>  - the static object type is available in the beginning
>  - but, since the parameter is declared by Object, the type is forgotten,
>  - then the Codec implementations use reflection to find out the type in 
> runtime.
> A better way to use generic type in the Codec interface and a Codec 
> implementation only has to handle a specific class. This idea is similar to 
> org.apache.hadoop.hdds.utils.db.Codec<T>.
> BTW, we should rename classes in org.apache.hadoop.hdds.scm.ha.io.* to avoid 
> confusion with the classes in org.apache.hadoop.hdds.utils.db.*.



--
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