This is an automated email from the ASF dual-hosted git repository.
lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new b4a284ccc6 [Fix][Connector-V2][Postgres-CDC] Skip
createReplicationSlot when slotInfo is present (#10416)
b4a284ccc6 is described below
commit b4a284ccc6d819e4f285f6d23b8a6b7f6ae8679f
Author: CNF96 <[email protected]>
AuthorDate: Mon Mar 2 22:01:41 2026 +0800
[Fix][Connector-V2][Postgres-CDC] Skip createReplicationSlot when slotInfo
is present (#10416)
Co-authored-by: liusx <[email protected]>
---
.../cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java
b/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java
index 319c4cad8d..058343cc72 100644
---
a/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java
+++
b/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java
@@ -185,7 +185,6 @@ public class PostgresSourceFetchTaskContext extends
JdbcSourceFetchTaskContext {
log.warn(
"unable to load info of replication slot, Debezium
will try to create the slot");
}
-
if (offsetContext == null) {
log.info("No previous offset found");
// if we have no initial offset, indicate that to Snapshotter
by passing null
@@ -212,7 +211,10 @@ public class PostgresSourceFetchTaskContext extends
JdbcSourceFetchTaskContext {
replicationConnection.createReplicationSlot().orElse(null);
} catch (SQLException ex) {
String message = "Creation of replication slot failed";
- if (ex.getMessage().contains("already exists")) {
+ // PostgreSQL errors all have a 5-character SQLSTATE
code, following the SQL
+ // standard specification
+ //
https://www.postgresql.org/docs/current/errcodes-appendix.html
+ if ("42710".equals(ex.getSQLState())) {
message +=
"; when setting up multiple connectors for
the same database host, please make sure to use a distinct replication slot
name for each.";
log.warn(message);