kevin-wu24 commented on code in PR #20707:
URL: https://github.com/apache/kafka/pull/20707#discussion_r2487900949


##########
metadata/src/main/java/org/apache/kafka/controller/QuorumController.java:
##########
@@ -1022,7 +1021,20 @@ public void 
handleLoadSnapshot(SnapshotReader<ApiMessageAndVersion> reader) {
                         Batch<ApiMessageAndVersion> batch = reader.next();
                         long offset = batch.lastOffset();
                         List<ApiMessageAndVersion> messages = batch.records();
-
+                        if (bootstrapMetadata == null) {
+                            if 
(reader.snapshotId().equals(Snapshots.BOOTSTRAP_SNAPSHOT_ID)) {

Review Comment:
   When we are reading in the `0-0.checkpoint`, the ONLY thing we should be 
doing if `!messages.isEmpty()` in this method is using `messages` to construct 
a `bootstrapMetadata` object. 0-0.checkpoint is special because its records are 
uncommitted, unlike all other checkpoints this method handles, and need to be 
written to the log when a leader is determined. 
   
   This changed because previously, `0-0.checkpoint` did not contain any 
metadata records, just KRaft control records potentially.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to