Embedded Debezium WAL piling up restart_lsn not moving

249 Views Asked by At

So we are using debezium in our spring boot application. And while the messages are getting consumed, the restart_lsn is not moving and the replication slot lag is increasing.

postgres=# SELECT
    slot_name,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)) AS replicationSlotLag,
    active
FROM
    pg_replication_slots;
 slot_name | replicationslotlag | active 
-----------+--------------------+--------
 debezium  | 279 MB             | f
(1 row)

postgres=# select * from pg_replication_slots ;        
 slot_name |  plugin  | slot_type | datoid |       database        | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn | wal_status | safe_wal_size | two_phase 
-----------+----------+-----------+--------+-----------------------+-----------+--------+------------+------+--------------+-------------+---------------------+------------+---------------+-----------
 debezium  | pgoutput | logical   |  16385 | moc_development_local | f         | f      |            |      |         5725 | 0/30EB20D0  | 0/30EB2108          | reserved   |               | f
(1 row)

We restarted the application multiple times, the same changs were read many times. And the changes are definitely there in the table being tracked itself, this is local system testing hence there is nothing else going on. Also the connector snapshot.mode = never

1

There are 1 best solutions below

0
Ankit Raonka On

You can see pg_replication_slots->active as false. That means your debezium client is not connected to the replication slot.

You need to check the error you are getting on connection.

Alternatively you u can drop the replicaton_slot and restart the Kafka connector task, which will create the slot again