zhangshenghang opened a new pull request, #11522:
URL: https://github.com/apache/seatunnel/pull/11522
## Purpose of the change
Fixes #11510.
In the official CI/Docker image, **every PostgreSQL connection fails** with
`Protocol error. Session setup failed` because the openGauss JDBC driver
shipped in `lib/` hijacks the PostgreSQL driver classes.
## Root cause
- `connector-cdc-opengauss` depends on `org.opengauss:opengauss-jdbc:5.1.0`
— the **non `-og` variant**, which is a pgJDBC fork that still bundles 400+
unrelocated `org.postgresql.*` classes, including `org/postgresql/Driver.class`
and `org/postgresql/core/v3/ConnectionFactoryImpl.class`.
- The connector shades its own copy of the driver, but with
`createDependencyReducedPom=false` the original jar still leaks into the
`seatunnel-dist` dependency graph.
- `assembly-seatunnel-bin-ci.xml` includes
`org.opengauss:opengauss-jdbc:jar` into `lib/`, and `seatunnel.sh` puts `lib/*`
on one flat classpath. The fork jar sorts before the real `postgresql-*.jar`
and hijacks `org.postgresql.*` class resolution, so connections to vanilla
PostgreSQL run the openGauss-specific protocol handshake and fail.
## Changes
- **`seatunnel-dist/pom.xml`**
- Exclude the transitive `org.opengauss:opengauss-jdbc` from the
`connector-cdc-opengauss` dependency. The CDC connector shades its own
relocated driver copy, so it does not need the external jar at runtime.
- Declare `org.opengauss:opengauss-jdbc:5.1.0-og` (the fully relocated
variant, which ships **zero** `org.postgresql.*` classes) so the Jdbc
connector's openGauss dialect (`org.opengauss.Driver`) keeps working out of the
box in the image.
- **`DriverJarPackagingTest`** (new): guards the distribution against
reintroducing the unrelocated fork — asserts `connector-cdc-opengauss` carries
the exclusion and any declared `opengauss-jdbc` dependency uses the relocated
`-og` variant.
## Verification
- `./mvnw -pl seatunnel-dist dependency:tree` now resolves exactly one
openGauss artifact — the safe one:
```
+- org.apache.seatunnel:connector-cdc-opengauss:jar:3.0.0-SNAPSHOT:provided
+- org.opengauss:opengauss-jdbc:jar:5.1.0-og:provided
+- org.postgresql:postgresql:jar:42.4.3:provided
```
- `DriverJarPackagingTest` passes; mutation check confirmed it fails when
the exclusion is removed.
## Notes
- No behavior change for PostgreSQL users except that the hijack is gone;
openGauss support via the Jdbc connector is preserved through the relocated
driver.
- The plain ASF bin assembly (`assembly-seatunnel-bin.xml`) ships no JDBC
drivers and is unaffected.
--
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]