Chia-Ping Tsai created KAFKA-19068:
--------------------------------------

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


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

Reply via email to