Class FileRecordsTest

java.lang.Object
org.apache.kafka.common.record.internal.FileRecordsTest

public class FileRecordsTest extends Object
  • Constructor Details

    • FileRecordsTest

      public FileRecordsTest()
  • Method Details

    • setup

      @BeforeEach public void setup() throws IOException
      Throws:
      IOException
    • cleanup

      @AfterEach public void cleanup() throws IOException
      Throws:
      IOException
    • testAppendProtectsFromOverflow

      @Test public void testAppendProtectsFromOverflow() throws Exception
      Throws:
      Exception
    • testOpenOversizeFile

      @Test public void testOpenOversizeFile() throws Exception
      Throws:
      Exception
    • testOutOfRangeSlice

      @Test public void testOutOfRangeSlice()
    • testFileSize

      @Test public void testFileSize() throws IOException
      Test that the cached size variable matches the actual file size as we append messages
      Throws:
      IOException
    • testIterationOverPartialAndTruncation

      @Test public void testIterationOverPartialAndTruncation() throws IOException
      Test that adding invalid bytes to the end of the log doesn't break iteration
      Throws:
      IOException
    • testSliceSizeLimitWithConcurrentWrite

      @Test public void testSliceSizeLimitWithConcurrentWrite() throws Exception
      Throws:
      Exception
    • testIterationDoesntChangePosition

      @Test public void testIterationDoesntChangePosition() throws IOException
      Iterating over the file does file reads but shouldn't change the position of the underlying FileChannel.
      Throws:
      IOException
    • testRead

      @Test public void testRead()
      Test a simple append and read.
    • testReadIntoStopsAtEndOfSlice

      @Test public void testReadIntoStopsAtEndOfSlice() throws IOException
      Throws:
      IOException
    • testReadIntoStopsAtEndOfRecords

      @ParameterizedTest @ValueSource(booleans={true,false}) public void testReadIntoStopsAtEndOfRecords(boolean preallocate) throws IOException
      Throws:
      IOException
    • testReadIntoAtEndOfRecordsReadsNothing

      @Test public void testReadIntoAtEndOfRecordsReadsNothing() throws IOException
      Throws:
      IOException
    • testReadIntoWithPositionOutsideRecords

      @Test public void testReadIntoWithPositionOutsideRecords()
    • testSearch

      @Test public void testSearch() throws IOException
      Test the MessageSet.searchFor API.
      Throws:
      IOException
    • testIteratorWithLimits

      @Test public void testIteratorWithLimits()
      Test that the message set iterator obeys start and end slicing
    • testTruncate

      @Test public void testTruncate() throws IOException
      Test the truncateTo method lops off messages and appropriately updates the size
      Throws:
      IOException
    • testTruncateNotCalledIfSizeIsSameAsTargetSize

      @Test public void testTruncateNotCalledIfSizeIsSameAsTargetSize() throws IOException
      Test that truncateTo only calls truncate on the FileChannel if the size of the FileChannel is bigger than the target size. This is important because some JVMs change the mtime of the file, even if truncate should do nothing.
      Throws:
      IOException
    • testTruncateNotCalledIfSizeIsBiggerThanTargetSize

      @Test public void testTruncateNotCalledIfSizeIsBiggerThanTargetSize() throws IOException
      Expect a KafkaException if targetSize is bigger than the size of the FileRecords.
      Throws:
      IOException
    • testTruncateIfSizeIsDifferentToTargetSize

      @Test public void testTruncateIfSizeIsDifferentToTargetSize() throws IOException
      see #testTruncateNotCalledIfSizeIsSameAsTargetSize
      Throws:
      IOException
    • testPreallocateTrue

      @Test public void testPreallocateTrue() throws IOException
      Test the new FileRecords with pre allocate as true
      Throws:
      IOException
    • testPreallocateFalse

      @Test public void testPreallocateFalse() throws IOException
      Test the new FileRecords with pre allocate as false
      Throws:
      IOException
    • testPreallocateClearShutdown

      @Test public void testPreallocateClearShutdown() throws IOException
      Test the new FileRecords with pre allocate as true and file has been clearly shut down, the file will be truncate to end of valid data.
      Throws:
      IOException
    • testFormatConversionWithPartialMessage

      @Test public void testFormatConversionWithPartialMessage() throws IOException
      Throws:
      IOException
    • testFormatConversionWithNoMessages

      @Test public void testFormatConversionWithNoMessages()
    • testSearchForTimestamp

      @Test public void testSearchForTimestamp() throws IOException
      Throws:
      IOException
    • testSearchForTimestampWithCompressedBatch

      @Test public void testSearchForTimestampWithCompressedBatch() throws IOException
      Throws:
      IOException
    • testSliceForAlreadySlicedFileRecords

      @Test public void testSliceForAlreadySlicedFileRecords() throws IOException
      Test slice when already sliced file records have start position greater than available bytes in the file records.
      Throws:
      IOException
    • testDownconversionAfterMessageFormatDowngrade

      @Test public void testDownconversionAfterMessageFormatDowngrade() throws IOException
      Throws:
      IOException
    • testConversion

      @Test public void testConversion() throws IOException
      Throws:
      IOException
    • testNonEmptyFileAlreadyExists

      @Test public void testNonEmptyFileAlreadyExists() throws IOException
      Throws:
      IOException
    • testEmptyFileAlreadyExists

      @Test public void testEmptyFileAlreadyExists() throws IOException
      Throws:
      IOException
    • testBytesLengthOfWriteTo

      @Test public void testBytesLengthOfWriteTo() throws IOException
      Throws:
      IOException
    • testTransferTotalTime

      @Test public void testTransferTotalTime() throws IOException
      Throws:
      IOException
    • testSearchForTimestampRejectsCompressedRecordExceedingMaxRecordBodySize

      @Test public void testSearchForTimestampRejectsCompressedRecordExceedingMaxRecordBodySize() throws IOException
      Throws:
      IOException