Skip to content

KAFKA-19895: Retry log cleaning after topic config updates - #23305

Open
arnabnandy7 wants to merge 1 commit into
apache:trunkfrom
arnabnandy7:fix/logCleanerRecovery
Open

KAFKA-19895: Retry log cleaning after topic config updates#23305
arnabnandy7 wants to merge 1 commit into
apache:trunkfrom
arnabnandy7:fix/logCleanerRecovery

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Summary

KAFKA-19895: This change allows log cleaning to recover without a broker restart after a partition has been marked as uncleanable.

When an unexpected exception occurs during cleaning, Kafka marks the affected partition as uncleanable and excludes it from subsequent compaction and deletion passes. This state is retained in memory, so updating the topic’s cleanup or retention configuration does not currently retry the partition. This can cause affected partitions, including __consumer_offsets partitions, to grow indefinitely until the broker is restarted.

Changes

  • Clear the uncleanable state for a topic’s local partitions when its configuration is updated.
  • Allow the log cleaner to retry those partitions after the underlying problem has been addressed.
  • Preserve the uncleanable state of unrelated partitions.
  • Document the uncleanable-bytes metric and recovery procedure.

Testing

Added unit coverage to verify that:

  • Clearing one uncleanable partition does not affect other quarantined partitions.
  • Updating a topic configuration clears the uncleanable state.

Tests commands:

./gradlew storage:test --tests org.apache.kafka.storage.internals.log.LogCleanerManagerTest
./gradlew storage:test --tests org.apache.kafka.storage.internals.log.LogManagerTest.testTopicConfigChangeRetriesUncleanablePartitions
./gradlew storage:checkstyleMain storage:checkstyleTest spotlessCheck

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@github-actions github-actions Bot added triage PRs from the community storage Pull requests that target the storage module small Small PRs labels Aug 29, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-attention small Small PRs storage Pull requests that target the storage module triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant