Skip to content

Commit e9a27e4

Browse files
author
liusx
committed
修复 PostgreSQL CDC 任务无法启动的致命问题
1 parent 3f1fd54 commit e9a27e4

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

  • seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader

seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,11 @@ public void configure(SourceSplitBase sourceSplitBase) {
205205
snapshotter.shouldSnapshot(),
206206
connectorConfig);
207207
try {
208-
// create the slot if it doesn't exist, otherwise update slot to add new
209-
// table(job restore and add table)
210-
replicationConnection.createReplicationSlot().orElse(null);
211-
} catch (SQLException ex) {
212-
String message = "Creation of replication slot failed";
213-
if (ex.getMessage().contains("already exists")) {
214-
message +=
215-
"; when setting up multiple connectors for the same database host, please make sure to use a distinct replication slot name for each.";
216-
log.warn(message);
217-
} else {
218-
throw new DebeziumException(message, ex);
219-
}
208+
// initialize replication connection and create slot if needed
209+
replicationConnection.initConnection();
210+
} catch (SQLException | InterruptedException ex) {
211+
String message = "ReplicationConnection init failed";
212+
throw new DebeziumException(message, ex);
220213
}
221214
}
222215
}

0 commit comments

Comments
 (0)