Skip to content

KAFKA-13002: listOffsets must downgrade immediately for non MAX_TIMESTAMP specs#10936

Merged
dajac merged 22 commits intoapache:trunkfrom
thomaskwscott:trunk
Jul 1, 2021
Merged

KAFKA-13002: listOffsets must downgrade immediately for non MAX_TIMESTAMP specs#10936
dajac merged 22 commits intoapache:trunkfrom
thomaskwscott:trunk

Conversation

@thomaskwscott
Copy link
Copy Markdown
Contributor

KAFKA-12541 introduced a regression for listOffsets requests for non maxtimestamp specs. when communicating with old brokers. This PR addresss this case.

More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Tested with new unit test for regression case.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@dajac dajac self-requested a review June 28, 2021 17:34
Copy link
Copy Markdown
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomaskwscott Thanks for the prompt fix. I left a few minor comments.

Comment thread clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java Outdated
Comment thread clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java Outdated
Copy link
Copy Markdown
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thomaskwscott Thanks for the update. I left few comments.

Comment thread clients/src/test/java/org/apache/kafka/clients/MockClient.java Outdated

env.kafkaClient().setNodeApiVersions(NodeApiVersions.create());
env.kafkaClient().setNodeApiVersions(NodeApiVersions.create(
ApiKeys.LIST_OFFSETS.id, (short) 0, (short) 6));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should use 0 for the maximum version in this case as 0 does not support querying by timestamp at all.

Comment on lines +4252 to +4253
env.kafkaClient().setNodeApiVersions(NodeApiVersions.create(
ApiKeys.LIST_OFFSETS.id, (short) 0, (short) 6));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit annoying that we have to keep calling prepareUnsupportedVersionResponse below even when we provide the versions. In the end, setting the versions in this case does not change much because prepareUnsupportedVersionResponse will make the request fail anyway. This is inherently due to the implementation of the MockClient which requires queued responses in order to process queued requests. It is fine to keep it as it in this patch but we should really rework the MockClient.

@thomaskwscott
Copy link
Copy Markdown
Contributor Author

I was able to reproduce the issue running the stream wordcount demo on current trunk with 2.8.0 brokers. I can confirm that the latest build of this branch resolves it.

@dajac
Copy link
Copy Markdown
Member

dajac commented Jun 30, 2021

@thomaskwscott Some tests failed. It might be related to the changes in the MockClient. Could you verify?

@thomaskwscott thomaskwscott requested a review from dajac June 30, 2021 20:48
Copy link
Copy Markdown
Member

@dajac dajac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dajac dajac changed the title KAFKA-13002 Fix for non max timestamp degrade case KAFKA-13002: listOffsets must downgrade immediately for non MAX_TIMESTAMP specs Jul 1, 2021
@dajac dajac merged commit 593b34a into apache:trunk Jul 1, 2021
xdgrulez pushed a commit to xdgrulez/kafka that referenced this pull request Dec 22, 2021
…TAMP specs (apache#10936)

This patch fixes a regression introduced apache#10760. The downgrade logic was not downgrading the version when only non MAX_TIMESTAMP specs were used.

Reviewers: David Jacot <djacot@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants