Skip to content

KAFKA-16689: Move LogValidatorTest to storage module#16167

Merged
chia7712 merged 30 commits intoapache:trunkfrom
TaiJuWu:KAFKA-16689
Aug 13, 2024
Merged

KAFKA-16689: Move LogValidatorTest to storage module#16167
chia7712 merged 30 commits intoapache:trunkfrom
TaiJuWu:KAFKA-16689

Conversation

@TaiJuWu
Copy link
Copy Markdown
Collaborator

@TaiJuWu TaiJuWu commented Jun 1, 2024

*More detailed description of your change,
Rewrite LogValidatorTest.scala to java version

*Summary of testing strategy (including rationale)

Committer Checklist (excluded from commit message)

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

@TaiJuWu TaiJuWu force-pushed the KAFKA-16689 branch 4 times, most recently from c968a9d to 07dda87 Compare June 10, 2024 08:28
@TaiJuWu TaiJuWu changed the title [Draft] KAFKA-16689: Move LogValidatorTest to storage module KAFKA-16689: Move LogValidatorTest to storage module Jun 10, 2024
@TaiJuWu TaiJuWu marked this pull request as ready for review June 10, 2024 08:56
@TaiJuWu
Copy link
Copy Markdown
Collaborator Author

TaiJuWu commented Jun 13, 2024

@chia7712 Please take look! Thanks.

@TaiJuWu TaiJuWu requested a review from chia7712 June 17, 2024 11:04
Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@TaiJuWu thanks for updated PR

@TaiJuWu
Copy link
Copy Markdown
Collaborator Author

TaiJuWu commented Jun 22, 2024

Hi @chia7712 , thanks for your review.
I have updated this PR, PTAL.

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@TaiJuWu thanks for updated PR

TaiJuWu added 2 commits June 25, 2024 01:57
Address below comments
1. replace time with Duration
2. Delete iterToStream
3. remove unused variable
4. Inline createNonIncreasingOffsetRecords
Comment thread storage/src/main/java/org/apache/kafka/storage/internals/log/LogValidator.java Outdated
@TaiJuWu TaiJuWu force-pushed the KAFKA-16689 branch 3 times, most recently from e725614 to eb33904 Compare July 4, 2024 12:47
Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@TaiJuWu thanks for updates

try {
record.ensureValid();
} catch (InvalidRecordException e) {
} catch (InvalidRecordException | CorruptRecordException e) {
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 we need this check?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

here is the exception should be thrown so we need to add it.

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.

My point was why we need to change the production code in this test migration?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I can't enter recordInvalidChecksums if I don't have this modification.

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.

ok, it seems that is another issue.

#7150 changes the thrown exception from InvalidRecordException to CorruptRecordException, and so LogValidator can't catch it to update recordInvalidChecksums. Let me file a Jira for it

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Got it, thanks.

}

@Test
public void testInvalidSequence() {
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.

nice one. could you please use EnumSource to rewrite it? for example:

    @ParameterizedTest
    @EnumSource(CompressionType.class)
    public void testInvalidSequenceV0(CompressionType type) {
        checkInvalidSequence(RecordBatch.MAGIC_VALUE_V0, type);
    }

    @ParameterizedTest
    @EnumSource(CompressionType.class)
    public void testInvalidSequenceV1(CompressionType type) {
        checkInvalidSequence(RecordBatch.MAGIC_VALUE_V2, type);
    }

    @ParameterizedTest
    @EnumSource(CompressionType.class)
    public void testInvalidSequenceV2(CompressionType type) {
        checkInvalidSequence(RecordBatch.MAGIC_VALUE_V2, type);
    }

Copy link
Copy Markdown
Collaborator Author

@TaiJuWu TaiJuWu Jul 9, 2024

Choose a reason for hiding this comment

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

Hi @chia7712 , Thanks for review and nice suggestions.
I rewrite this part, please take a look.

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@TaiJuWu thanks for your updates. There are many legacy style, and please update them by junit 5 style

@TaiJuWu
Copy link
Copy Markdown
Collaborator Author

TaiJuWu commented Jul 21, 2024

@TaiJuWu thanks for your updates. There are many legacy style, and please update them by junit 5 style

@chia7712 thanks for your review and comments, I try updating to juint5 already, hope I don't miss anything.

@chia7712
Copy link
Copy Markdown
Member

@TaiJuWu please fix the conflicts

@chia7712
Copy link
Copy Markdown
Member

@TaiJuWu please rebase code to fix build error

@TaiJuWu
Copy link
Copy Markdown
Collaborator Author

TaiJuWu commented Aug 11, 2024

@TaiJuWu please rebase code to fix build error

Done.

@chia7712
Copy link
Copy Markdown
Member

@TaiJuWu Could you please merge trunk to fix those known failed tests?

Copy link
Copy Markdown
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

LGTM

@chia7712 chia7712 merged commit 5b9cbcf into apache:trunk Aug 13, 2024
@TaiJuWu TaiJuWu deleted the KAFKA-16689 branch September 15, 2024 13:35
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