You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Nick Guo (Jira)" <ji...@apache.org> on 2025/04/01 14:27:00 UTC

[jira] [Commented] (KAFKA-19068) Eliminate the duplicate type check in creating ControlRecord

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

Nick Guo commented on KAFKA-19068:
----------------------------------

Hi [~chia7712] ,I would like to handle this.Thanks!

> Eliminate the duplicate type check in creating ControlRecord
> ------------------------------------------------------------
>
>                 Key: KAFKA-19068
>                 URL: https://issues.apache.org/jira/browse/KAFKA-19068
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Chia-Ping Tsai
>            Assignee: Chia-Ping Tsai
>            Priority: Minor
>
> `RecordsIterator#decodeControlRecord` [0] do the type check and then `ControlRecord` constructor [1] does that again ...
> we should add a static method to ControlRecord to create `ControlRecord` with type check, and then `ControlRecord` constructor should be changed to private to ensure all instance is created by the static method 
> [0] https://github.com/apache/kafka/blob/ccf2510fdda755b7a8e0900d3316fade46eb533a/raft/src/main/java/org/apache/kafka/raft/internals/RecordsIterator.java#L361
> [1] https://github.com/apache/kafka/blob/ccf2510fdda755b7a8e0900d3316fade46eb533a/raft/src/main/java/org/apache/kafka/raft/ControlRecord.java#L45



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