KAFKA-10729: Bump remaining RPC's to use tagged fields.#9601
KAFKA-10729: Bump remaining RPC's to use tagged fields.#9601hachikuji merged 10 commits intoapache:trunkfrom
Conversation
There was a problem hiding this comment.
2.7 has been branched. It should be 2.8, right?
There was a problem hiding this comment.
Thanks, that makes more sense.
10bc65b to
1488283
Compare
As a follow-up from KIP-482, this PR bumps the version for several RPC's to enable tagged fields via the flexible versioning mechanism. Additionally, a new IBP version `KAFKA_2_7_IV3` is introduced to allow replication to take advantage of these new RPC versions for OffsetForLeaderEpoch and ListOffset.
1488283 to
fb11509
Compare
fe69332 to
31f53b4
Compare
OffsetForLeaderEpoch and Produce are not yet generated RPCs, but will be once apache#9401 and apache#9547 are merged.
31f53b4 to
b836a3d
Compare
|
@gardnervickers #9401 and #9547 have been merged. You can bring them back in this PR if you like. |
| // Introduced AlterIsr (KIP-497) | ||
| KAFKA_2_7_IV2 | ||
| KAFKA_2_7_IV2, | ||
| // Flexible versioning on ListOffsets |
There was a problem hiding this comment.
For what it's worth, WriteTxnMarkers and OffsetsForLeaderEpoch are also inter-broker APIs.
…aderEpoch. - Allow using RecordBatch v2 for ProduceRequestV9.
59b6726 to
bb5f2d5
Compare
There was a problem hiding this comment.
This is to fix testThrottlingNotEnabledForConnectionToOlderBroker. The test forces ApiVersionsResponse to version 5, but relied on the fact that nothing really changed between version 5 and version 8 for PRODUCE responses. With flex versions we need to ensure the response matches the ApiVersions response
There was a problem hiding this comment.
Having this override seemed a bit error prone, and was causing failures for the NetworkClientTest. I opted to remove it entirely in favor of forcing the caller to specify the response version.
There was a problem hiding this comment.
Admittedly I'm not sure why we check the version of the last OffsetForLeaderEpoch response is 3 here. I decided to widen the check a bit so this won't break for future versions.
There was a problem hiding this comment.
I think this was originally using 1 in order to ensure that we were using a version which included the epoch in the response. Since then it looks like it has been updated blindly every time we've bumped the protocol. I'm ok leaving this as is, but we could probably also get rid of it.
- NetworkClientTest.testThrottlingNotEnabledForConnectionToOlderBroker was relying on the latest PRODUCE version being unchanged from version 5. Fix this by supplying the version when constructing the throttled produce response. - Fixed AlterReplicaLogDirsResponse to take the version in the constructor instead of offering an override which assumes that the most recent version is in use. This fixes the NetworkClientTest. - Fixed ReplicaFetcherThreadTest.shouldFetchLeaderEpochSecondTimeIfLeaderRepliesWithEpochNotKnownToFollower to check that the lastUsedOffsetForLeaderEpochVersion is >= 3 instead of == 3. It seems this check is mostly in place to ensure that a OffsetForLeaderEpoch response was sent.
bb5f2d5 to
7a7d5fd
Compare
| case 6: | ||
| case 7: | ||
| case 8: | ||
| case 9: |
There was a problem hiding this comment.
I wonder if we may as well make this the default case. Not sure we're getting much by forcing ourselves to update this logic after each bump. Maybe the range validation is still useful, but that could be done by using oldestVersion and latestVersion.
| public Builder(final List<TxnMarkerEntry> markers) { | ||
| super(ApiKeys.WRITE_TXN_MARKERS); | ||
| public Builder(final List<TxnMarkerEntry> markers, short latestAllowedVersion) { | ||
| super(ApiKeys.WRITE_TXN_MARKERS, ApiKeys.WRITE_TXN_MARKERS.oldestVersion(), latestAllowedVersion); |
There was a problem hiding this comment.
I think this is probably ok, but it is a little inconsistent with how we handle the versions for other inter-broker RPCs. Since we rely on the IBP, we always set the version explicitly in the caller, which means there is exactly one allowable version for the builder to use. See for example LeaderAndIsrRequest.Builder.
| 4 /* correlation id */ + | ||
| Type.NULLABLE_STRING.sizeOf(clientId) /* client id */ | ||
| Type.NULLABLE_STRING.sizeOf(clientId) /* client id */ + | ||
| (if (flexVersion) ByteUtils.sizeOfUnsignedVarint(0) else 0) |
There was a problem hiding this comment.
nit: maybe add a comment that this field is for the number of tagged fields?
- Make the most recent record batch version the default case when selecting a record batch version. Check that the version is within the existing version bounds. - Force a specific version in the WriteTxnMarkersRequest constructor to match other requests which utilize the IBP like LeaderAndISR.
…sion in the RequestResponseTest
hachikuji
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the patch!
…t-for-generated-requests * apache-github/trunk: KAFKA-9263 The new hw is added to incorrect log when ReplicaAlterLogDirsThread is replacing log (fix PlaintextAdminIntegrationTest.testAlterReplicaLogDirs) (apache#9423) KAFKA-10729; Bump remaining RPC's to use tagged fields. (apache#9601) clients/src/main/java/org/apache/kafka/common/requests/AbstractResponse.java clients/src/main/java/org/apache/kafka/common/requests/AlterReplicaLogDirsResponse.java clients/src/test/java/org/apache/kafka/clients/NetworkClientTest.java
As a follow-up from KIP-482, this PR bumps the version for several
RPC's to enable tagged fields via the flexible versioning mechanism.
Additionally, a new IBP version
KAFKA_2_8_IV0is introduced toallow replication to take advantage of these new RPC versions for
OffsetForLeaderEpoch and ListOffset.