jsancio commented on code in PR #12240:
URL: https://github.com/apache/kafka/pull/12240#discussion_r890548627


##########
metadata/src/main/java/org/apache/kafka/metadata/BrokerRegistration.java:
##########
@@ -152,13 +156,22 @@ public boolean fenced() {
         return fenced;
     }
 
-    public ApiMessageAndVersion toRecord() {
+    public boolean inControlledShutdown() {
+        return inControlledShutdown;
+    }
+
+    public ApiMessageAndVersion toRecord(MetadataVersion metadataVersion) {
         RegisterBrokerRecord registrationRecord = new RegisterBrokerRecord().
             setBrokerId(id).
             setRack(rack.orElse(null)).
             setBrokerEpoch(epoch).
             setIncarnationId(incarnationId).
             setFenced(fenced);
+
+        if (metadataVersion.isInControlledShutdownStateSupported()) {
+            registrationRecord.setInControlledShutdown(inControlledShutdown);
+        }

Review Comment:
   Yeah. This is a question I have had it the back of my mind for a while with 
respect to downgrades. 
[KIP-778](https://wiki.apache.org/confluence/pages/viewpage.action?pageId=188746840#KIP778:KRaftUpgrades-Downgrades)
 talks about generating and loading a new snapshot when the metadata.version is 
downgraded. The active controller is not allowed to load a snapshot so that 
means that the active controller will have to resign after generating a 
snapshot but before loading the new snapshot. cc @mumrah 
   
   In other words, I think you are correct. We need to be able to generate a 
snapshot to a previous metadata version.



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