You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "lanshiqin (via GitHub)" <gi...@apache.org> on 2023/04/18 08:48:44 UTC

[GitHub] [kafka] lanshiqin commented on a diff in pull request #13584: MINOR: Add log segment unit tests, If the maximum offset beyond index, appen…

lanshiqin commented on code in PR #13584:
URL: https://github.com/apache/kafka/pull/13584#discussion_r1169710407


##########
core/src/test/scala/unit/kafka/log/LogSegmentTest.scala:
##########
@@ -65,6 +66,21 @@ class LogSegmentTest {
     Utils.delete(logDir)
   }
 
+  /**
+   * If the maximum offset beyond index, appended to the log section, it throws LogSegmentOffsetOverflowException
+   */
+  @Test
+  def testAppendForLogSegmentOffsetOverflowException(): Unit = {
+    val seg = createSegment(0)
+    val largestOffset: Long = Integer.MAX_VALUE + 1
+    val largestTimestamp: Long = Time.SYSTEM.milliseconds()
+    val shallowOffsetOfMaxTimestamp: Long = 0
+    val memoryRecords: MemoryRecords = records(0, "hello")
+    assertThrows(classOf[LogSegmentOffsetOverflowException], () => {
+      seg.append(largestOffset, largestTimestamp, shallowOffsetOfMaxTimestamp, memoryRecords)

Review Comment:
   Thanks, I should have changed the variable name to the 'currentTime'



-- 
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-unsubscribe@kafka.apache.org

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