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

[source-postgres] Logical replication not working on read replicas #45396

Closed
1 task done
assaadhjb opened this issue Sep 11, 2024 · 4 comments · Fixed by #45397 or #46322
Closed
1 task done

[source-postgres] Logical replication not working on read replicas #45396

assaadhjb opened this issue Sep 11, 2024 · 4 comments · Fixed by #45397 or #46322
Labels

Comments

@assaadhjb
Copy link
Contributor

assaadhjb commented Sep 11, 2024

Connector Name

source-postgres

Connector Version

3.6.18

What step the error happened?

Syncs never start.

Relevant information

CDC Replication doesn't work on Postgres read replicas because it uses functions that can only be executed on the master - probably only one function: pg_current_wal_lsn().
I believe this can be solved quickly by replacing usage of pg_current_wal_lsn function with pg_last_wal_receive_lsn.

Postgres version : 16.13R2

Good to know: Debezium has solved this issue on their side very simply since V2.5, however the connector doesn't use Debezium for everything.

Relevant log output

java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: recovery is in progress Hint: WAL control functions cannot be executed during recovery.

Contribute

  • Yes, I want to contribute
@assaadhjb
Copy link
Contributor Author

@marcosmarxm it's not resolved until dest postgres uses latest version of CDK

@theyueli
Copy link
Contributor

theyueli commented Oct 3, 2024

hi @assaadhjb , we tested the latest version against a Postgres replica; the sync succeeded. As mentioned in the PR above, we need one more change on the query that computes the current transaction id. Please have a try and let us know. Thanks!

@assaadhjb
Copy link
Contributor Author

@theyueli I tested it and was successfully able to sync from a read-replica!
Thanks a lot for your patience and your effort - now the community is able to use Airbyte to sync from replicas in Postgres like it was possible previously for other flavors (MySQL ...)

@theyueli
Copy link
Contributor

theyueli commented Oct 3, 2024

@theyueli I tested it and was successfully able to sync from a read-replica! Thanks a lot for your patience and your effort - now the community is able to use Airbyte to sync from replicas in Postgres like it was possible previously for other flavors (MySQL ...)

This is great to hear! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment