kafka
kafka copied to clipboard
KAFKA-17026: Implement updateCacheAndOffsets functionality on LSO movement
About
Implemented the functionality which takes care of archiving the records when LSO moves past them. Implemented the following functions -
-
updateCacheAndOffsets- Updates the cached state, start and end offsets of the share partition as per the new log start offset. The method is called when the log start offset is moved for the share partition. -
archiveAvailableRecordsOnLsoMovement- This function archives all the available records when they are behind the LSO. -
archivePerOffsetBatchRecords- It archives all the available records in the per offset tracked batch passed to this function. -
archiveCompleteBatch- It archives all the available records of the complete batch passed to this function.
Testing
The added functionality has been tested with unit tests.
Suppression
In order for build to pass, I had to add JavaNCSS suppression for SharePartitionTest. It takes into account the total lines of non-commented source code. Agreed, that we can optimize the current SharePartitionTest code at a few places, however, when we add new test cases, we will again breach this limit which is currently set at 1500. Hence, adding the suppression made sense to me.