You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "zhang-arvin (via GitHub)" <gi...@apache.org> on 2026/08/19 01:37:45 UTC

[PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

zhang-arvin opened a new pull request, #11866:
URL: https://github.com/apache/seatunnel/pull/11866

   ## Purpose
   
   Fix PostgreSQL JDBC connection failure caused by OpenGauss driver conflict.
   
   ## Problem
   
   When both `postgresql-xxx.jar` and `opengauss-jdbc-xxx.jar` are on the classpath, the OpenGauss JDBC driver shadows the PostgreSQL JDBC driver because both use the same `org.postgresql.Driver` class name. This causes PostgreSQL connections to fail with "Protocol error. Session setup failed".
   
   ## Solution
   
   Add `driver.acceptsURL(url)` check when selecting JDBC drivers in:
   1. `AbstractJdbcCatalog.getConnection()` - skip drivers that don\t accept the target URL
   2. `SimpleJdbcConnectionProvider.getOrEstablishConnection()` - fall back to `DriverManager.getDriver(url)` when the loaded driver doesn\t accept the URL
   
   This ensures the correct driver is selected based on the JDBC URL, preventing driver conflicts.
   
   Closes #10242


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5578514246

   @SEZ9 good to double-check, but the tuning-guide doc is confirmed gone at the head we're both discussing. I just re-pulled `pulls/11866/files` fresh against `92af89a` and it's exactly 7 files, none of them docs:
   
   - `seatunnel-connectors-v2/connector-jdbc/src/main/java/.../catalog/AbstractJdbcCatalog.java`
   - `seatunnel-connectors-v2/connector-jdbc/src/main/java/.../internal/connection/SimpleJdbcConnectionProvider.java`
   - `seatunnel-connectors-v2/connector-jdbc/src/test/java/.../catalog/AbstractJdbcCatalogTest.java`
   - `seatunnel-connectors-v2/connector-jdbc/src/test/java/.../catalog/ConfigurableDriver.java` (new, test double)
   - `seatunnel-connectors-v2/connector-jdbc/src/test/java/.../internal/connection/RejectingDriver.java` (new, test double)
   - `seatunnel-connectors-v2/connector-jdbc/src/test/java/.../internal/connection/SimpleJdbcConnectionProviderTest.java` (new)
   - `seatunnel-connectors-v2/connector-jdbc/src/test/java/.../internal/connection/ThrowingDriver.java` (new, test double)
   
   No `docs/en`/`docs/zh` path anywhere in the diff. zhang-arvin dropped the ~828-line Zeta tuning-guide bundle back on 2026-08-28, and I re-confirmed it stayed absent in every round since, including explicitly in my own `92af89a` review a couple hours before your comment (Issue 3 there: "Confirmed still absent from the current diff... This also resolves @SEZ9's Issue 1/2 from an earlier round"). So the head you're asking zhang-arvin to check is already clean — no action needed from them, this isn't a live discrepancy, just two reviews that briefly passed each other. The doc findings you listed (REST endpoint guidance, restart-vs-hot-reload table, checkpoint-log grep contradiction, HealthMonitor cadence, etc.) never need to be reopened here since that content isn't part of this PR anymore.
   
   With that reconciled, the driver-selection fix and its test coverage are what's actually in front of us, and I don't have anything to add beyond my last review (Ready to merge, no open blockers) — just gated on the fork's `Build` finishing green and a write-level maintainer merge.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5551395023

   CI record update: my last comment described the fork `Build` run for this head as "still queued." It has since completed, and it finished `failure` — `updated-modules-integration-test-part-1 (11, ubuntu-latest)` and `paimon-connector-it (11, ubuntu-latest)` both failed.
   
   Neither of those touches the PostgreSQL/OpenGauss driver-disambiguation code this PR changes, and both are known sources of unrelated flakiness in this window (the same `updated-modules-integration-test-part-1` bucket that's flaked on sibling PRs, and `paimon-connector-it` has its own known classloader/startup flake history unrelated to JDBC driver selection). I don't read this as a defect in this PR's diff. A rerun of the two failing jobs should be the right next step; the code-side review stands as-is.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5474889220

   @DanielLeens Thanks for the thorough review! Addressed:
   
   1. Added `testDriverDisambiguationInGetConnection` in `AbstractJdbcCatalogTest` — registers two `ConfigurableDriver` instances with the same class name (one rejecting, one accepting), calls `getConnection()` directly, and asserts the connection comes from the accepting driver via the per-driver loop rather than the outer `DriverManager.getConnection()` fallback. This closes the remaining `AbstractJdbcCatalog` half of Issue 2.
   
   2. Merged `acceptsURL()` and `connect()` into the same per-driver `try/catch` block in `AbstractJdbcCatalog.getConnection()` so a single driver throwing from `acceptsURL()` only skips that driver rather than aborting the entire enumeration.
   
   3. Cached the corrected driver in `SimpleJdbcConnectionProvider.loadedDriver` after the `DriverManager.getDriver(url)` fallback succeeds, so the fallback doesn't repeat on every reconnect.
   
   PTAL.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5355041450

   Thanks for the quick response! I don't see a new commit on this PR yet though — the head is still at `2198486` (the same commit I reviewed last round), so I'll hold off on a full re-review until the fixes are actually pushed.
   
   One concrete thing worth knowing while you're at it: the fork's CI (`Build` -> `Code style` job) is currently failing at this head on exactly the trailing-newline nit I mentioned last round — `spotless:check` reports a missing trailing newline at the end of `SimpleJdbcConnectionProviderTest.java` (`connector-jdbc` module). Running `mvn spotless:apply` before you push should clear that alongside your other three fixes.
   
   Ping me once the commit is up and I'll do a full re-review of the `acceptsURL()` exception scoping, the new connection-provider test, and confirm the unrelated tuning-guide docs are out.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5573957715

   Thanks for the feedback! Fixed: the log line now includes both driver class and URL context (`log.info("try connector {} failed for url {}", driverClass, url, e)`). Ready for re-review.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5453985104

   @DanielLeens @SEZ9 Thanks for the thorough reviews and patience! I have addressed all the issues:
   
   **1. Removed unrelated docs**: The ~828 lines of Zeta tuning-guide documentation have been removed. The PR now contains only the JDBC driver conflict fix.
   
   **2. Added `acceptsURL()` exception handling**: Both `AbstractJdbcCatalog.getConnection()` and `SimpleJdbcConnectionProvider.getOrEstablishConnection()` now wrap `driver.acceptsURL()` in try-catch. If `acceptsURL()` throws `SQLException`, the driver is skipped (in `AbstractJdbcCatalog`) or falls back to `DriverManager.getDriver()` (in `SimpleJdbcConnectionProvider`).
   
   **3. Test improvements**: `SimpleJdbcConnectionProviderTest` now asserts URL acceptance behavior with proper mock setup.
   
   Please take another look when you have a chance.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5572631082

   Fixed: log now includes driver/url context.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-6051905612

   @DanielLeens Thanks for the deep trace against the actual jars — you're right, and I've corrected the record rather than defend the claim.
   
   I independently reproduced your finding: with the pinned versions (`opengauss-jdbc-5.1.0-og` registers as `org.opengauss.Driver`, accepts only `jdbc:opengauss:`/`jdbc:dws:iam:`; `postgresql-42.4.3` registers as `org.postgresql.Driver`, accepts only `jdbc:postgresql:`), there is neither a class-name collision nor a URL ambiguity, so the original #10242 mechanism does not apply to what ships here.
   
   Actions taken:
   
   1. **Root-cause claim corrected** — rewrote the PR description so it no longer represents this as the root-cause fix for #10242. It is now framed as defensive hardening of driver selection (relevant when a driver genuinely collides by class name, e.g. an older non-`-og` `opengauss-jdbc`, or other classloading/ordering non-determinism), with the issue link marked informational.
   2. **Real-driver test added (Issue 1)** — `RealJdbcDriverAcceptsUrlTest` uses the actual `org.postgresql.Driver` and `org.opengauss.Driver` classes (not the synthetic stubs): asserts each only accepts its own URL prefix, and that they register under distinct class names. If a future driver upgrade reintroduces a real collision, this fails and forces a re-check of the premise. Local: `Tests run: 3, Failures: 0`.
   
   Pushed head `970cbcacd` (also rebased onto the current head; prior content unchanged).


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5480645833

   CI record update: the previously in-progress jobs at this head (`06ba93ef`, fork run `zhang-arvin/seatunnel#33366335404`) have since completed. Two new job failures appeared that were not visible when I posted my last review — `doris-connector-it (8, ubuntu-latest)` and `doris-connector-it (11, ubuntu-latest)`, both failing on the identical assertion `DorisErrorIT.testDoris:85 expected: <true> but was: <false>`. This is unrelated to this PR's diff: `connector-doris` does not use `AbstractJdbcCatalog` or `SimpleJdbcConnectionProvider` (confirmed via code search — zero references), and the same failure on both JDK 8 and JDK 11 points to a pre-existing dev-side test issue rather than something introduced here. (`updated-modules-integration-test-part-7 (8, ubuntu-latest)` and `paimon-connector-it (8, ubuntu-latest)` were cancelled as a downstream side effect of the run failing, not independent failures.)
   
   My prior conclusion stands: the PR-scoped diff itself (the 4 JDBC files) is clean, all unit-test jobs are green, and the previously-flagged dependency-resolution failure was a separate infra issue. This remains gated on a write-capable maintainer for final approve/merge, not on further changes to this PR.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5373040251

   Thanks @DanielLeens for the review! I've addressed the issues: isolated `acceptsURL()` exception handling, added connection provider tests with disambiguation, and removed the unrelated tuning-guide doc changes. The fix is now pushed — please take another look when you have time.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5578299265

   Thanks @zhang-arvin and @DanielLeens for the follow-up on `92af89a`.
   
   One thing I want to reconcile before this can move forward: at the head I last reviewed, the visible diff was dominated by roughly 830 lines of Zeta tuning-guide documentation, and the JDBC driver-selection change plus its unit test were not reviewable there, so the `acceptsURL()` semantics change is still unverified on my side. @zhang-arvin, could you confirm whether `92af89a` still contains the tuning-guide doc? If it does, please drop it from this PR — it is unrelated to the JDBC driver-conflict fix and should go in its own PR. If it has already been removed, a quick note saying so is enough and I'll re-check.
   
   For the record, if the tuning guide is split out, the following doc findings move with it rather than being closed here: the Hazelcast REST cluster endpoint guidance, the restart-vs-hot-reload table, the v1 REST path / port 8080 curl example, the contradictory checkpoint-log grep guidance between Section 2 and Section 6.1, the unverified operational claims (log levels, log formats, REST endpoints, restart semantics), and the HealthMonitor "every 60 seconds" cadence vs the Hazelcast default of 20.
   
   Remaining ask:
   - @zhang-arvin: confirm/remove the tuning-guide doc from this PR so the diff is only the driver fix and its test.
   
   <!-- streview-comment:892 -->


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5594857811

   Thanks @DanielLeens for the detailed file list at `92af89a`. I haven't yet re-verified the diff at that head myself, so I don't want to close out F1–F8 on the strength of a comment alone — the earlier round applied the same standard to the author's "removed" statement, and I'd like to be consistent.
   
   Here's how I'll proceed:
   
   - **F1** (tuning guide bundled) and **F3–F8** (the doc-content points): if my own pass over `92af89a` shows no `docs/en`/`docs/zh` paths in the diff, I'll withdraw F1 and mark F3–F8 as moot since that content would no longer be part of this PR.
   - **F2** (fix and test not reviewable): if the diff at `92af89a` does contain `SimpleJdbcConnectionProvider.java`, `AbstractJdbcCatalog.java`, and the new tests plus driver test doubles you listed, then the premise no longer holds and I'll review the `acceptsURL()` handling directly and close F2 out here.
   
   No action needed from the author for now. I'll follow up on this thread once I've checked the diff; if it matches your list, I expect I'll have nothing to add beyond your review.
   
   <!-- streview-comment:906 -->


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5611967702

   Sounds right to me, @SEZ9 — appreciate you holding the same independent-verification bar here that you applied to the author's earlier "removed" claim; that's the correct standard and I'd rather you confirm it yourself than take my file list on faith. No rush on my end. I'll wait for your pass over `92af89a` before considering F1–F8 closed, and happy to dig back into `acceptsURL()` with you on F2 if anything looks off once you're in the diff.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5469109226

   @DanielLeens Thanks for the thorough re-review! I have addressed the remaining blocker:
   
   Issue 2 (test coverage): Added two new test methods that actually instantiate SimpleJdbcConnectionProvider and call getOrEstablishConnection():
   
   1. testGetOrEstablishConnectionFallsBackWhenDriverRejectsUrl — Registers a RejectingDriver (whose acceptsURL returns false) and an AcceptingDriver. Constructs SimpleJdbcConnectionProvider with driverName set to the rejecting driver class name, calls getOrEstablishConnection(), and verifies the connection is obtained from the accepting driver via the DriverManager fallback.
   
   2. testGetOrEstablishConnectionFallsBackWhenDriverThrowsOnAcceptsUrl — Registers a ThrowingDriver (whose acceptsURL throws SQLException) and an AcceptingDriver. Verifies the exception path falls back correctly.
   
   Supporting classes RejectingDriver and ThrowingDriver are package-private classes in the test package, so loadDriver() can match them by getClass().getName().
   
   Please take another look when you have a chance.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix][Connector-V2] Fix PostgreSQL JDBC driver conflict with OpenGauss [seatunnel]

Posted by "zhang-arvin (via GitHub)" <gi...@apache.org>.
zhang-arvin commented on PR #11866:
URL: https://github.com/apache/seatunnel/pull/11866#issuecomment-5353104381

   @DanielLeens Thanks for the review! I've addressed the issues: isolated acceptsURL() exception handling, added connection provider tests with disambiguation, and removed the unrelated tuning-guide doc changes.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org