KAFKA-18619: New consumer topic metadata events should set requireMetadata flag#18668
KAFKA-18619: New consumer topic metadata events should set requireMetadata flag#18668lianetm merged 1 commit intoapache:trunkfrom
Conversation
|
Hi @lianetm, I have enabled the However, I believe this is a separate issue that needs investigation and is not related to this patch. |
|
Thanks for the patch @frankvicky! Could you enable here all the tests that pass so we can have validation of the change? We can investigate a bit the one that still fails, if it's related to another issue we can track and address it separately. Makes sense? |
2446388 to
4c1f6dd
Compare
| private def verifyWithRetryPredicate(predicate: => Boolean): Unit = { | ||
| var attempts = 0 | ||
| TestUtils.waitUntilTrue(() => { | ||
| try { | ||
| attempts += 1 | ||
| predicate | ||
| } catch { | ||
| case _: SaslAuthenticationException => false | ||
| } | ||
| }, s"Operation did not succeed within timeout after $attempts") | ||
| } |
There was a problem hiding this comment.
Hi @lianetm
I have found that the cause of testConsumerWithAuthenticationFailure failing is due to a non-retriable assertion.
If we pass the assertion as an argument to verifyWithRetry, it will fail because we don't catch AssertionFailedError (and we shouldn't do it). The subscribe call needs to wait for metadata updates and it's not as quick as assign, so there's a high chance it will fail on the first poll. As mentioned, when we pass the assertion as an argument, it will fail with AssertionFailedError and cannot retry.
There was a problem hiding this comment.
interesting, makes sense to me.
But then, couldn't we just change the
verifyWithRetry(assertEquals(1, consumer.poll(Duration.ofMillis(1000)).count))
to
verifyWithRetry(consumer.poll(Duration.ofMillis(1000)).count == 1)
(just to avoid introducing this new verifyWithRetryPredicate)
There was a problem hiding this comment.
Sure, i'll give it a try
lianetm
left a comment
There was a problem hiding this comment.
Thanks for the updates @frankvicky !
| @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersClassicGroupProtocolOnly")) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll")) | ||
| def testTransactionalProducerWithAuthenticationFailure(quorum: String, groupProtocol: String): Unit = { |
There was a problem hiding this comment.
Looks like it does not use a consumer. Could you double check and if so, then no need to run it for both consumers.
There was a problem hiding this comment.
should we better remove the groupProtocol param given that it does not apply here? (and parametrize the test with the quorum only)
@ParameterizedTest
@ValueSource(strings = Array("kraft"))
There was a problem hiding this comment.
I got your point 😄
| @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersClassicGroupProtocolOnly")) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll")) | ||
| def testKafkaAdminClientWithAuthenticationFailure(quorum: String, groupProtocol: String): Unit = { |
There was a problem hiding this comment.
similar as above, looks like it does need to run for both consumers?
| private def verifyWithRetryPredicate(predicate: => Boolean): Unit = { | ||
| var attempts = 0 | ||
| TestUtils.waitUntilTrue(() => { | ||
| try { | ||
| attempts += 1 | ||
| predicate | ||
| } catch { | ||
| case _: SaslAuthenticationException => false | ||
| } | ||
| }, s"Operation did not succeed within timeout after $attempts") | ||
| } |
There was a problem hiding this comment.
interesting, makes sense to me.
But then, couldn't we just change the
verifyWithRetry(assertEquals(1, consumer.poll(Duration.ofMillis(1000)).count))
to
verifyWithRetry(consumer.poll(Duration.ofMillis(1000)).count == 1)
(just to avoid introducing this new verifyWithRetryPredicate)
e7ba1be to
d82baf5
Compare
| @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersClassicGroupProtocolOnly")) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll")) | ||
| def testTransactionalProducerWithAuthenticationFailure(quorum: String, groupProtocol: String): Unit = { |
There was a problem hiding this comment.
should we better remove the groupProtocol param given that it does not apply here? (and parametrize the test with the quorum only)
@ParameterizedTest
@ValueSource(strings = Array("kraft"))
| @ParameterizedTest(name = TestInfoUtils.TestWithParameterizedQuorumAndGroupProtocolNames) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersClassicGroupProtocolOnly")) | ||
| @MethodSource(Array("getTestQuorumAndGroupProtocolParametersAll")) | ||
| def testKafkaAdminClientWithAuthenticationFailure(quorum: String, groupProtocol: String): Unit = { |
6955c82 to
adeb17d
Compare
adeb17d to
952599b
Compare
lianetm
left a comment
There was a problem hiding this comment.
Thanks! LGTM. I just re-triggered the build to see if we can get rid of some of the unrelated failures that have been fixed recently.
952599b to
7acaa1d
Compare
|
Failed test is handled by #18735 |
…adata flag (#18668) Reviewers: Lianet Magrans <lmagrans@confluent.io>
|
Merged to trunk and cherry-picked to 4.0 52280cd |
…ibrdkafka-compressed-produce-fails * apache-github/trunk: MINOR: prevent exception from HdrHistogram (apache#18674) KAFKA-18653: Fix mocks and potential thread leak issues causing silent RejectedExecutionException in share group broker tests (apache#18725) KAFKA-18646: Null records in fetch response breaks librdkafka (apache#18726) KAFKA-18619: New consumer topic metadata events should set requireMetadata flag (apache#18668) KAFKA-18488: Improve KafkaShareConsumerTest (apache#18728)
…adata flag (apache#18668) Reviewers: Lianet Magrans <lmagrans@confluent.io>
…adata flag (apache#18668) Reviewers: Lianet Magrans <lmagrans@confluent.io>
JIRA: KAFKA-18619
In short, the new async consumer's topic metadata operations are unwared of metadata errors because of not overriding
requireSubscriptionMetadata.For further details, please refer to the jira ticket.
Committer Checklist (excluded from commit message)