kafka报cleaning is aborted and paused

無名 发表于: 2021-08-31   最后更新时间: 2021-09-06 19:36:56   1,068 游览

我查看了其中一个kafka broker的log-cleaner.log,观察到的信息是:

[2019-12-16 08:45:25,443] INFO The cleaning for partition test1-0 is aborted and paused (kafka.log.LogCleaner)
[2019-12-16 08:45:25,444] INFO The cleaning for partition reddyvel-test1-0 is aborted (kafka.log.LogCleaner).

这是什么意思,为什么该分区的清理被中止了?

发表于 2021-08-31

这个消息来自Kafka的LogCleaner组件。

cleaner负责从应用了"compact"保留策略的日志中删除过时的记录。

两者之间的区别是:

abortAndPauseCleaning:

Abort the cleaning of a particular partition if it's in progress, and pause any future cleaning of this partition. This call blocks until the cleaning of the partition is aborted and paused.
 1. If the partition is not in progress, mark it as paused.
 2. Otherwise, first mark the state of the partition as aborted.
 3. The cleaner thread checks the state periodically and if it sees the state of the partition is aborted, it throws a LogCleaningAbortedException to stop the cleaning task.
 4. When the cleaning task is stopped, doneCleaning() is called, which sets the state of the partition as paused.
 5. abortAndPauseCleaning() waits until the state of the partition is changed to paused.
 6. If the partition is already paused, a new call to this function will increase the paused count by one.

翻译:

如果某个分区的清理正在进行中,则中止该分区的清理,并暂停该分区的任何之后的清理。 这个调用会阻塞,直到该分区的清理被中止和暂停。
 1. 如果该分区没有在进行中,把它标记为暂停。
 2. 否则,首先将该分区的状态标记为中止。
 3. 清洁器线程定期检查状态,如果它看到分区的状态被中止,就会抛出一个LogCleaningAbortedException来停止清洁任务。
 4. 当清洁任务停止时,调用 doneCleaning(),将分区的状态设置为暂停。
 5. abortAndPauseCleaning()等待,直到分区的状态被改变为暂停。
 6. 如果分区已经暂停,对这个函数的新调用将使暂停的数量增加一个。

abortCleaning:

如果某个分区的清理工作正在进行中,则中止该分区的清理。这个调用会阻塞,直到该分区的清理被中止。

这是通过首先中止和暂停,然后恢复分区的清理来实现的。
無名 -> 半兽人 2年前

为什么分区清理首先会被中止?

半兽人 -> 無名 2年前

会恢复的,但是如果想知道清理被中止详细情况。

你可以通过在DEBUG级别启用kafka.log.LogCleanerkafka.log.Cleanerkafka.log.LogCleanerManager日志记录器来调试它,将输出这些线程的状态信息。这将包括每个正在压缩的分区的信息,包括每个分区的大小和消息的数量。

你的答案

查看kafka相关的其他问题或提一个您自己的问题