Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: pg plugin replication slots and publications are not cleaned after teardown #165

Closed
lyuboxa opened this issue Feb 3, 2022 · 2 comments · Fixed by ConduitIO/conduit-connector-postgres#14
Assignees
Labels
bug Something isn't working plugin:postgres Related to Postgres connector plugin
Milestone

Comments

@lyuboxa
Copy link
Contributor

lyuboxa commented Feb 3, 2022

Bug description

Source connectors with cdc enabled should drop the replication slots after they are deleted.
When the slots are left to linger they can cause accumulation of WAL and cause the database to shutdown when the disk fills up.

Steps to reproduce

Setup

CREATE TABLE test (id bigserial primary key, data varchar(100));
INSERT INTO test (data) SELECT generate_series(1,20);

Reproduce

  1. Create Pipeline
  2. Create CDC source connector on pipeline with config
"table": "test"
"cdc": "true"
"url": "url"
"publication_name":"test_pub"
"slot_name":"test_slot"
  1. Create File destination connector on pipeline with config
"path":"/tmp/test-output"
  1. Start pipeline
  2. Verify data in file /tmp/test-output
  3. Stop pipeline
  4. Delete connectors
  5. Delete pipeline
  6. Run following queries on the target database
SELECT * FROM pg_replication_slots;
SELECT * FROM pg_publication;
  1. slot test_slot and publication test_pub should not be in the list

Version

v0.1.1-13-gef4f71b linux/amd64

@lyuboxa lyuboxa added bug Something isn't working triage Needs to be triaged labels Feb 3, 2022
@hariso hariso added the plugin:postgres Related to Postgres connector plugin label Feb 3, 2022
@neovintage neovintage removed the triage Needs to be triaged label Feb 3, 2022
@neovintage neovintage added this to the v0.2.0 milestone Feb 3, 2022
@neovintage
Copy link
Contributor

Note: STOP is an asynchronous action. We should make STOP idempodent.

@lovromazgon
Copy link
Member

Here's what the connector will do after we merge ConduitIO/conduit-connector-postgres#13:

  • If the logical replication slot and publication don't exist, the connector will create them on pipeline start and will drop them on pipeline stop. In this case it can't be guaranteed that the pipeline will be able to start again at the same position it left off because the WAL logs could be purged.
  • If the logical replication slot or publication already exist, the connector assumes they are managed externally so it will use them and not delete them when the pipeline stops. This also ensures that Conduit will be able to start again at the same position it left off, but there is a risk of accumulating a lot of WAL if the pipeline stops running and is not resumed in a timely fashion.

Note to self: add this to docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin:postgres Related to Postgres connector plugin
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants