Skip to content

Logical Replication #795

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

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Conversation

Zvirovyi
Copy link
Contributor

@Zvirovyi Zvirovyi commented Mar 17, 2025

This is an implementation of the Logical Replication specification (WIP): https://docs.google.com/document/d/1f84Z4cZwUD4q4bJsXTTC_PUaZr7pPB0Q6HnQ9cgCX_o/edit?usp=sharing.

Basic testing

  1. deploy postgresql and postgresql2
  2. juju integrate postgresql:logical-replication-offer postgresql2:logical-replication
  3. create testing table with data in the postgresql: create table asd (message text); insert into asd values ('hello');
  4. create the same table on the postgresql2 side
  5. juju run postgresql/leader add-publication name=asd database=postgres tables=public.asd
  6. juju run postgresql2/leader subscribe name=asd
  7. check the table on postgresql2 side: select * from asd;
  8. add another data to the testing table and observe it was pushed to the postgresql2 subscriber

Key notes

  • will fix tests after initial PR & specification review;
  • there is the same K8s PR;
  • postgesql-k8s lib synced with K8s revision.

@marceloneppel marceloneppel added the enhancement New feature, UI change, or workload upgrade label Mar 21, 2025
# Conflicts:
#	lib/charms/postgresql_k8s/v0/postgresql.py
#	templates/patroni.yml.j2
Copy link

codecov bot commented Mar 24, 2025

Codecov Report

Attention: Patch coverage is 19.28375% with 293 lines in your changes missing coverage. Please review.

Project coverage is 67.99%. Comparing base (7686dd0) to head (62087a3).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/relations/logical_replication.py 17.50% 276 Missing and 2 partials ⚠️
src/backups.py 33.33% 8 Missing and 2 partials ⚠️
src/cluster.py 16.66% 5 Missing ⚠️

❌ Your patch check has failed because the patch coverage (19.28%) is below the target coverage (33.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project check has failed because the head coverage (67.99%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #795      +/-   ##
==========================================
- Coverage   72.08%   67.99%   -4.10%     
==========================================
  Files          15       16       +1     
  Lines        3865     4255     +390     
  Branches      584      668      +84     
==========================================
+ Hits         2786     2893     +107     
- Misses        898     1174     +276     
- Partials      181      188       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Zvirovyi Zvirovyi marked this pull request as ready for review March 25, 2025 11:53
Copy link
Member

@marceloneppel marceloneppel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks great! I'll only do some more testing tomorrow.

@marceloneppel marceloneppel requested a review from dragomirp March 25, 2025 21:17
Copy link
Member

@marceloneppel marceloneppel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, UI change, or workload upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants