PZh101 commented on PR #10961: URL: https://github.com/apache/seatunnel/pull/10961#issuecomment-7207575669
Thanks for the full re-review, and for the correction on `connect_timeout_ms` — you are right that `SimpleJdbcConnectionProvider` calls `driver.connect(url, properties)` directly with no dedicated probe deadline, so I am not claiming any fixed bound. I took the first option from your Issue 1 recommendation: keep only the explicit `compatible_mode` and drop auto-detection entirely. That removes the planning-time probe instead of trying to bound it, which also makes Issues 2, 3 and 6 much smaller. Pushed as `cbeb3afa0`; the PR is now 11 files / +617 -10. **Issue 1 (P0, High) — mode selection is now deterministic and bounded** Both factories no longer open a connection. `compatible_mode` is the only source; absent or unrecognized values deterministically keep the native Kingbase behavior, which is the pre-existing behavior of the connector. There is no WARN-then-fallback path any more, because there is no failure path: nothing can degrade after a transient connection error, and nothing can stall startup. While writing the tests I found a real inconsistency between the two sides: `KingbaseDialect.isMySQL()` did `equalsIgnoreCase` without trimming, while the catalog trimmed. So `compatible_mode = " mysql "` selected the MySQL catalog but the native dialect — different SQL, converters and type mapper in one job, which is exactly the split decision you flagged. Both sides now normalize identically (`equalsIgnoreCase(trim())`) and a test pins it. **Issue 6 (High) — catalog unit test is offline** You are right that `192.0.2.1` proved nothing: `getMySqlCatalog` reaches `MySqlCatalog.resolveVersion()` in the constructor, which calls `getConnection` -> `driver.connect` and swallows the error. I measured it: the single test took 3.6s of real network attempt. The test no longer constructs a real catalog — it replaces the two construction points with recording stubs and asserts which implementation the factory chose. It now runs with the other cases at ~0.001s each. The unroutable URL is kept deliberately, so a reintroduced probe would make these tests slow or hang rather than silently pass. **Issue 2 (Medium) — shared driver forwarding reverted** Reverted. `extractCatalogConfig` no longer puts `DRIVER`, and the extra `JdbcConnectionConfig` argument is gone from the `JdbcCatalogUtils` and `JdbcSinkFactory` call sites. You were right that this was this PR's addition — I verified `git show apache/dev:.../JdbcCatalogUtils.java` has no `DRIVER` line. Nothing outside the Kingbase path changes now. Note that the 3-arg `JdbcDialectFactory.create` and the 4-arg `JdbcDialectLoader.load` already exist upstream and are still used by `JdbcInputFormat`/`JdbcSourceFactory`, so I left those overloads untouched. **Issue 3 (Medium) — detection and runtime behavior covered** `KingbaseDialectFactoryTest` now covers: absent mode with a real config, explicit `mysql`/`pg`/`oracle`/`sqlserver`, case and whitespace variants, explicit-mode-wins-over-config, null config + null mode, `field_ide` propagation into the delegated `MysqlDialect` upsert (asserted equal to the direct `MysqlDialect` output), and the native `ON CONFLICT` vs MySQL `ON DUPLICATE KEY UPDATE` split. `KingbaseCatalogFactoryTest` covers the catalog side plus a pure-function assertion on the selection helper. All Kingbase test URLs are unroutable on purpose. **Issue 5 (Medium) — documentation** All four pages now add `compatible_mode` to the options table and state: explicit override, the option name already existed (no new option), no planning-time connection, absent mode keeps native behavior without guessing, and the upgrade impact for jobs that previously relied on accidental behavior. **SEZ9's public-field blocker — resolved by reverting, not by an API change** `KingbaseDialect.fieldIde` is back to `public` (non-final), exactly as upstream. Only the new `compatibleLevel` field is `private final`, and the original 1-arg constructor is preserved. So there is no source or binary boundary change and no migration policy to negotiate. **Issue 4 (Low)** — `ChunkSplitter` now carries a comment explaining that it passes the same explicit `compatible_mode` that `JdbcInputFormat` passes, with no connection config because nothing is probed. In this design the splitter and reader cannot disagree. I also dropped the whitespace-only addition to `JdbcDialect.java`; that file is now byte-identical to `dev`. **Verification (local, JDK 17):** `spotless:check` passes; `connector-jdbc` full suite `1278 tests, 0 failures, 0 errors, 10 skipped`; `test-compile` passes on JDK 11 and 17. The exact-head fork Build will need to run again for `cbeb3afa0` — say the word if you would rather I wait for something before triggering it. One thing I want to be explicit about, since it changes the scope of the feature: this PR no longer offers zero-config auto-detection. A MySQL-mode KingbaseES now needs `compatible_mode = "mysql"`. I think that is the right trade — it is what you recommended, it matches the OceanBase precedent in this same module, and it keeps existing jobs bit-identical — but if you consider zero-config detection a requirement rather than a convenience, tell me and I will rework it as the bounded/shared/fail-fast variant instead. -- 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]
