Skip to content

KAFKA-16480: ListOffsets change should have an associated API/IBP version update#16781

Merged
showuon merged 1 commit into
apache:trunkfrom
FrankYang0529:KAFKA-16480
Aug 3, 2024
Merged

KAFKA-16480: ListOffsets change should have an associated API/IBP version update#16781
showuon merged 1 commit into
apache:trunkfrom
FrankYang0529:KAFKA-16480

Conversation

@FrankYang0529

@FrankYang0529 FrankYang0529 commented Aug 2, 2024

Copy link
Copy Markdown
Member
  • Use oldestAllowedVersion as 9 if using ListOffsetsRequest#EARLIEST_LOCAL_TIMESTAMP or ListOffsetsRequest#LATEST_TIERED_TIMESTAMP.
  • Add test cases to ListOffsetsRequestTest#testListOffsetsRequestOldestVersion to make sure requireTieredStorageTimestamp return 9 as minVersion.
  • Add EarliestLocalSpec and LatestTierSpec to OffsetSpec.
  • Add more cases to KafkaAdminClient#getOffsetFromSpec.
  • Add testListOffsetsEarliestLocalSpecMinVersion and testListOffsetsLatestTierSpecSpecMinVersion to KafkaAdminClientTest to make sure request builder has oldestAllowedVersion as 9.

Committer Checklist (excluded from commit message)

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

@showuon showuon left a comment

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.

Thanks for the PR. Left some comments.

.stream()
.anyMatch(key -> offsetTimestampsByPartition.get(key) == ListOffsetsRequest.MAX_TIMESTAMP);

boolean requireTiredTimestamp = keys

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.

nit: tired -> tiered

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.

Maybe rename to requireTieredStorageTimestamp

Comment on lines +95 to +97
@ParameterizedTest
@ValueSource(strings = Array("zk", "kraft"))
def testListOffsetsMaxTimeStampOldestVersion(quorum: String): Unit = {
@Test
def testListOffsetsMaxTimeStampOldestVersion(): Unit = {

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.

Why do we remove the original ZK and kraft infra's tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I add it back, but I think this test is unit test, so we don't need to test it on both zk and kraft modes.

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 know what you're saying, but let's move the refactor in a separate PR.

}

@Test
def testListOffsetsRequestTiredTimestampOldestVersion(): Unit = {

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.

typo: tiered

Comment on lines +110 to +111
val consumerRequestBuilder = ListOffsetsRequest.Builder
.forConsumer(false, IsolationLevel.READ_UNCOMMITTED, false, false)

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.

This consumerRequestBuilder test is identical with the one in testListOffsetsMaxTimeStampOldestVersion. I think we can integrate these 2 tests into 1, and rename to something like: testListOffsetsRequestOldestVersion or something else. And I think (if we have time), we also need to test requireTimestamp and isolationLevel == IsolationLevel.READ_COMMITTED since I didn't see there's test covered them. WDYT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I add all cases to testListOffsetsRequestOldestVersion. Thanks.

…sion update

Signed-off-by: PoAn Yang <payang@apache.org>
@FrankYang0529

Copy link
Copy Markdown
Member Author

Hi @showuon, thanks for the review. I address all comments.

@showuon showuon left a comment

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.

LGTM! Is this PR waiting for something before it moves to ready for review?

@FrankYang0529
FrankYang0529 marked this pull request as ready for review August 3, 2024 02:43
@FrankYang0529

Copy link
Copy Markdown
Member Author

It's ready. I'm waiting for CI result.

@showuon
showuon merged commit 6e32448 into apache:trunk Aug 3, 2024
showuon pushed a commit that referenced this pull request Aug 3, 2024
…sion update (#16781)

   1. Use oldestAllowedVersion as 9 if using ListOffsetsRequest#EARLIEST_LOCAL_TIMESTAMP or ListOffsetsRequest#LATEST_TIERED_TIMESTAMP.
   2. Add test cases to ListOffsetsRequestTest#testListOffsetsRequestOldestVersion to make sure requireTieredStorageTimestamp return 9 as minVersion.
   3. Add EarliestLocalSpec and LatestTierSpec to OffsetSpec.
   4. Add more cases to KafkaAdminClient#getOffsetFromSpec.
   5. Add testListOffsetsEarliestLocalSpecMinVersion and testListOffsetsLatestTierSpecSpecMinVersion to KafkaAdminClientTest to make sure request builder has oldestAllowedVersion as 9.

Signed-off-by: PoAn Yang <payang@apache.org>

Reviewers: Luke Chen <showuon@gmail.com>
@FrankYang0529
FrankYang0529 deleted the KAFKA-16480 branch August 3, 2024 14:33
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