CleanerThread is a ShutdownableThread with the name of the format kafka-log-cleaner-thread- followed by the threadId.

CleanerThread is created and immediately started exclusively when LogCleaner is requested to start up.

The number of CleanerThreads (that LogCleaner uses) is controlled by log.cleaner.threads dynamic configuration (default: 1).

CleanerThread takes a threadId to be created.

CleanerThread uses a Cleaner.

CleanerThread uses kafka.log.LogCleaner logger.


Enable INFO logging level for kafka.log.LogCleaner logger to see what happens inside.

CleanerThread is a Java private inner class of LogCleaner. It can only be used by LogCleaner and have a direct access to the internals of the LogCleaner.

checkDone Internal Method

checkDone(topicPartition: TopicPartition): Unit


checkDone is used exclusively when CleanerThread is created (to create the Cleaner).

doWork Method

doWork(): Unit
doWork is part of the ShutdownableThread Contract to…​FIXME.


cleanFilthiestLog Internal Method

cleanFilthiestLog(): Boolean

cleanFilthiestLog requests the LogCleanerManager to grabFilthiestCompactedLog.

If there is any filthiest log to work on, cleanFilthiestLog cleanLog and turns the cleaned flag on.

With no logs to work on, cleanFilthiestLog simply turns the cleaned flag off.

The value of cleaned flag is what cleanFilthiestLog returns.

cleanFilthiestLog requests the LogCleanerManager for the deletable logs and then requests every Log to deleteOldSegments.

In the end, cleanFilthiestLog requests the LogCleanerManager to doneDeleting (with the TopicPartitions of the deletable logs).

In case of an exception, cleanFilthiestLog…​FIXME

cleanFilthiestLog is used exclusively when CleanerThread is requested to doWork.

cleanLog Internal Method

cleanLog(cleanable: LogToClean): Unit

cleanLog requests the Cleaner to clean the given LogToClean and recordStats.

In the end, cleanLog requests the LogCleanerManager to doneCleaning.

cleanLog is used exclusively when CleanerThread is requested to cleanFilthiestLog.

recordStats Internal Method

  id: Int,
  name: String,
  from: Long,
  to: Long,
  stats: CleanerStats): Unit


recordStats is used exclusively when CleanerThread is requested to cleanLog.

results matching ""

    No results matching ""