kowshik commented on a change in pull request #10280:
URL: https://github.com/apache/kafka/pull/10280#discussion_r602062784
##########
File path: core/src/main/scala/kafka/log/Log.scala
##########
@@ -1816,8 +1292,12 @@ class Log(@volatile private var _dir: File,
*/
private def deleteOldSegments(predicate: (LogSegment, Option[LogSegment]) =>
Boolean,
reason: SegmentDeletionReason): Int = {
+ def shouldDelete(segment: LogSegment, nextSegmentOpt: Option[LogSegment],
logEndOffset: Long): Boolean = {
+ highWatermark >=
nextSegmentOpt.map(_.baseOffset).getOrElse(logEndOffset) &&
Review comment:
this is to accomodate for the hwm check that was previously happening in
`Log#deletableSegments` in this
[line](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/log/Log.scala#L1872).
The `deletableSegments` method has now moved to `LocalLog`, so we piggyback on
the predicate to additionally attach the hwm check.
##########
File path: core/src/main/scala/kafka/log/Log.scala
##########
@@ -1816,8 +1292,12 @@ class Log(@volatile private var _dir: File,
*/
private def deleteOldSegments(predicate: (LogSegment, Option[LogSegment]) =>
Boolean,
reason: SegmentDeletionReason): Int = {
+ def shouldDelete(segment: LogSegment, nextSegmentOpt: Option[LogSegment],
logEndOffset: Long): Boolean = {
+ highWatermark >=
nextSegmentOpt.map(_.baseOffset).getOrElse(logEndOffset) &&
Review comment:
This is to accomodate for the hwm check that was previously happening in
`Log#deletableSegments` in this
[line](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/log/Log.scala#L1872).
The `deletableSegments` method has now moved to `LocalLog`, so we piggyback on
the predicate to additionally attach the hwm check.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]