AndrewJSchofield commented on code in PR #23965:
URL: https://github.com/apache/kafka/pull/23965#discussion_r4512051050


##########
server-common/src/main/java/org/apache/kafka/server/common/MetadataVersion.java:
##########
@@ -268,6 +268,22 @@ public short shareGroupStateRequestHeaderVersion() {
         return this.isAtLeast(MetadataVersion.IBP_4_5_IV0) ? (short) 3 : 
(short) 2;
     }
 
+    public short alterPartitionRequestHeaderVersion() {

Review Comment:
   Let's test all of these in `MetadataVersionTest`.



##########
server/src/main/java/org/apache/kafka/server/AssignmentsManager.java:
##########
@@ -353,14 +353,15 @@ void maybeSendAssignments() {
         log.info("maybeSendAssignments: sending {} assignments; invalidated {} 
assignments " +
             "prior to sending.", newInFlight.size(), numInvalid);
         if (!newInFlight.isEmpty()) {
-            sendAssignments(image.cluster().brokerEpoch(nodeId), newInFlight);
+            sendAssignments(image.cluster().brokerEpoch(nodeId), newInFlight,
+                
image.features().metadataVersionOrThrow().assignReplicasToDirsRequestHeaderVersion());

Review Comment:
   It would be better to fall back to MINIMUM_VERSION in the (impossible) event 
that there's no feature level set. Otherwise, this has the potential to drop a 
directory assignment, I think.



##########
metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java:
##########
@@ -3330,7 +3330,7 @@ public void 
testReassignPartitionsHandlesNewReassignmentThatRemovesPreviouslyAdd
                     setNewIsrWithEpochs(isrWithDefaultEpoch(0, 1, 2))))));
         ControllerResult<AlterPartitionResponseData> alterPartitionResult = 
replication.alterPartition(
             anonymousContextFor(ApiKeys.ALTER_PARTITION),
-            new 
AlterPartitionRequest.Builder(alterPartitionRequestData).build().data());
+            new AlterPartitionRequest.Builder(alterPartitionRequestData, 
(short) 3).build().data());

Review Comment:
   I wonder why we need `3` here when other tests use 
`requestHeaderVersion(...)`. This test and `RequestQuotaTest`, 
`ControllerApisTest` and `PartitionTest` could all use some kind of 
`requestHeaderVersion(...)` style instead.



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