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


##########
server/src/main/java/org/apache/kafka/server/share/dlq/ShareGroupDLQStateManager.java:
##########
@@ -1025,7 +1026,7 @@ static CoalesceResults 
coalesceProduceRequests(List<ProduceRequestHandler> handl
             .setTimeoutMs(ServerConfigs.REQUEST_TIMEOUT_MS_DEFAULT);
 
         return new CoalesceResults(
-            new ProduceRequest.Builder(ApiKeys.PRODUCE.latestVersion(), 
ApiKeys.PRODUCE.latestVersion(), data),
+            new ProduceRequest.Builder(ApiKeys.PRODUCE.oldestVersion(), 
ApiKeys.PRODUCE.latestVersionForRequestHeader(requestHeaderVersion), data),

Review Comment:
   I think `oldestVersion()` seems wrong. We want v13 unless a higher version 
is supported. Maybe that's `latestVersion(false)`.



##########
server/src/main/java/org/apache/kafka/server/share/dlq/ShareGroupDLQStateManager.java:
##########
@@ -1025,7 +1026,7 @@ static CoalesceResults 
coalesceProduceRequests(List<ProduceRequestHandler> handl
             .setTimeoutMs(ServerConfigs.REQUEST_TIMEOUT_MS_DEFAULT);
 
         return new CoalesceResults(
-            new ProduceRequest.Builder(ApiKeys.PRODUCE.latestVersion(), 
ApiKeys.PRODUCE.latestVersion(), data),
+            new ProduceRequest.Builder(ApiKeys.PRODUCE.oldestVersion(), 
ApiKeys.PRODUCE.latestVersionForRequestHeader(requestHeaderVersion), data),

Review Comment:
   We should have a test for this also so we know that request header v2 and v3 
both are able to build requests at a sensible version.



##########
clients/src/main/java/org/apache/kafka/common/requests/EnvelopeRequest.java:
##########
@@ -30,10 +30,19 @@ public static class Builder extends 
AbstractRequest.Builder<EnvelopeRequest> {
 
         private final EnvelopeRequestData data;
 
+        /**
+         * @param requestData          the embedded request header and data
+         * @param serializedPrincipal  the serialized principal of the 
original client
+         * @param clientAddress        the original client's address in bytes
+         * @param requestHeaderVersion the latest request header version which 
may be used
+         */
         public Builder(ByteBuffer requestData,
                        byte[] serializedPrincipal,
-                       byte[] clientAddress) {
-            super(ApiKeys.ENVELOPE);
+                       byte[] clientAddress,
+                       short requestHeaderVersion) {
+            super(ApiKeys.ENVELOPE,
+                ApiKeys.ENVELOPE.oldestVersion(),
+                
ApiKeys.ENVELOPE.latestVersionForRequestHeader(requestHeaderVersion));

Review Comment:
   I wonder whether we need `latestVersionForRequestHeader(short headerVersion, 
boolean enableUnstableLastVersion)`. When the next unstable version comes along 
with the v3 request header, I think we will be glad we did it. Let's discuss.



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