chia7712 commented on code in PR #9766: URL: https://github.com/apache/kafka/pull/9766#discussion_r1971065624
########## clients/src/main/java/org/apache/kafka/common/record/EndTransactionMarker.java: ########## @@ -95,32 +71,28 @@ public int hashCode() { private static void ensureTransactionMarkerControlType(ControlRecordType type) { if (type != ControlRecordType.COMMIT && type != ControlRecordType.ABORT) - throw new IllegalArgumentException("Invalid control record type for end transaction marker" + type); + throw new IllegalArgumentException("Invalid control record type for end transaction marker " + type); } public static EndTransactionMarker deserialize(Record record) { ControlRecordType type = ControlRecordType.parse(record.key()); return deserializeValue(type, record.value()); } + // Visible for testing static EndTransactionMarker deserializeValue(ControlRecordType type, ByteBuffer value) { ensureTransactionMarkerControlType(type); - if (value.remaining() < CURRENT_END_TXN_MARKER_VALUE_SIZE) - throw new InvalidRecordException("Invalid value size found for end transaction marker. Must have " + - "at least " + CURRENT_END_TXN_MARKER_VALUE_SIZE + " bytes, but found only " + value.remaining()); - - short version = value.getShort(0); - if (version < 0) Review Comment: Should we keep the version check to protect us from reading unknown version in the future? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org