conduktor.io ↗

Compacted Topics Need Explicit delete.retention.ms

Compacted topics must define delete.retention.ms in [1h, 30d].

Rationale

On compacted topics, tombstones (null-value records) survive for `delete.retention.ms` before they are physically removed. The default 86400000ms (24h) breaks consumers that fall behind for more than a day: they miss the delete and end up with ghost keys. Force teams to set this consciously.

Pattern

cleanup.policy contains "compact" → delete.retention.ms in [3600000, 2592000000]

Examples

cleanup.policy=compact + delete.retention.ms=604800000 (7d)
cleanup.policy=compact + delete.retention.ms unset
cleanup.policy=compact + delete.retention.ms=60000 (1min)

Parameters

NameDefaultDescription
min_ms 3600000 Minimum delete.retention.ms (1 hour).
max_ms 2592000000 Maximum delete.retention.ms (30 days).

Governs

This policy relates to the following Kafka configuration keys:

Implementation

Drop this YAML into Conduktor Console as a ResourcePolicy, then link it from an ApplicationInstance, Application, or KafkaCluster.

Conduktor ResourcePolicy
# Conduktor self-service ResourcePolicy
---
apiVersion: self-serve/v1
kind: ResourcePolicy
metadata:
  name: compact-topic-requires-tombstone-retention
spec:
  targetKind: Topic
  description: compacted topics must declare delete.retention.ms in [1h, 30d]
  rules:
    - condition: '!("cleanup.policy" in spec.configs) || !spec.configs["cleanup.policy"].contains("compact") || ("delete.retention.ms" in spec.configs && int(string(spec.configs["delete.retention.ms"])) >= 3600000 && int(string(spec.configs["delete.retention.ms"])) <= 2592000000)'
      errorMessage: "compacted topics must declare delete.retention.ms in [1h, 30d] — default 24h often breaks slow consumers"

Try Conduktor Console

Enforce policies like this across your team — central audit history, pre-commit guardrails, ApplicationInstance bindings. 5-min Docker install.

Get Started →