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] CDC Not Working With Connector Version 3.6.22 (PgJDBC Issue) #49802

Open
1 task
hagar-yasser1 opened this issue Dec 15, 2024 · 2 comments
Open
1 task
Assignees
Labels
area/connectors Connector related issues community connectors/source/postgres team/db-dw-sources Backlog for Database and Data Warehouse Sources team type/bug Something isn't working

Comments

@hagar-yasser1
Copy link

Connector Name

source-postgres

Connector Version

3.6.22

What step the error happened?

During the sync

Relevant information

Summary

After upgrading the source version to 3.6.22, and on running Postgres Sync Job using CDC, we face the issue of repeatedly failing pipelines or repeatedly refreshing pipelines (depending on the value for Invalid CDC position behavior Property). We traced back the issue to the PgJDBC version used. The version injected into Debezium by Airbyte automatically advances the confirmed_flush_lsn in cases there are no changes for the publication tables in the replication slot.

Details

  1. In case Invalid CDC position behavior (Advanced) Property is Fail sync, Output Log is:
    Saved offset is before replication slot's confirmed lsn. Please reset the connection, and then increase WAL retention and/or increase sync frequency to prevent this from happening in the future. See https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#under-cdc-incremental-mode-there-are-still-full-refresh-syncs for more details.
    
  2. In case Invalid CDC position behavior (Advanced) Property is Re-sync data, Output Log is:
    Saved offset is before Replication slot's confirmed_flush_lsn, Airbyte will trigger sync from scratch
    

The cause for this issue is that starting from postgres source 3.6.19 the datastore-postgres started using api 'org.postgresql:postgresql:42.7.4'

Proposed Solutions

  • Downgrade the source-postgres to 3.6.18
  • Downgrade the PgJDBC version used by datastore-postgres to anything less than 42.7.0

Related Airbyte Issues

Relevant log output

2024-11-30 00:40:20,219 [pool-10-thread-4]	�[1;31mERROR�[0;39m	i.a.w.i.VersionedAirbyteStreamFactory(internalLog):310 - ERROR debezium-postgresconnector-wms_db-change-event-source-coordinator i.d.c.p.c.PostgresReplicationConnection(close):775 Unexpected error while closing Postgres connection org.postgresql.util.PSQLException: Unable to close connection properly
	at org.postgresql.jdbc.PgConnection.close(PgConnection.java:870) ~[postgresql-42.7.4.jar:42.7.4]
	at io.debezium.jdbc.JdbcConnection.lambda$doClose$4(JdbcConnection.java:951) ~[debezium-core-2.6.2.Final.jar:2.6.2.Final]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.net.SocketException: Broken pipe
	at java.base/sun.nio.ch.SocketDispatcher.write0(Native Method) ~[?:?]
	at java.base/sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:62) ~[?:?]
	at java.base/sun.nio.ch.NioSocketImpl.tryWrite(NioSocketImpl.java:394) ~[?:?]
	at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:410) ~[?:?]
	at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440) ~[?:?]
	at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:819) ~[?:?]
	at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1195) ~[?:?]
	at java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:345) ~[?:?]
	at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:1304) ~[?:?]
	at org.postgresql.util.internal.PgBufferedOutputStream.flushBuffer(PgBufferedOutputStream.java:41) ~[postgresql-42.7.4.jar:42.7.4]
	at org.postgresql.util.internal.PgBufferedOutputStream.flush(PgBufferedOutputStream.java:48) ~[postgresql-42.7.4.jar:42.7.4]
	at org.postgresql.core.PGStream.flush(PGStream.java:707) ~[postgresql-42.7.4.jar:42.7.4]
	at org.postgresql.core.QueryExecutorCloseAction.close(QueryExecutorCloseAction.java:73) ~[postgresql-42.7.4.jar:42.7.4]
	at org.postgresql.jdbc.PgConnectionCleaningAction.onClean(PgConnectionCleaningAction.java:89) ~[postgresql-42.7.4.jar:42.7.4]
	at org.postgresql.util.LazyCleaner$Node.onClean(LazyCleaner.java:219) ~[postgresql-42.7.4.jar:42.7.4]
	at org.postgresql.util.LazyCleaner$Node.clean(LazyCleaner.java:210) ~[postgresql-42.7.4.jar:42.7.4]
	at org.postgresql.jdbc.PgConnection.close(PgConnection.java:867) ~[postgresql-42.7.4.jar:42.7.4]
	... 5 more

Contribute

  • Yes, I want to contribute
@marcosmarxm
Copy link
Member

@airbytehq/dbsources can someone take a look into this issue?

@theyueli
Copy link
Contributor

@yardencarmeli could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues community connectors/source/postgres team/db-dw-sources Backlog for Database and Data Warehouse Sources team type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants