You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ijuma (via GitHub)" <gi...@apache.org> on 2025/01/28 08:14:29 UTC
[PR] (WIP) KAFKA-18659: librdkafka compressed produce fails unless api versions … [kafka]
ijuma opened a new pull request, #18727:
URL: https://github.com/apache/kafka/pull/18727
WIP - submitted to run the tests in CI.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1933310064
##########
clients/src/main/java/org/apache/kafka/common/protocol/Protocol.java:
##########
@@ -208,7 +211,7 @@ public static String toHtml() {
// Responses
b.append("<b>Responses:</b><br>\n");
Schema[] responses = key.messageType.responseSchemas();
- for (int i = 0; i < responses.length; i++) {
+ for (int i = oldestVersion; i < responses.length; i++) {
Review Comment:
This bug fix is unrelated to the main change in this PR.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1934410747
##########
clients/src/main/resources/common/message/ProduceRequest.json:
##########
@@ -44,7 +47,7 @@
// transaction V2 (KIP_890 part 2) is enabled, the produce request will also include the function for a
// AddPartitionsToTxn call. If V2 is disabled, the client can't use produce request version higher than 11 within
// a transaction.
- "validVersions": "3-12",
+ "validVersions": "0-12",
Review Comment:
I agree that it's nearly impossible to make the experience for these super ancient clients good. I was more thinking about client developers implementing the kafka protocol.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on PR #18727:
URL: https://github.com/apache/kafka/pull/18727#issuecomment-2628657478
@junrao @chia7712 I realized that the test I wanted already existed in `ProcessorTest` - I made a small adjustment so it tests V0-V2 (and not just V0). I then went ahead and adjusted the protocol definition files and related changes. I think this is in good shape. What do you think?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937752816
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
> the separate file would not have be able to use the same api key id.
Pardon me, what is the issue of defining `"apiKey": 0` in other file (test scope) ? I create `kafka/clients/src/test/resources/common/message/LegacyProduceRequest.json` according to v0-v2, and it works well.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1933310599
##########
clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java:
##########
@@ -69,11 +74,6 @@ public ProduceRequest build(short version) {
return build(version, true);
}
- // Visible for testing only
- public ProduceRequest buildUnsafe(short version) {
Review Comment:
This is unused.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1934045776
##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -374,6 +374,10 @@ class KafkaApis(val requestChannel: RequestChannel,
*/
def handleProduceRequest(request: RequestChannel.Request, requestLocal: RequestLocal): Unit = {
val produceRequest = request.body[ProduceRequest]
+ if (produceRequest.version <= 2) {
Review Comment:
I have updated the PR.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "stanislavkozlovski (via GitHub)" <gi...@apache.org>.
stanislavkozlovski commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1932959065
##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -374,6 +374,10 @@ class KafkaApis(val requestChannel: RequestChannel,
*/
def handleProduceRequest(request: RequestChannel.Request, requestLocal: RequestLocal): Unit = {
val produceRequest = request.body[ProduceRequest]
+ if (produceRequest.version <= 2) {
Review Comment:
should there be a test/documentation explaining why this is done? otherwise could easily get swept away in a future change
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "junrao (via GitHub)" <gi...@apache.org>.
junrao commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1934340135
##########
clients/src/main/resources/common/message/ProduceRequest.json:
##########
@@ -44,7 +47,7 @@
// transaction V2 (KIP_890 part 2) is enabled, the produce request will also include the function for a
// AddPartitionsToTxn call. If V2 is disabled, the client can't use produce request version higher than 11 within
// a transaction.
- "validVersions": "3-12",
+ "validVersions": "0-12",
Review Comment:
Instead of bringing back v0 and v1, could we just customize the minVersion of the produce ApiKey in ApiResponse?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on PR #18727:
URL: https://github.com/apache/kafka/pull/18727#issuecomment-2622119326
Thinking about it, there is probably a cleaner way to make this change. Let me try that.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1936219425
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +273,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
+ // see `PRODUCE_MIN_VERSION` for details on why we do this
Review Comment:
Fix reference: the field name is `PRODUCE_OLDEST_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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1934356925
##########
clients/src/main/resources/common/message/ProduceRequest.json:
##########
@@ -44,7 +47,7 @@
// transaction V2 (KIP_890 part 2) is enabled, the produce request will also include the function for a
// AddPartitionsToTxn call. If V2 is disabled, the client can't use produce request version higher than 11 within
// a transaction.
- "validVersions": "3-12",
+ "validVersions": "0-12",
Review Comment:
I am indeed exploring something involving customizing ApiKey/ApiResponse (that's what I meant when I said that there may be a cleaner way to make the change). But I was planning to leave 0-12 here and reduce the range within the code.
The main advantage is that you get appropriate errors if you try to produce with v0-2. The option you suggest would result in a disconnection. I think a disconnection is too confusing if the given version is included as part of the api versions response.
Thoughts?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1936219937
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -149,6 +149,12 @@ public enum ApiKeys {
private static final Map<Integer, ApiKeys> ID_TO_TYPE = Arrays.stream(ApiKeys.values())
.collect(Collectors.toMap(key -> (int) key.id, Function.identity()));
+ // Versions 0-2 were removed in Apache Kafka 4.0, version 3 is the new baseline. Due to a bug in librdkafka,
+ // these versions have to be included in the api versions response (see KAFKA-18659), which means we cannot exclude
+ // them from the protocol definition. Instead, we reject requests with such versions in `KafkaApis` by returning
+ // `UnsupportedVersion` errors. We also special case the generated protocol html to exclude versions 0-2.
Review Comment:
I'll clean up this description.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "junrao (via GitHub)" <gi...@apache.org>.
junrao commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1938309781
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +269,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
Review Comment:
Since listenerType is optional, could we add a comment when the caller is expected to pass in the right listenerType?
##########
core/src/test/scala/unit/kafka/network/ProcessorTest.scala:
##########
@@ -65,13 +65,31 @@ class ProcessorTest {
@Test
def testParseRequestHeaderWithUnsupportedApiVersion(): Unit = {
val requestHeader = RequestTestUtils.serializeRequestHeader(
- new RequestHeader(ApiKeys.PRODUCE, 0, "clientid", 0))
+ new RequestHeader(ApiKeys.FETCH, 0, "clientid", 0))
val apiVersionManager = new SimpleApiVersionManager(ListenerType.BROKER, true,
() => new FinalizedFeatures(MetadataVersion.latestTesting(), Collections.emptyMap[String, java.lang.Short], 0))
val e = assertThrows(classOf[UnsupportedVersionException],
(() => Processor.parseRequestHeader(apiVersionManager, requestHeader)): Executable,
- "PRODUCE v0 should throw UnsupportedVersionException exception")
+ "FETCH v0 should throw UnsupportedVersionException exception")
assertTrue(e.toString.contains("unsupported version"));
}
+ /**
+ * We do something unusual with these versions of produce, and we want to make sure we don't regress.
+ * See `ApiKeys.PRODUCE_API_VERSIONS_RESPONSE_MIN_VERSION` for details.
+ */
+ @Test
+ def testParseRequestHeaderForProduceV0ToV2(): Unit = {
+ for (version <- 0 to 2) {
+ val requestHeader = RequestTestUtils.serializeRequestHeader(
+ new RequestHeader(ApiKeys.PRODUCE, version.toShort, "clientid", 0))
+ val apiVersionManager = new SimpleApiVersionManager(ListenerType.BROKER, true,
Review Comment:
This is an existing issue. Broker uses `DefaultApiVersionManager`, instead of `SimpleApiVersionManager`. It would be useful to switch to `DefaultApiVersionManager` here and in `testParseRequestHeaderWithUnsupportedApiVersion()`.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1938325897
##########
core/src/test/scala/unit/kafka/network/ProcessorTest.scala:
##########
@@ -65,13 +65,31 @@ class ProcessorTest {
@Test
def testParseRequestHeaderWithUnsupportedApiVersion(): Unit = {
val requestHeader = RequestTestUtils.serializeRequestHeader(
- new RequestHeader(ApiKeys.PRODUCE, 0, "clientid", 0))
+ new RequestHeader(ApiKeys.FETCH, 0, "clientid", 0))
val apiVersionManager = new SimpleApiVersionManager(ListenerType.BROKER, true,
() => new FinalizedFeatures(MetadataVersion.latestTesting(), Collections.emptyMap[String, java.lang.Short], 0))
val e = assertThrows(classOf[UnsupportedVersionException],
(() => Processor.parseRequestHeader(apiVersionManager, requestHeader)): Executable,
- "PRODUCE v0 should throw UnsupportedVersionException exception")
+ "FETCH v0 should throw UnsupportedVersionException exception")
assertTrue(e.toString.contains("unsupported version"));
}
+ /**
+ * We do something unusual with these versions of produce, and we want to make sure we don't regress.
+ * See `ApiKeys.PRODUCE_API_VERSIONS_RESPONSE_MIN_VERSION` for details.
+ */
+ @Test
+ def testParseRequestHeaderForProduceV0ToV2(): Unit = {
+ for (version <- 0 to 2) {
+ val requestHeader = RequestTestUtils.serializeRequestHeader(
+ new RequestHeader(ApiKeys.PRODUCE, version.toShort, "clientid", 0))
+ val apiVersionManager = new SimpleApiVersionManager(ListenerType.BROKER, true,
Review Comment:
Fixed.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "junrao (via GitHub)" <gi...@apache.org>.
junrao commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1934427757
##########
clients/src/main/resources/common/message/ProduceRequest.json:
##########
@@ -44,7 +47,7 @@
// transaction V2 (KIP_890 part 2) is enabled, the produce request will also include the function for a
// AddPartitionsToTxn call. If V2 is disabled, the client can't use produce request version higher than 11 within
// a transaction.
- "validVersions": "3-12",
+ "validVersions": "0-12",
Review Comment:
Yes, we could make an effort to send a more meaningful error code for produce v0-v2. But since they are not really supported on the broker, just doing a disconnect like any other unsupported version also seems reasonable.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937699394
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
This one is different because we have the overrides - it's very difficult to ensure we don't regress as the code changes without a test. For the other cases, the logic is very simple (the versions that are not supported are not supported anywhere).
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937699394
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
This one is different because we have the overrides - it's very difficult to ensure we don't regress as the code changes without a test. For the other cases, the logic is very simple.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937695933
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +273,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
Review Comment:
It's a bit error prone to have 2 booleans. This approach has better type safety and it also fits with the calling code.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "stanislavkozlovski (via GitHub)" <gi...@apache.org>.
stanislavkozlovski commented on PR #18727:
URL: https://github.com/apache/kafka/pull/18727#issuecomment-2628890798
LGTM
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on PR #18727:
URL: https://github.com/apache/kafka/pull/18727#issuecomment-2621889267
The test failures look related:
> FAILED ❌ KafkaAdminClientTest > testAdminClientApisAuthenticationFailure()
FAILED ❌ ProcessorTest > testParseRequestHeaderWithUnsupportedApiVersion()
FAILED ❌ KafkaApisTest > shouldReplaceProducerFencedWithInvalidProducerEpochInProduceResponse()
FAILED ❌ KafkaApisTest > testTransactionalParametersSetCorrectly()
Investigating.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on PR #18727:
URL: https://github.com/apache/kafka/pull/18727#issuecomment-2628792207
Tests are green.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1936336116
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +273,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
+ // see `PRODUCE_MIN_VERSION` for details on why we do this
+ short oldestVersion = (this == PRODUCE && listenerType.map(l -> l == ApiMessageType.ListenerType.BROKER).orElse(false)) ?
Review Comment:
I will explain the changes in more detail after I confirm that the test results are passing.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "junrao (via GitHub)" <gi...@apache.org>.
junrao commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937678804
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
> We would have to remove testProduceRequestV0ToV2IsRejectedByBroker since there would be no way to produce with v0-v2. We would probably have to create a ducktape test to replace that. I am not sure how easy or hard that would be (ducktape tests typically use clients instead of testing specific requests).
We removed a bunch of old version of other requests. If we just follow their approach by removing the old version from the protocol definition, there is no need to test the server rejection logic just for produce request, right?
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +273,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
Review Comment:
When listenerType is not empty, it's always Broker. Perhaps this can just be a boolean like forBroker?
##########
clients/src/test/java/org/apache/kafka/common/requests/ProduceRequestTest.java:
##########
@@ -277,6 +276,21 @@ public void testMixedIdempotentData() {
assertTrue(RequestTestUtils.hasIdempotentRecords(request));
}
+ @Test
+ public void testBuilderOldestAndLatestAllowed() {
+ ProduceRequest.Builder builder = ProduceRequest.builder(new ProduceRequestData()
+ .setTopicData(new ProduceRequestData.TopicProduceDataCollection(Collections.singletonList(
+ new ProduceRequestData.TopicProduceData()
+ .setName("topic")
+ .setPartitionData(Collections.singletonList(new ProduceRequestData.PartitionProduceData()
+ .setIndex(1)
Review Comment:
This is for PartitionProduceData(). Could we make the indentation clearer?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1938138397
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
I realized that there was a simple way - described it in the main PR.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on PR #18727:
URL: https://github.com/apache/kafka/pull/18727#issuecomment-2622113965
@chia7712 Good point regarding the client behavior, I'll look into adjusting that too.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1934092040
##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -374,6 +374,11 @@ class KafkaApis(val requestChannel: RequestChannel,
*/
def handleProduceRequest(request: RequestChannel.Request, requestLocal: RequestLocal): Unit = {
val produceRequest = request.body[ProduceRequest]
+ // See `ProduceRequest.MIN_VERSION` for details on why we need to do this
+ if (produceRequest.version < ProduceRequest.MIN_VERSION) {
+ requestHelper.sendErrorResponseMaybeThrottle(request, Errors.UNSUPPORTED_VERSION.exception())
+ return;
Review Comment:
`;` is unnecessary
##########
clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java:
##########
@@ -69,11 +74,6 @@ public ProduceRequest build(short version) {
return build(version, true);
}
- // Visible for testing only
- public ProduceRequest buildUnsafe(short version) {
Review Comment:
It seems we can merge `private ProduceRequest build(short version, boolean validate)` into `public ProduceRequest build(short version)`. Otherwise, IDE complains the method has a "always true" input variable `validate`.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "junrao (via GitHub)" <gi...@apache.org>.
junrao commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1934405834
##########
clients/src/main/resources/common/message/ProduceRequest.json:
##########
@@ -44,7 +47,7 @@
// transaction V2 (KIP_890 part 2) is enabled, the produce request will also include the function for a
// AddPartitionsToTxn call. If V2 is disabled, the client can't use produce request version higher than 11 within
// a transaction.
- "validVersions": "3-12",
+ "validVersions": "0-12",
Review Comment:
It seems that `UNSUPPORTED_VERSION` was added in 0.10.0 https://github.com/apache/kafka/pull/986/files#diff-0ae188e241ee35148145e7e04ed2acb3c20356650194f3603811c51b886ebe20. Produce v0/v1 already existed in 0.9. So, even if we send `UNSUPPORTED_VERSION` in the error, the 0.9 client won't be able to understand it. So, it really only helps with Produce v2 request.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1932965261
##########
core/src/main/scala/kafka/server/KafkaApis.scala:
##########
@@ -374,6 +374,10 @@ class KafkaApis(val requestChannel: RequestChannel,
*/
def handleProduceRequest(request: RequestChannel.Request, requestLocal: RequestLocal): Unit = {
val produceRequest = request.body[ProduceRequest]
+ if (produceRequest.version <= 2) {
Review Comment:
As per the PR description, this is WIP - the code will change before review time. :)
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1936220770
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -341,10 +353,7 @@ public static EnumSet<ApiKeys> controllerApis() {
}
public static EnumSet<ApiKeys> clientApis() {
- List<ApiKeys> apis = Arrays.stream(ApiKeys.values())
- .filter(apiKey -> apiKey.inScope(ApiMessageType.ListenerType.BROKER))
- .collect(Collectors.toList());
- return EnumSet.copyOf(apis);
+ return brokerApis();
Review Comment:
This simplification is unrelated to the main change in this PR - just something I noticed could be cleaned up.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1938326132
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +269,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
Review Comment:
Fair point, I updated this to have two methods so it's clear which one to be used when. One of them always take the API listener and the other one doesn't. There is only one non test usage of the latter currently.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma merged PR #18727:
URL: https://github.com/apache/kafka/pull/18727
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1936263117
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +273,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
+ // see `PRODUCE_MIN_VERSION` for details on why we do this
+ short oldestVersion = (this == PRODUCE && listenerType.map(l -> l == ApiMessageType.ListenerType.BROKER).orElse(false)) ?
Review Comment:
Excuse me, but why change the (produce) schema version after we decided to change the API response? I assumed all we needed to do was return the API response including v0-v2 produce requests to fix the librdkafka issue. Then, the schema could remain at v3-v12, so the v0-v2 requests would still be rejected.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937725987
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
It seems the primary purpose of retaining v0-v2 is to facilitate easier test writing. Perhaps we could create a `LegacyProduceRequest` json that mirrors the v0-v2 format exclusively for testing purposes?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937803364
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
I hadn't considered doing this in a different scope. I can try that and see if it works.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on PR #18727:
URL: https://github.com/apache/kafka/pull/18727#issuecomment-2625968864
@chia7712 @junrao The tests should now be passing for this PR. The comments should also make it clear what's going on. The main point of contention is whether we should remove v0-v2 from the protocol definition files. If we do that, there are three main implications for this PR:
1. The `ApiKeys.oldestVersion` override would no longer be required.
2. The `toApiVersion` code would have to refer to a separate constant for Produce min version (instead of retrieving it from the generated class).
3. We would have to remove `testProduceRequestV0ToV2IsRejectedByBroker` since there would be no way to produce with v0-v2. We would probably have to create a ducktape test to replace that. I am not sure how easy or hard that would be (ducktape tests typically use clients instead of testing specific requests).
Given that, I would prefer to keep the current approach to unblock 4.0. I am ok with filing a ticket to do the 3 things listed above, if we prefer that approach. Overall, I think it's a 50/50 situation (neither approach is clearly better than the other), but I am ok if someone else wants to tackle the alternative option.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937734265
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
That won't work, the separate file would not have be able to use the same api key id.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1937734265
##########
core/src/test/scala/unit/kafka/server/ProduceRequestTest.scala:
##########
@@ -283,6 +286,48 @@ class ProduceRequestTest extends BaseRequestTest {
assertEquals(-1, partitionProduceResponse1.logAppendTimeMs)
}
+ /**
+ * See `ApiKeys.PRODUCE_OLDEST_VERSION` for the details of why we need special handling for produce request v0-v2 (inclusive).
+ */
+ @Test
+ def testProduceRequestV0ToV2IsRejectedByBroker(): Unit = {
Review Comment:
That won't work, the separate file would not be able to use the same api key id.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1938136022
##########
clients/src/main/java/org/apache/kafka/common/protocol/ApiKeys.java:
##########
@@ -264,8 +273,11 @@ public boolean hasValidVersion() {
return oldestVersion() <= latestVersion();
}
- public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion) {
- short oldestVersion = oldestVersion();
+ public Optional<ApiVersionsResponseData.ApiVersion> toApiVersion(boolean enableUnstableLastVersion,
+ Optional<ApiMessageType.ListenerType> listenerType) {
+ // see `PRODUCE_MIN_VERSION` for details on why we do this
+ short oldestVersion = (this == PRODUCE && listenerType.map(l -> l == ApiMessageType.ListenerType.BROKER).orElse(false)) ?
Review Comment:
We're discussing this in the main discussion, so will resolve this.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1938136154
##########
clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java:
##########
@@ -66,21 +67,10 @@ public Builder(short minVersion,
@Override
public ProduceRequest build(short version) {
- return build(version, true);
- }
-
- // Visible for testing only
- public ProduceRequest buildUnsafe(short version) {
Review Comment:
Removed unused overloads.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1936221997
##########
clients/src/main/java/org/apache/kafka/common/protocol/Protocol.java:
##########
@@ -208,26 +208,26 @@ public static String toHtml() {
// Responses
b.append("<b>Responses:</b><br>\n");
Schema[] responses = key.messageType.responseSchemas();
- for (int i = 0; i < responses.length; i++) {
- Schema schema = responses[i];
+ for (int version = key.oldestVersion(); version < key.latestVersion(); version++) {
Review Comment:
Use the same approach we use for requests for consistency - it should result in the same behavior, but fail more clearly if there is some inconsistency.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-18659: librdkafka compressed produce fails unless api versions returns produce v0 [kafka]
Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #18727:
URL: https://github.com/apache/kafka/pull/18727#discussion_r1936224109
##########
clients/src/main/java/org/apache/kafka/common/requests/ProduceRequest.java:
##########
@@ -69,11 +74,6 @@ public ProduceRequest build(short version) {
return build(version, true);
}
- // Visible for testing only
- public ProduceRequest buildUnsafe(short version) {
Review Comment:
Will include this in my next batch of changes.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org