You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/05/22 14:38:10 UTC

[GitHub] [kafka] ijuma commented on a change in pull request #8714: MINOR: Improve broker registration and Log logging

ijuma commented on a change in pull request #8714:
URL: https://github.com/apache/kafka/pull/8714#discussion_r429285942



##########
File path: core/src/main/scala/kafka/log/Log.scala
##########
@@ -1694,9 +1694,10 @@ class Log(@volatile private var _dir: File,
   private def deleteOldSegments(predicate: (LogSegment, Option[LogSegment]) => Boolean, reason: String): Int = {
     lock synchronized {
       val deletable = deletableSegments(predicate)
-      if (deletable.nonEmpty)
+      if (deletable.nonEmpty) {
         info(s"Found deletable segments with base offsets [${deletable.map(_.baseOffset).mkString(",")}] due to $reason")
-      deleteSegments(deletable)
+        deleteSegments(deletable)
+      } else 0

Review comment:
       This doesn't change behavior, but makes the code a bit less weird. Previously, we would special case the log, but rely on the called method to check again if `deletable` is empty.




----------------------------------------------------------------
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:
users@infra.apache.org