-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
None
-
False
PostgresConnectorIT#shouldRecoverFromRetriableException can fail randomly with
org.junit.ComparisonFailure: expected:<[2]> but was:<[0]> at io.debezium.connector.postgresql.PostgresConnectorIT.assertRecordsAfterInsert(PostgresConnectorIT.java:2872) at io.debezium.connector.postgresql.PostgresConnectorIT.shouldRecoverFromRetriableException(PostgresConnectorIT.java:1060)
and exception bellow as on a slow machine snapshot events may be already streamed but regular streaming may not be fully started yet when we stop connection to Postgres.
Example error:
2022-07-13 13:03:31,446 INFO Postgres|test_server|streaming Starting streaming [io.debezium.pipeline.ChangeEventSourceCoordinator] 2022-07-13 13:03:31,446 INFO Postgres|test_server|streaming Retrieved latest position from stored offset 'LSN{0/69CE5BD0}' [io.debezium.connector.postgresql.PostgresStreamingChangeEventSource] 2022-07-13 13:03:31,446 INFO Postgres|test_server|streaming Looking for WAL restart position for last commit LSN 'null' and last change LSN 'LSN{0/69CE5BD0}' [io.debezium.connector.postgresql.connection.WalPositionLocator] 2022-07-13 13:03:31,457 INFO Postgres|test_server|streaming Obtained valid replication slot ReplicationSlot [active=false, latestFlushedLsn=LSN{0/69CE5BD0}, catalogXmin=7580] [io.debezium.connector.postgresql.connection.PostgresConnection] 2022-07-13 13:03:31,459 INFO || Connection gracefully closed [io.debezium.jdbc.JdbcConnection] 2022-07-13 13:03:31,460 DEBUG Postgres|test_server|streaming running 'IDENTIFY_SYSTEM' to validate replication connection [io.debezium.connector.postgresql.connection.PostgresReplicationConnection] 2022-07-13 13:03:31,461 ERROR Postgres|test_server|streaming Producer failure [io.debezium.pipeline.ErrorHandler] io.debezium.jdbc.JdbcConnectionException: FATAL: terminating connection due to administrator command at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.initReplicationSlot(PostgresReplicationConnection.java:267) at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.initConnection(PostgresReplicationConnection.java:346) at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.startStreaming(PostgresReplicationConnection.java:305) at io.debezium.connector.postgresql.PostgresStreamingChangeEventSource.execute(PostgresStreamingChangeEventSource.java:137) at io.debezium.connector.postgresql.PostgresStreamingChangeEventSource.execute(PostgresStreamingChangeEventSource.java:41) at io.debezium.pipeline.ChangeEventSourceCoordinator.streamEvents(ChangeEventSourceCoordinator.java:174) at io.debezium.pipeline.ChangeEventSourceCoordinator.executeChangeEventSources(ChangeEventSourceCoordinator.java:141) at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start$0(ChangeEventSourceCoordinator.java:109) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:329) at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:315) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:291) at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:243) at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:635) at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:504) at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.initReplicationSlot(PostgresReplicationConnection.java:241) ... 12 common frames omitted