Postgres connector does not disconnect when stopped [DBZ-758]
- Dominant language
- HTML
- Stars
- 6
- Forks
- 8
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 1
Description
Migrated from [DBZ-758](https://issues.redhat.com/browse/DBZ-758)
We are using debezium to stream data from a postgres table.
When the kafka-connect cluster rebalances, the task is stopped (we see "Stopping task -0" in the logs), but the replication slot is still marked as active. Because of this, when the new task is created on a new host, we see the error:
{{A logical replication slot named 'debezium_stream' for plugin 'decoderbufs' and database is already active on the server.You cannot have multiple slots with the same name active for the same database (io.debezium.connector.postgresql.connection.PostgresReplicationConnection:104)}}
This lasts for roughly 15 minutes, at which point the replication slot is finally marked as inactive, and the new task connects to it next time it retries.
There is nothing in the kafka-connect logs indicating that there was an error disconnecting.
Contributor guide
Research direction
Start with the PostgreSQL connector task stop path and the PostgresReplicationConnection entry point named in the error, then reproduce a Kafka Connect rebalance. Done means the replication slot becomes inactive promptly when the task stops and the replacement task can reconnect without waiting or encountering the active-slot error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100