Skip to content

refactor: use upstream UnifiedLog analyzeAndValidateRecords [INK-127] #221

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jeqo
Copy link
Contributor

@jeqo jeqo commented Mar 14, 2025

Now that analyzeAndValidateRecords is available on UnifiedLog.java make use of it by tweaking the access to the method.

@jeqo jeqo marked this pull request as ready for review March 14, 2025 11:50
@jeqo jeqo requested a review from gharris1727 March 14, 2025 11:50
@@ -1441,7 +1446,7 @@ private LogAppendInfo analyzeAndValidateRecords(MemoryRecords records,
}
// we only validate V2 and higher to avoid potential compatibility issues with older clients
if (batch.magic() >= RecordBatch.MAGIC_VALUE_V2 && origin == AppendOrigin.CLIENT && batch.baseOffset() != 0) {
throw new InvalidRecordException("The baseOffset of the record batch in the append to " + topicPartition() + " should " +
throw new InvalidRecordException("The baseOffset of the record batch in the append to " + topicPartition + " should " +
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: do you think we can make a tiny upstream change to add TopicPartition topicPartition = this.topicPartition(); or something similar, so that only the method signatures conflict?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about something like: 13d2055

I wonder how to "sell" it. I guess we could say that as topicPartition is stable for a unified log, there is no need to depend on localLog reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gharris1727 I opened apache/kafka#19253 as draft. Lmk if looks good, and can open it for review

@jeqo jeqo force-pushed the jeqo/INK-127-adopt-upstream branch from 54804c0 to 6e35dc9 Compare March 15, 2025 08:25
Now that analyzeAndValidateRecords is available on UnifiedLog.java make
use of it by tweaking the access to the method.
@jeqo jeqo force-pushed the jeqo/INK-127-adopt-upstream branch from 6e35dc9 to 198e17d Compare March 15, 2025 08:28
@jeqo jeqo marked this pull request as draft April 28, 2025 19:24
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