This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new d8cea835667 Refactor OpenGaussLogicalReplication (#36189)
d8cea835667 is described below

commit d8cea8356676ea5579f41d4bc7b33758f5371977
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Tue Aug 5 23:20:27 2025 +0800

    Refactor OpenGaussLogicalReplication (#36189)
---
 .../incremental/wal/OpenGaussLogicalReplication.java   | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git 
a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/incremental/wal/OpenGaussLogicalReplication.java
 
b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/incremental/wal/OpenGaussLogicalReplication.java
index 59f26614756..3321ff8e338 100644
--- 
a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/incremental/wal/OpenGaussLogicalReplication.java
+++ 
b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/incremental/wal/OpenGaussLogicalReplication.java
@@ -20,8 +20,9 @@ package 
org.apache.shardingsphere.data.pipeline.opengauss.ingest.incremental.wal
 import lombok.extern.slf4j.Slf4j;
 import 
org.apache.shardingsphere.data.pipeline.api.type.StandardPipelineDataSourceConfiguration;
 import 
org.apache.shardingsphere.data.pipeline.postgresql.ingest.incremental.wal.decode.BaseLogSequenceNumber;
-import org.apache.shardingsphere.infra.database.core.connector.url.JdbcUrl;
-import 
org.apache.shardingsphere.infra.database.core.connector.url.StandardJdbcUrlParser;
+import 
org.apache.shardingsphere.infra.database.core.connector.ConnectionProperties;
+import 
org.apache.shardingsphere.infra.database.core.connector.ConnectionPropertiesParser;
+import 
org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
 import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import org.opengauss.PGProperty;
@@ -43,6 +44,8 @@ public final class OpenGaussLogicalReplication {
     
     private static final String HA_PORT_ERROR_MESSAGE_KEY = "HA port";
     
+    private final DatabaseType databaseType = 
TypedSPILoader.getService(DatabaseType.class, "openGauss");
+    
     /**
      * Create connection.
      *
@@ -73,12 +76,11 @@ public final class OpenGaussLogicalReplication {
     }
     
     private Connection tryConnectingToHAPort(final String jdbcUrl, final 
Properties props) throws SQLException {
-        JdbcUrl parseResult = new StandardJdbcUrlParser().parse(jdbcUrl);
-        PGProperty.PG_HOST.set(props, parseResult.getHostname());
-        PGProperty.PG_DBNAME.set(props, parseResult.getDatabase());
-        int haPort = parseResult.getPort() + 1;
-        PGProperty.PG_PORT.set(props, haPort);
-        return 
DriverManager.getConnection(TypedSPILoader.getService(DatabaseType.class, 
"openGauss").getJdbcUrlPrefixes().iterator().next(), props);
+        ConnectionProperties connectionProps = 
DatabaseTypedSPILoader.getService(ConnectionPropertiesParser.class, 
databaseType).parse(jdbcUrl, null, null);
+        PGProperty.PG_HOST.set(props, connectionProps.getHostname());
+        PGProperty.PG_DBNAME.set(props, connectionProps.getCatalog());
+        PGProperty.PG_PORT.set(props, connectionProps.getPort() + 1);
+        return 
DriverManager.getConnection(databaseType.getJdbcUrlPrefixes().iterator().next(),
 props);
     }
     
     /**

Reply via email to