You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jg...@apache.org on 2022/08/25 16:18:06 UTC
[kafka] branch trunk updated: MINOR: Dump log tool should support bootstrap checkpoint (#12556)
This is an automated email from the ASF dual-hosted git repository.
jgus pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 289ab1494d0 MINOR: Dump log tool should support bootstrap checkpoint (#12556)
289ab1494d0 is described below
commit 289ab1494d00d4267f7a6d82f3d11884c6f47302
Author: Jason Gustafson <ja...@confluent.io>
AuthorDate: Thu Aug 25 09:17:55 2022 -0700
MINOR: Dump log tool should support bootstrap checkpoint (#12556)
This patch adds support to `kafka-dump-log.sh` to print the `bootstrap.checkpoint` file from KIP-778: https://cwiki.apache.org/confluence/display/KAFKA/KIP-778:+KRaft+Upgrades.
Reviewers: dengziming <de...@gmail.com>, Luke Chen <sh...@gmail.com>
---
core/src/main/scala/kafka/tools/DumpLogSegments.scala | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/core/src/main/scala/kafka/tools/DumpLogSegments.scala b/core/src/main/scala/kafka/tools/DumpLogSegments.scala
index b57342ff29b..e4d31baf1b6 100755
--- a/core/src/main/scala/kafka/tools/DumpLogSegments.scala
+++ b/core/src/main/scala/kafka/tools/DumpLogSegments.scala
@@ -30,6 +30,7 @@ import org.apache.kafka.common.metadata.{MetadataJsonConverters, MetadataRecordT
import org.apache.kafka.common.protocol.ByteBufferAccessor
import org.apache.kafka.common.record._
import org.apache.kafka.common.utils.Utils
+import org.apache.kafka.controller.BootstrapMetadata
import org.apache.kafka.metadata.MetadataRecordSerde
import org.apache.kafka.snapshot.Snapshots
@@ -253,8 +254,12 @@ object DumpLogSegments {
val startOffset = file.getName.split("\\.")(0).toLong
println(s"Log starting offset: $startOffset")
} else if (file.getName.endsWith(Snapshots.SUFFIX)) {
- val path = Snapshots.parse(file.toPath).get()
- println(s"Snapshot end offset: ${path.snapshotId.offset}, epoch: ${path.snapshotId.epoch}")
+ if (file.getName == BootstrapMetadata.BOOTSTRAP_FILE) {
+ println("KRaft bootstrap snapshot")
+ } else {
+ val path = Snapshots.parse(file.toPath).get()
+ println(s"Snapshot end offset: ${path.snapshotId.offset}, epoch: ${path.snapshotId.epoch}")
+ }
}
val fileRecords = FileRecords.open(file, false).slice(0, maxBytes)
try {