canonical / canonical/postgresql-operator
Logical replication creates infinite loop of inserts
- Dominant language
- Python
- Stars
- 20
- Forks
- 36
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 30
Description
## Steps to reproduce
1. juju deploy postgresql --channel 16/edge postgresql1
2. juju deploy postgresql --channel 16/edge postgresql2
3. juju deploy data-integrator di1 --config database-name=testdb
4. juju deploy data-integrator di2 --config database-name=testdb
5. juju integrate postgresql1 di1
6. juju integrate postgresql2 di2
7. juju integrate postgresql1:logical-replication-offer postgresql2:logical-replication
8. juju integrate postgresql1:logical-replication postgresql2:logical-replication-offer
9. juju run di1/leader get-credentials
10. psql `PSQL URI FROM ABOVE`
11. create table asd (message int);\q
12. juju run di2/leader get-credentials
13. psql `PSQL URI FROM ABOVE`
14. create table asd (message int);\q
15. juju config postgresql1 logical_replication_subscription_request='{"testdb": ["public.asd"]}'
16. juju config postgresql2 logical_replication_subscription_request='{"testdb": ["public.asd"]}'
## Expected behavior
A blocked status message telling that the same table cannot be defined on both sides of the relation for the logical replication.
## Actual behavior
An infinite loop of inserts happens due to the cyclic replication that was configured by configuring the same table on both sides of the relation.
## Versions
Operating system: Ubuntu 24.04
Juju CLI: 3.6.8
Juju agent: 3.6.8
Charm revision: 867
LXD: 5.21/stable
## Log output
Juju debug log: no relevant logs.
## Additional context
The table needs to be empty in both clusters; otherwise, the charm will properly set a blocked status indicating the table is not empty in one of the clusters.
Contributor guide
Research direction
Reproduce the cycle using the listed Juju deployment and integration steps, then apply the subscription configuration on both sides. Trace how the charm handles identical empty tables across the two logical-replication relations. Done means the application reports a blocked status explaining that the table cannot be defined on both sides, with no infinite insert loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100