[GitHub] [kafka] mumrah commented on a diff in pull request #14342: KAFKA-15435 Fix counts in MigrationManifest

2023-09-05 Thread via GitHub


mumrah commented on code in PR #14342:
URL: https://github.com/apache/kafka/pull/14342#discussion_r1316249748


##
metadata/src/main/java/org/apache/kafka/metadata/migration/MigrationManifest.java:
##
@@ -60,7 +61,8 @@ public MigrationManifest build() {
 if (endTimeNanos == 0) {
 endTimeNanos = time.nanoseconds();
 }
-return new MigrationManifest(total, batches, endTimeNanos - 
startTimeNanos, counts);
+Map orderedCounts = new 
TreeMap<>(counts);

Review Comment:
   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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [kafka] mumrah commented on a diff in pull request #14342: KAFKA-15435 Fix counts in MigrationManifest

2023-09-05 Thread via GitHub


mumrah commented on code in PR #14342:
URL: https://github.com/apache/kafka/pull/14342#discussion_r1316249748


##
metadata/src/main/java/org/apache/kafka/metadata/migration/MigrationManifest.java:
##
@@ -60,7 +61,8 @@ public MigrationManifest build() {
 if (endTimeNanos == 0) {
 endTimeNanos = time.nanoseconds();
 }
-return new MigrationManifest(total, batches, endTimeNanos - 
startTimeNanos, counts);
+Map orderedCounts = new 
TreeMap<>(counts);

Review Comment:
   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.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org