-
Enhancement
-
Resolution: Unresolved
-
Major
-
None
-
None
-
False
-
None
-
False
-
Important
In order to make your issue reports as actionable as possible, please provide the following information, depending on the issue type.
We encountered a bug related to publication.autocreate.mode=filtered and PostgreSQL in standBy mode .
The bug occurs when filtered mode is enabled: Debezium attempts to create or update a publication for filtered tables. However, since PostgreSQL is in read-only mode, create and modify operations are not allowed, resulting in the following error:
org.postgresql.util.PSQLException: ERROR: cannot execute ALTER PUBLICATION in a read-only transaction
Instead of attempting to create or update the publication, Debezium should first check whether the server allows write operations. If not, it should simply verify whether the replication is up to date.
To check for updates from a replication, Debezium can check if pg_catalog.pg_publication includes filtered tables into account or not.
The place in code where bug happens:
Bug report
For bug reports, provide this information, please:
What Debezium connector do you use and what version?
<Your answer>
What is the connector configuration?
Require to enable ```publication.autocreate.mode: filtered``` and test on standBy PostgreSQL
What is the captured database version and mode of deployment?
(E.g. on-premises, with a specific cloud provider, etc.)
<Your answer>
What behavior do you expect?
<Your answer>
What behavior do you see?
Do you see the same behaviour using the latest released Debezium version?
(Ideally, also verify with latest Alpha/Beta/CR version)
Yes, we see the same behaviour in latest release.
Do you have the connector logs, ideally from start till finish?
(You might be asked later to provide DEBUG/TRACE level log)
org.apache.kafka.connect.errors.ConnectException: Unable to update filtered publication test_public for "test$test"."test", "test$test"."test" at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.createOrUpdatePublicationModeFilterted(PostgresReplicationConnection.java:227) at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.initPublication(PostgresReplicationConnection.java:191) at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.createReplicationSlot(PostgresReplicationConnection.java:521) at io.debezium.connector.postgresql.PostgresConnectorTask.start(PostgresConnectorTask.java:161) at io.debezium.connector.common.BaseSourceTask.start(BaseSourceTask.java:141) at com.test.streaming.platform.connector.postgres.PostgresSourceConnectorTask.start(PostgresSourceConnectorTask.java:72) at org.apache.kafka.connect.runtime.AbstractWorkerSourceTask.initializeAndStart(AbstractWorkerSourceTask.java:280) at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:202) at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:259) at org.apache.kafka.connect.runtime.AbstractWorkerSourceTask.run(AbstractWorkerSourceTask.java:77) at org.apache.kafka.connect.runtime.isolation.Plugins.lambda$withClassLoader$1(Plugins.java:236) 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:840) Caused by: org.postgresql.util.PSQLException: ERROR: cannot execute ALTER PUBLICATION in a read-only transaction at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:335) at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:321) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:297) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:292) at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.createOrUpdatePublicationModeFilterted(PostgresReplicationConnection.java:224)
How to reproduce the issue using our tutorial deployment?
<Your answer>
Feature request or enhancement
For feature requests or enhancements, provide this information, please:
Which use case/requirement will be addressed by the proposed feature?
<Your answer>
Implementation ideas (optional)
<Your answer>