junrao commented on code in PR #15948:
URL: https://github.com/apache/kafka/pull/15948#discussion_r1600406699


##########
core/src/test/scala/unit/kafka/log/LogValidatorTest.scala:
##########
@@ -497,9 +497,11 @@ class LogValidatorTest {
     assertEquals(now + 1, validatingResults.maxTimestampMs,
       s"Max timestamp should be ${now + 1}")
 
-    // Both V2 and V1 has single branch in the record when compression is 
enable, and hence their shallow OffsetOfMaxTimestamp
-    // is the last offset of the single branch
-    assertEquals(1, records.batches().asScala.size)
+    // V2 has single batch, and other versions has many single-record batches
+    assertEquals(if (magic >= RecordBatch.MAGIC_VALUE_V2) 1 else 3, 
records.batches().asScala.size)
+    // Both V2 and V1 has single batch in the record when compression is 
enable, and hence their shallow OffsetOfMaxTimestamp

Review Comment:
   in the record => in the validated records



##########
core/src/test/scala/unit/kafka/log/LogValidatorTest.scala:
##########
@@ -497,9 +497,11 @@ class LogValidatorTest {
     assertEquals(now + 1, validatingResults.maxTimestampMs,
       s"Max timestamp should be ${now + 1}")
 
-    // Both V2 and V1 has single branch in the record when compression is 
enable, and hence their shallow OffsetOfMaxTimestamp
-    // is the last offset of the single branch
-    assertEquals(1, records.batches().asScala.size)
+    // V2 has single batch, and other versions has many single-record batches
+    assertEquals(if (magic >= RecordBatch.MAGIC_VALUE_V2) 1 else 3, 
records.batches().asScala.size)

Review Comment:
   Should we move this assert to immediate after records is created?



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

Reply via email to