Debezium can fill a Postgres disk while Kafka Connect says the connector is running. We tested the fixes on Debezium 3.4.3. One popular fix breaks the next restart. Two others work.
Debezium says running while the disk fills
Your Debezium connector reports RUNNING. Its replication slot is
connected. Meanwhile, the slot holds more and more of the Postgres
write-ahead log (WAL), and the disk fills. No health check fails until
Postgres runs out of space. Zalando called this their
“single biggest operational issue”
with Debezium. Below, Control flags it on a connector that Kafka Connect
reports as healthy.

Why a quiet table fills the disk
Debezium reads Postgres through a replication slot. Postgres keeps all WAL after the last position Debezium confirmed. Debezium confirms a position only when a table it captures changes. WAL belongs to the whole server, so writes to every other table still add to it. When your captured tables go quiet and the rest of the database stays busy, Debezium confirms nothing, and the slot keeps every byte.
The usual fixes don’t work
The common advice is to turn on a
heartbeat.
A heartbeat alone changes nothing here: Debezium still has no change to
confirm. Debezium 3.4 added
lsn.flush.mode=connector_and_driver,
which confirms WAL during quiet periods. It stops the growth. Then, on the
next restart, the connector refuses to start: “this is no longer available
on the server”. In our test, that connector delivered 106,600 of 212,800
rows before it stopped. Debezium tracks related bugs in
#1605 and
#1863.

What we tested
We ran Postgres 16 and Debezium 3.4.3.Final, with four connectors side by
side. Each captured one table, items. Other writers kept the rest of the
server busy. We wrote to items for 5 minutes, stopped for 25 minutes,
restarted every connector by hand, and wrote to items for 10 more
minutes. Control watched all four slots:
| Connector | Settings | WAL held while items was quiet | Restart | Rows delivered |
|---|---|---|---|---|
| A | defaults, heartbeat | climbed to about 680 MB | ok | 212,800 of 212,800 |
| B | connector_and_driver, heartbeat | under 15 MB | failed | 106,600 of 212,800 |
| C | B, plus trust_slot | under 15 MB | ok | 212,800 of 212,800 |
| D | heartbeat that writes a captured table | 20 to 40 MB | ok | 212,800 of 212,800 |

What works
Two setups held WAL down, restarted cleanly and lost no rows. Setup C keeps
connector_and_driver and adds
offset.mismatch.strategy=trust_slot,
so the connector trusts the slot’s position on restart. Setup D adds a
small table to the connector and a
heartbeat query
that updates it, so the connector always has a change to confirm. A third
setup, a heartbeat that emits a logical message, from
Gunnar Morling’s guide to replication slots,
also works. It moves every slot on the database at once, though, so it can
hide a broken connector next to it.
"lsn.flush.mode": "connector_and_driver",
"heartbeat.interval.ms": "10000",
"offset.mismatch.strategy": "trust_slot"
One more trap: reusing a connector’s name
Kafka Connect keeps a deleted connector’s offsets. If you drop a slot and
create a new connector with the old name, the new connector starts from
the old offset. It fails with the same “no longer available” error. Give a
recreated connector a new name. In our test, only connector C, with
trust_slot, started under a reused name.
Watch the slot, not the connector
A connector’s status can mislead you. The connector says RUNNING while
the WAL fills the disk. The slot shows the failure. Watch four numbers: the WAL the slot holds, how far its consumer is behind,
whether a consumer is connected, and how fast the server writes WAL. A
healthy slot rises and drops at each flush. A stuck slot climbs in a
straight line while its consumer stays connected. Postgres reports the
first three in
pg_replication_slots,
and the write rate in
pg_stat_wal.
max_slot_wal_keep_size
caps how much WAL a slot can hold, at the cost of breaking the slot.

How Control catches it
Control watches both Postgres and the Debezium connector.
dbhealth reports each
slot on the server, and the
Kafka Connect reporter
reports each connector and its settings. Control matches them, so each
slot names the connector that holds it. When a connected consumer confirms
nothing while WAL grows, the holding_wal
verdict opens. Its page
shows what happened, the trend, the fix for that connector’s settings, and
links to the slot, connector and database. A
slot.bounded SLO
alerts before the disk fills.

Monitor Postgres and Debezium for free
Setup takes five minutes. Point
dbhealth at your
database, add the
Kafka Connect reporter
to your workers, and Control shows every slot, the connector that holds
it, and a verdict when a slot holds WAL that nothing will free.
Sign up free.