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

KAFKA-15435 Fix counts in MigrationManifest #14342

Merged
merged 2 commits into from Sep 6, 2023

Conversation

mumrah
Copy link
Contributor

@mumrah mumrah commented Sep 5, 2023

This patch fixes an issue in MigrationManifest where we weren't computing the record counts properly. A unit test was added to verify the fix.

This patch also changes the counters in MigrationManifest to use an ordered map so we'll get deterministic output.

@mumrah mumrah added the kraft label Sep 5, 2023
@@ -60,7 +61,8 @@ public MigrationManifest build() {
if (endTimeNanos == 0) {
endTimeNanos = time.nanoseconds();
}
return new MigrationManifest(total, batches, endTimeNanos - startTimeNanos, counts);
Map<MetadataRecordType, Integer> orderedCounts = new TreeMap<>(counts);
Copy link

Choose a reason for hiding this comment

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

qq: why we need a treemap here? Is the sorted order help here?

Copy link
Contributor Author

@mumrah mumrah Sep 5, 2023

Choose a reason for hiding this comment

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

Putting into a treemap will order the map according to the keys. The effect of this is that the log message becomes deterministic, which is useful for testing. It's arguably also a bit nicer for end users if the output of the message is consistent.

Copy link
Contributor

@cmccabe cmccabe left a comment

Choose a reason for hiding this comment

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

LGTM

@mumrah
Copy link
Contributor Author

mumrah commented Sep 6, 2023

Here are the test failures from Jenkins

image

They are all unrelated to migrations, so going ahead and merging this one.

@mumrah mumrah merged commit 65e2ecf into apache:trunk Sep 6, 2023
1 check failed
mumrah added a commit that referenced this pull request Sep 8, 2023
Reviewers: Liu Zeyu <zeyu.luke@gmail.com>, Colin P. McCabe <cmccabe@apache.org>
mjsax pushed a commit to confluentinc/kafka that referenced this pull request Nov 22, 2023
Reviewers: Liu Zeyu <zeyu.luke@gmail.com>, Colin P. McCabe <cmccabe@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants