You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/06/01 06:15:13 UTC

[GitHub] [kafka] dengziming commented on a diff in pull request #12084: KAFKA-13845: Add support for reading KRaft snapshots in kafka-dump-log

dengziming commented on code in PR #12084:
URL: https://github.com/apache/kafka/pull/12084#discussion_r886352097


##########
core/src/main/scala/kafka/tools/DumpLogSegments.scala:
##########
@@ -288,6 +294,12 @@ object DumpLogSegments {
                   case ControlRecordType.ABORT | ControlRecordType.COMMIT =>
                     val endTxnMarker = EndTransactionMarker.deserialize(record)
                     print(s" endTxnMarker: ${endTxnMarker.controlType} coordinatorEpoch: ${endTxnMarker.coordinatorEpoch}")
+                  case ControlRecordType.SNAPSHOT_HEADER =>
+                    val header = ControlRecordUtils.deserializedSnapshotHeaderRecord(record)
+                    print(s" SnapshotHeader ${SnapshotHeaderRecordJsonConverter.write(header, SnapshotHeaderRecord.HIGHEST_SUPPORTED_VERSION)}")
+                  case ControlRecordType.SNAPSHOT_FOOTER =>
+                    val footer = ControlRecordUtils.deserializedSnapshotFooterRecord(record)
+                    print(s" SnapshotFooter ${SnapshotFooterRecordJsonConverter.write(footer, SnapshotFooterRecord.HIGHEST_SUPPORTED_VERSION)}")

Review Comment:
   It's reasonable to use `footer.version()` here, but I don't think it's unnecessary to check the version, if it is greater than HIGHEST_SUPPORTED_VERSION, we may already fail when deserializing it here:
   ```
   https://github.com/apache/kafka/blob/4c9eeef5b2dff9a4f0977fbc5ac7eaaf930d0d0e/clients/src/main/java/org/apache/kafka/common/record/ControlRecordUtils.java#L58-L60
   ```



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org