Skip to content

MINOR: Add Append KRaft Version Record to BatchAccumulator #18956

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

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

nihyxx
Copy link

@nihyxx nihyxx commented Feb 18, 2025

What

This minor PR adds a function to append the KRaft Version Record in BatchAccumulator. This is needed to implement KRaft upgrade (https://issues.apache.org/jira/browse/KAFKA-16538).

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.

Committer Checklist (excluded from commit message)

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

@github-actions github-actions bot added triage PRs from the community kraft small Small PRs labels Feb 18, 2025
Copy link
Member

@jsancio jsancio left a comment

Choose a reason for hiding this comment

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

Thanks for the changes @nihyxx. Just some minor comments.

Comment on lines 365 to 368
public void appendKRaftVersionRecord(
KRaftVersionRecord kraftVersionRecord,
long currentTimestamp
) {
Copy link
Member

Choose a reason for hiding this comment

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

We indent by 4 spaces in Java code.

    public void appendKRaftVersionRecord(
        KRaftVersionRecord kraftVersionRecord,
        long currentTimestamp
    ) {

Comment on lines 369 to 377
appendControlMessages((baseOffset, epoch, compression, buffer) ->
MemoryRecords.withKRaftVersionRecord(
baseOffset,
currentTimestamp,
epoch,
buffer,
kraftVersionRecord
)
);
Copy link
Member

Choose a reason for hiding this comment

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

We indent by 4 spaces in Java code.

        appendControlMessages((baseOffset, epoch, compression, buffer) ->
            MemoryRecords.withKRaftVersionRecord(
                baseOffset,
                currentTimestamp,
                epoch,
                buffer,
                kraftVersionRecord
            )
        );

Comment on lines 113 to 121
Mockito.when(memoryPool.tryAllocate(maxBatchSize))
.thenReturn(buffer);

BatchAccumulator<String> acc = buildAccumulator(
leaderEpoch,
baseOffset,
lingerMs,
maxBatchSize
);
Copy link
Member

Choose a reason for hiding this comment

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

We indent by 4 spaces in Java code.

        Mockito.when(memoryPool.tryAllocate(maxBatchSize))
            .thenReturn(buffer);

        BatchAccumulator<String> acc = buildAccumulator(
            leaderEpoch,
            baseOffset,
            lingerMs,
            maxBatchSize
        );

@github-actions github-actions bot removed small Small PRs triage PRs from the community labels Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants