You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "dengziming (Jira)" <ji...@apache.org> on 2021/02/18 15:34:00 UTC

[jira] [Created] (KAFKA-12338) The code of MetadataRecordSerde duplicate with MetadataParser

dengziming created KAFKA-12338:
----------------------------------

             Summary: The code of MetadataRecordSerde duplicate with MetadataParser
                 Key: KAFKA-12338
                 URL: https://issues.apache.org/jira/browse/KAFKA-12338
             Project: Kafka
          Issue Type: Improvement
            Reporter: dengziming
            Assignee: dengziming


For example: 

MetadataRecordSerde.recordSize

```

size += ByteUtils.sizeOfUnsignedVarint(data.message().apiKey());
 size += ByteUtils.sizeOfUnsignedVarint(data.version());
 size += data.message().size(serializationCache, data.version());

```

 

MetadataParser.size

```

long messageSize = message.size(cache, version);
long totalSize = messageSize +
 ByteUtils.sizeOfUnsignedVarint(message.apiKey()) +
 ByteUtils.sizeOfUnsignedVarint(version);

```

we can see that the logic is duplicated except that `MetadataRecordSerde` has an extra `DEFAULT_FRAME_VERSION`, if we want to change the serde format of metadata, we should modify 2 classes, this is unreasonable.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)