-
Notifications
You must be signed in to change notification settings - Fork 14.9k
KAFKA-19384: The passing of BrokerRegistrationRequestTest is a false positive #20338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| // No features (MV) sent with registration, controller can't verify | ||
| assertEquals( | ||
| Errors.BROKER_ID_NOT_REGISTERED, | ||
| registerBroker(channelManager, clusterId, 100, Some(1), None)) | ||
| Errors.INVALID_REGISTRATION, | ||
| registerBroker(channelManager, clusterId, 100, None, None)) | ||
|
|
||
| // Given MV is too high for controller to support | ||
| assertEquals( | ||
| Errors.BROKER_ID_NOT_REGISTERED, | ||
| registerBroker(channelManager, clusterId, 100, Some(1), Some((MetadataVersion.IBP_3_4_IV0.featureLevel, MetadataVersion.IBP_3_4_IV0.featureLevel)))) | ||
| Errors.UNSUPPORTED_VERSION, | ||
| registerBroker(channelManager, clusterId, 100, None, Some((MetadataVersion.IBP_3_4_IV0.featureLevel, MetadataVersion.IBP_3_4_IV0.featureLevel)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, passing Some(1) as the zkEpoch parameter caused zkEpoch.isDefined to always be true, which led to a BrokerIdNotRegisteredException being thrown.
As a result, the intended test scenario was never actually tested.
chia7712
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@apalan60 thanks for this migration. I leave a couple of comments
core/src/test/java/kafka/server/BrokerRegistrationRequestTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/kafka/server/BrokerRegistrationRequestTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/kafka/server/BrokerRegistrationRequestTest.java
Outdated
Show resolved
Hide resolved
|
@chia7712 |
server/src/test/java/org/apache/kafka/server/BrokerRegistrationRequestTest.java
Show resolved
Hide resolved
| return new NodeToControllerChannelManagerImpl( | ||
| new TestControllerNodeProvider(controllerSocketServer, clusterInstance), | ||
| Time.SYSTEM, | ||
| new Metrics(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please close the metrics manually? NodeToControllerChannelManagerImpl does not handle it.
|
@chia7712 |
|
Seems the refactored test is causing a thread leak. I’m looking into a fix. |
…gistrationRequestTest to avoid thread leaks
| return Errors.forCode(resp.data().errorCode()); | ||
| } | ||
|
|
||
| record FeatureLevel(short min, short max) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be replaced by BrokerRegistrationRequestData.Feature, shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed this, thanks.
chia7712
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes a false positive in
BrokerRegistrationRequestTestcaused byisMigratingZkBroker, and migrates the test from Scala to Java.Reviewers: Chia-Ping Tsai chia7712@gmail.com