Skip to content

Latest commit

 

History

History
74 lines (46 loc) · 3.15 KB

kafka-log-CleanerThread.adoc

File metadata and controls

74 lines (46 loc) · 3.15 KB

CleanerThread

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

CleanerThread and Cleaner

When created, CleanerThread creates a Cleaner (with the ID as the given threadId).

CleanerThread uses the Cleaner exclusively for cleaning up a log.

Cleaning Up Dirty Logs — doWork Method

doWork(): Unit
Note
doWork is part of the ShutdownableThread Contract to do the work.

doWork simply cleanFilthiestLog.

If there was no dirty log cleaned up, doWork pauses for the backOffMs (of the CleanerConfig of the parent LogCleaner) (default: 15 seconds).

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.

Note
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

Note
cleanFilthiestLog is used exclusively when CleanerThread is requested to doWork.

Cleaning Log — cleanLog Internal Method

cleanLog(cleanable: LogToClean): Unit

cleanLog requests the Cleaner to clean the given Log (as LogToClean) followed by recordStats.

In the end, cleanLog requests the LogCleanerManager to doneCleaning.

Note
cleanLog is used exclusively when CleanerThread is requested to cleanFilthiestLog.

recordStats Internal Method

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

recordStats…​FIXME

Note
recordStats is used exclusively when CleanerThread is requested to cleanLog.