KAFKA-17492 skip features with minVersion of 0 instead of replacing 0 with 1 when BrokerRegistrationRequest < 4#17128
Conversation
noticed that I had raised a question for it: #16421 (comment) |
| } else { | ||
| return new BrokerRegistrationRequest(data, version); | ||
| } | ||
| return new BrokerRegistrationRequest(data, version); |
There was a problem hiding this comment.
We need to skip features with minSupportedVersion of 0 in v3 or less.
We need to do the same in ApiVersionResponse.
We need to change the comment like the following in ApiVersionResponse.json and BrokerRegistrationRequest.json.
Note: in v0-v3, features with MinSupportedVersion = 0 show up with MinSupportedVersion = 1.
There was a problem hiding this comment.
for another: please update the following comment:
// Workaround for KAFKA-17011: for BrokerRegistrationRequest versions older than 4,
// translate minSupportedVersion = 0 to minSupportedVersion = 1.
There was a problem hiding this comment.
Sorry, I don't understand the change here. The correct change (that matches the PR description) would be to remove features that had a minVersion of 0 when handling older RPCs, right? But instead the code just seems to pass everything through, ignoring RPC version. What am I missing?
| ". The broker wants a version between " + feature.minSupportedVersion() + " and " + | ||
| feature.maxSupportedVersion() + ", inclusive."); | ||
| } | ||
| finalizedFeatures.get(feature.name()).ifPresent( |
There was a problem hiding this comment.
@m1a2st please take a look at #16421 (comment). We don't need to remove the check of ClusterControlManager
| ". The broker wants a version between " + feature.minSupportedVersion() + " and " + | ||
| feature.maxSupportedVersion() + ", inclusive."); | ||
| } | ||
| finalizedFeatures.get(feature.name()).ifPresent( |
There was a problem hiding this comment.
This change is incorrect. If the minVersion is 0, the feature must be set.
|
I pushed a commit which does what the PR description says (skip features with minVersion of 0)... take a look [edit: there are probably some unit tests that need to be fixed up] |
| BrokerRegistrationRequestData.Feature feature = iter.next(); | ||
| if (feature.minSupportedVersion() == 0) { | ||
| feature.setMinSupportedVersion((short) 1); | ||
| iter.remove(); |
There was a problem hiding this comment.
How about using removeIf?
newData.features().removeIf(feature -> feature.minSupportedVersion() == 0);|
Run the I will merge it if no failed tests. |
0478cb3 to
201827f
Compare
|
I did some cleanup and added the |
| // at versions less than 4, we must set the minimum version for these features | ||
| // to 1 rather than 0. See KAFKA-17011 for details. | ||
| key.setMinVersion((short) 1); | ||
| // at versions less than 4, we must omit these features. See KAFKA-17492. |
There was a problem hiding this comment.
We need to change the comment like the following in ApiVersionResponse.json and BrokerRegistrationRequest.json.
Note: in v0-v3, features with MinSupportedVersion = 0 show up with MinSupportedVersion = 1.
There was a problem hiding this comment.
@m1a2st Could you please address @junrao comment? That includes following files.
https://github.com/apache/kafka/blob/trunk/clients/src/main/resources/common/message/BrokerRegistrationRequest.json#L51
| assertEquals(expectedMinVersion, key.minVersion()) | ||
| } | ||
|
|
||
| def assertFeatureMissing( |
| // at versions less than 4, we must set the minimum version for these features | ||
| // to 1 rather than 0. See KAFKA-17011 for details. | ||
| key.setMinVersion((short) 1); | ||
| // Note: For API versions v0-v3, features with MinSupportedVersion = 0 |
There was a problem hiding this comment.
This comment is not accurate. Could you consider using @cmccabe's comment?
// Some older clients will have deserialization problems if a feature's
// minimum supported level is 0. Therefore, when preparing ApiVersionResponse
// at versions less than 4, we must omit these features. See KAFKA-17492.
|
@m1a2st please add 3.8 version to following e2e: |
Some older clients will have deserialization problems if a KIP-584 feature's minimum supported level is 0. Therefore, when preparing an ApiVersionResponse for a version less than 4, we must omit features with a minimum supported level of 0. This is reasonable to do because older software could not handle setting these features to a level other than 0 in any case. A similar problem applies to BrokerRegistrationRequest. Here we must omit features with minVersion = 0 when the RPC version is less than 4. Note that this fix supersedes an earlier compatibility preservation effort in KAFKA-17011.
a66f458 to
b706bf2
Compare
| { "name": "SupportedFeatures", "type": "[]SupportedFeatureKey", "ignorable": true, | ||
| "versions": "3+", "tag": 0, "taggedVersions": "3+", | ||
| "about": "Features supported by the broker. Note: in v0-v3, features with MinSupportedVersion = 0 show up with MinSupportedVersion = 1.", | ||
| "about": "Features supported by the broker. Note: in v0-v3, features blocked with MinSupportedVersion = 0.", |
There was a problem hiding this comment.
Pardon me, I don't catch "features blocked with MinSupportedVersion = 0."
Also, please fix BrokerRegistrationRequest.json too
There was a problem hiding this comment.
Pardon me, I don't catch "features blocked with MinSupportedVersion = 0."
I change it to omit, it is more accurancy in this case
| }, | ||
| { "name": "Features", "type": "[]Feature", | ||
| "about": "The features on this broker. Note: in v0-v3, features with MinSupportedVersion = 0 show up with MinSupportedVersion = 1.", "versions": "0+", "fields": [ | ||
| "about": "The features on this broker. Note: in v0-v3, features omit with MinSupportedVersion = 0.", "versions": "0+", "fields": [ |
There was a problem hiding this comment.
How about "features with MinSupportedVersion = 0 are omitted"?
| { "name": "SupportedFeatures", "type": "[]SupportedFeatureKey", "ignorable": true, | ||
| "versions": "3+", "tag": 0, "taggedVersions": "3+", | ||
| "about": "Features supported by the broker. Note: in v0-v3, features with MinSupportedVersion = 0 show up with MinSupportedVersion = 1.", | ||
| "about": "Features supported by the broker. Note: in v0-v3, features omit with MinSupportedVersion = 0.", |
There was a problem hiding this comment.
How about "features with MinSupportedVersion = 0 are omitted"?
c2babe3 to
85bdd76
Compare
|
The failed tests pass on my local, and following links are the related jira. The new e2e works on my local. I will merge it to trunk and 3.9 later if no objections. https://issues.apache.org/jira/browse/KAFKA-17514 |
|
Thanks folks for fixing this 🙏 |
| { "name": "SupportedFeatures", "type": "[]SupportedFeatureKey", "ignorable": true, | ||
| "versions": "3+", "tag": 0, "taggedVersions": "3+", | ||
| "about": "Features supported by the broker. Note: in v0-v3, features with MinSupportedVersion = 0 show up with MinSupportedVersion = 1.", | ||
| "about": "Features supported by the broker. Note: in v0-v3, features MinSupportedVersion = 0 are omitted.", |
There was a problem hiding this comment.
features MinSupportedVersion = 0 are omitted => features with MinSupportedVersion = 0 are omitted
| }, | ||
| { "name": "Features", "type": "[]Feature", | ||
| "about": "The features on this broker. Note: in v0-v3, features with MinSupportedVersion = 0 show up with MinSupportedVersion = 1.", "versions": "0+", "fields": [ | ||
| "about": "The features on this broker. Note: in v0-v3, features MinSupportedVersion = 0 are omitted.", "versions": "0+", "fields": [ |
There was a problem hiding this comment.
features MinSupportedVersion = 0 are omitted => features with MinSupportedVersion = 0 are omitted
|
The last commit does not impact source code, so I'm going to merge it to test full e2e with #17084 |
… with 1 when BrokerRegistrationRequest < 4 (#17128) The 3.8 controller assumes the unknown features have min version = 0, but KAFKA-17011 replace the min=0 by min=1 when BrokerRegistrationRequest < 4. Hence, to support upgrading from 3.8.0 to 3.9, this PR changes the implementation of ApiVersionsResponse (<4) and BrokerRegistrationRequest (<4) to skip features with supported minVersion of 0 instead of replacing 0 with 1 Reviewers: Jun Rao <junrao@gmail.com>, Colin P. McCabe <cmccabe@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
|
@m1a2st : Could we update https://cwiki.apache.org/confluence/display/KAFKA/KIP-1022%3A+Formatting+and+Updating+Features and the mailing list with the changes in this PR? |
… with 1 when BrokerRegistrationRequest < 4 (apache#17128) The 3.8 controller assumes the unknown features have min version = 0, but KAFKA-17011 replace the min=0 by min=1 when BrokerRegistrationRequest < 4. Hence, to support upgrading from 3.8.0 to 3.9, this PR changes the implementation of ApiVersionsResponse (<4) and BrokerRegistrationRequest (<4) to skip features with supported minVersion of 0 instead of replacing 0 with 1 Reviewers: Jun Rao <junrao@gmail.com>, Colin P. McCabe <cmccabe@apache.org>, Chia-Ping Tsai <chia7712@gmail.com>
Jira: https://issues.apache.org/jira/browse/KAFKA-17492
Due to the BrokerRegistrationRequest minVersion is setting from 0 to 1, thus
ClusterControlManger#processRegistrationFeaturecheck the version will throw an error, fix it by below suggestionskip features with minVersion of 0 instead of replacing 0 with 1 when BrokerRegistrationRequest < 4
2. make 3.9+ controller be able to accept unknown features from future brokerskip check of unknown features. see following sample code
Committer Checklist (excluded from commit message)