Class FileRecordsTest
java.lang.Object
org.apache.kafka.common.record.internal.FileRecordsTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()voidsetup()voidvoidvoidvoidvoidvoidTest that the cached size variable matches the actual file size as we append messagesvoidvoidvoidIterating over the file does file reads but shouldn't change the position of the underlying FileChannel.voidTest that adding invalid bytes to the end of the log doesn't break iterationvoidTest that the message set iterator obeys start and end slicingvoidvoidvoidvoidTest 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.voidTest the new FileRecords with pre allocate as falsevoidTest the new FileRecords with pre allocate as truevoidtestRead()Test a simple append and read.voidvoidtestReadIntoStopsAtEndOfRecords(boolean preallocate) voidvoidvoidTest the MessageSet.searchFor API.voidvoidvoidvoidTest slice when already sliced file records have start position greater than available bytes in the file records.voidvoidvoidTest the truncateTo method lops off messages and appropriately updates the sizevoidsee #testTruncateNotCalledIfSizeIsSameAsTargetSizevoidExpect a KafkaException if targetSize is bigger than the size of the FileRecords.voidTest that truncateTo only calls truncate on the FileChannel if the size of the FileChannel is bigger than the target size.
-
Constructor Details
-
FileRecordsTest
public FileRecordsTest()
-
-
Method Details
-
setup
- Throws:
IOException
-
cleanup
- Throws:
IOException
-
testAppendProtectsFromOverflow
-
testOpenOversizeFile
-
testOutOfRangeSlice
@Test public void testOutOfRangeSlice() -
testFileSize
Test that the cached size variable matches the actual file size as we append messages- Throws:
IOException
-
testIterationOverPartialAndTruncation
Test that adding invalid bytes to the end of the log doesn't break iteration- Throws:
IOException
-
testSliceSizeLimitWithConcurrentWrite
-
testIterationDoesntChangePosition
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
- Throws:
IOException
-
testReadIntoStopsAtEndOfRecords
@ParameterizedTest @ValueSource(booleans={true,false}) public void testReadIntoStopsAtEndOfRecords(boolean preallocate) throws IOException - Throws:
IOException
-
testReadIntoAtEndOfRecordsReadsNothing
- Throws:
IOException
-
testReadIntoWithPositionOutsideRecords
@Test public void testReadIntoWithPositionOutsideRecords() -
testSearch
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 the truncateTo method lops off messages and appropriately updates the size- Throws:
IOException
-
testTruncateNotCalledIfSizeIsSameAsTargetSize
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
Expect a KafkaException if targetSize is bigger than the size of the FileRecords.- Throws:
IOException
-
testTruncateIfSizeIsDifferentToTargetSize
see #testTruncateNotCalledIfSizeIsSameAsTargetSize- Throws:
IOException
-
testPreallocateTrue
Test the new FileRecords with pre allocate as true- Throws:
IOException
-
testPreallocateFalse
Test the new FileRecords with pre allocate as false- Throws:
IOException
-
testPreallocateClearShutdown
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
- Throws:
IOException
-
testFormatConversionWithNoMessages
@Test public void testFormatConversionWithNoMessages() -
testSearchForTimestamp
- Throws:
IOException
-
testSearchForTimestampWithCompressedBatch
- Throws:
IOException
-
testSliceForAlreadySlicedFileRecords
Test slice when already sliced file records have start position greater than available bytes in the file records.- Throws:
IOException
-
testDownconversionAfterMessageFormatDowngrade
- Throws:
IOException
-
testConversion
- Throws:
IOException
-
testNonEmptyFileAlreadyExists
- Throws:
IOException
-
testEmptyFileAlreadyExists
- Throws:
IOException
-
testBytesLengthOfWriteTo
- Throws:
IOException
-
testTransferTotalTime
- Throws:
IOException
-
testSearchForTimestampRejectsCompressedRecordExceedingMaxRecordBodySize
@Test public void testSearchForTimestampRejectsCompressedRecordExceedingMaxRecordBodySize() throws IOException- Throws:
IOException
-