Skip to content
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

MINOR; Validate at least one control record #15912

Merged
merged 5 commits into from May 14, 2024

Conversation

jsancio
Copy link
Member

@jsancio jsancio commented May 9, 2024

Validate that a control batch in the batch accumulator has at least one control record.

Committer Checklist (excluded from commit message)

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

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@jsancio : Thanks for the PR. Just a minor comment.

* If this function returns true is means that one of the voter set commits an offset, it means
* that the other voter set cannot commit a conflicting offset.
* If this function returns true, it means that if one of the set of voters commits an offset, the
* the other set of voters cannot commit a conflicting offset.
Copy link
Contributor

Choose a reason for hiding this comment

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

the the other => the other

Copy link
Contributor

@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.

@jsancio nice cleanup. one small comment is left. PTAL

@@ -284,6 +284,8 @@ private int validateMemoryRecordAndReturnCount(MemoryRecords memoryRecord) {
);
} else if (numberOfRecords == null) {
throw new IllegalArgumentException("valueCreator didn't create a batch with the count");
} else if (numberOfRecords < 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to add new UT to BatchAccumulatorTest for this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the test.

@jsancio
Copy link
Member Author

jsancio commented May 10, 2024

@junrao @chia7712 thanks for the reviews. PR is ready for another round.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@jsancio : Thanks for the updated PR. Just a minor comment.

@@ -256,7 +256,7 @@ public void appendControlMessages(MemoryRecordsCreator valueCreator) {
}

private int validateMemoryRecordAndReturnCount(MemoryRecords memoryRecord) {
// Confirm that it is at most one batch and it is a control record
// Confirm that it is one control batch and it is at least one control record
Copy link
Contributor

Choose a reason for hiding this comment

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

validateMemoryRecordAndReturnCount => validateMemoryRecordsAndReturnCount
memoryRecord => memoryRecords
Also, there is an existing typo creatte on line 268.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@jsancio : Thanks for the updated PR. LGTM

Have all the test failures been triaged?

@jsancio
Copy link
Member Author

jsancio commented May 14, 2024

Merging. The errors are unrelated to this change.

@jsancio jsancio merged commit 440f5f6 into apache:trunk May 14, 2024
1 check failed
@jsancio jsancio deleted the minor-kafka-16207 branch May 14, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants