LeonYoah commented on issue #10992:
URL: https://github.com/apache/seatunnel/issues/10992#issuecomment-4766363631

   One detail here may explain why it only reproduces on one server.
   
   The PostgreSQL error returned through the JDBC driver is localized in 
Chinese:
   
   ```text
   错误: 复制槽名 "seatunnel" 已经存在
   ```
   
   Is this PostgreSQL server running with Chinese locale settings, for example 
`lc_messages`, or a localized PostgreSQL build? The JDBC driver is likely just 
forwarding the server-side error text.
   
   This may matter because SeaTunnel currently detects duplicate replication 
slot creation by matching the English message text:
   
   
[`PostgresSourceFetchTaskContext.java#L215`](https://github.com/apache/seatunnel/blob/2.3.13-release/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java#L215)
   
   ```java
   if (ex.getMessage().contains("already exists")) {
   ```
   
   In an English PostgreSQL environment, this path can be recognized and only 
logged as a warning. In a Chinese PostgreSQL environment, the message is 
`已经存在`, so the check does not match, and the exception is thrown here:
   
   
[`PostgresSourceFetchTaskContext.java#L220`](https://github.com/apache/seatunnel/blob/2.3.13-release/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/PostgresSourceFetchTaskContext.java#L220)
   
   So this may not be an `initial` startup-mode issue itself. It looks more 
like the duplicate-slot handling is locale-sensitive. A safer fix would be to 
check the PostgreSQL SQLSTATE for duplicate object (`42710`) instead of 
checking the localized message text.
   
   As a workaround, please set an explicit unique `slot.name`, for example:
   
   ```hocon
   slot.name = "seatunnel_baf_aux_ds_01"
   ```
   
   and verify the environment and slot state with:
   
   ```sql
   show lc_messages;
   select slot_name, database, plugin, active, active_pid from 
pg_replication_slots;
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to