Skip to content

[Feature][Connector-V2] Add CockroachDB JDBC dialect - #12828

Merged
davidzollo merged 7 commits into
apache:devfrom
goutamadwant:feature/cockroachdb-jdbc
Nov 6, 2026
Merged

davidzollo merged 7 commits into
apache:devfrom
goutamadwant:feature/cockroachdb-jdbc

Conversation

@goutamadwant

Copy link
Copy Markdown
Collaborator

Purpose of this pull request

Related to #10443.

Add an explicit CockroachDB dialect to the existing JDBC connector. CockroachDB uses PostgreSQL JDBC URLs, so jobs select this dialect with dialect = "CockroachDB"; PostgreSQL URL-based selection remains unchanged.

  • Quote identifiers and use CockroachDB-compatible split and row-count queries.
  • Generate INSERT ... ON CONFLICT (configured keys) DO UPDATE, including support for a secondary unique key rather than only the physical primary key.
  • Reject unsupported schema changes and save modes before altering writer state or issuing DDL.

This does not bundle a driver or add catalog, CDC, XA, or transaction-retry support. Target tables must already exist.

Does this PR introduce any user-facing change?

Yes. JDBC jobs can explicitly select the CockroachDB dialect for bounded reads and writes. Existing PostgreSQL jobs are unchanged. EN/ZH documentation describes configuration and limits.

How was this patch tested?

  • Java 11 and 17: 90 adjacent tests passed on each version.
  • Real CockroachDB 24.3: 5 integration tests passed, including physical-primary-key and secondary-unique-key upserts.
  • Source-to-sink E2E: 7 jobs passed across Flink 1.13/1.15/1.18/1.20, Zeta, and Spark 2.4/3.3.
  • Connector build, formatting, correctness review, and security review completed.

Production TLS configuration was not tested locally.

Check list

  • Added focused tests and EN/ZH documentation.
  • Validated adjacent JDBC behavior.
  • Kept the change within the existing JDBC connector.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, and for the thorough testing notes and docs! I went through the full diff and the approach makes sense: the dialect is opt-in only, PostgreSQL URL matching is untouched, and the unsupported pieces (catalog, DDL, schema evolution) are rejected explicitly rather than silently ignored. I found a few items that need to be addressed before merging, and the two failing CI items below are real and come from this PR. Happy to re-review once you push an update!

What Problem Does This PR Solve?

  • User pain point: CockroachDB speaks the PostgreSQL wire protocol, but PostgreSQL's dialect fails on it (no HASHTEXT, pg_class.reltuples is NULL, extra metadata queries while a cursor is open break reads).
  • Fix approach: add an explicit CockroachDB dialect (subclass of PostgresDialect) selected via dialect = "CockroachDB", with FNV32 hash splitting, COUNT(*) row counts, a row converter that avoids result-set metadata queries, and fail-fast validation for schema change and save modes.
  • One-sentence summary: bounded read and upsert-based write against pre-created CockroachDB tables through the existing JDBC connector.

1. Code Change Review

1.1 Core Logic Analysis

Key files: CockroachDBDialect.java, CockroachDBDialectFactory.java (acceptsURL returns false, so selection is explicit only), CockroachDBRowConverter.java, the PostgresJdbcRowConverter.toInternal hook, JdbcDialect.supportsSchemaChange(), JdbcSink.supports(), AbstractJdbcSinkWriter.applySchemaChange, and a save-mode check in JdbcSinkFactory.

Runtime path:

Jdbc source/sink config (dialect="CockroachDB")
  -> JdbcDialectLoader.load(url, compatibleMode/dialect, ...)  -> CockroachDBDialectFactory.create()
  -> Source: ChunkSplitter -> dialect.hashModForField -> FNV32(CAST(col AS STRING)) % N   (null -> bucket 0)
             approximateRowCntStatement -> SQLUtils.countForTable / countForSubquery
             PreparedStatement cursor -> CockroachDBRowConverter.toInternal -> column.getSourceType() (no getMetaData())
  -> Sink: PostgresDialect.getUpsertStatement (inherited) -> INSERT .. ON CONFLICT (configured keys) DO UPDATE/NOTHING
           JdbcSinkFactory: only APPEND_DATA + default/IGNORE schema_save_mode
           JdbcSink.supports() == [] and AbstractJdbcSinkWriter.applySchemaChange -> reject
  -> getSaveModeHandler(): findCatalog("CockroachDB") -> no catalog factory -> Optional.empty (no DDL)

I verified that catalog lookup is keyed by dialect.dialectName() (JdbcCatalogUtils.findCatalog), so no PostgreSQL catalog is picked up and the docs statement "no catalog / no DDL" is accurate.

Key findings:

  • The normal user path (explicit dialect) reaches all of the new logic; PostgreSQL jobs only touch the refactored PostgresJdbcRowConverter.toInternal.
  • The PostgresJdbcRowConverter change is behavior preserving for PostgreSQL: the per-column getColumnTypeName call is now made only for STRING columns, and the base implementation still calls rs.getMetaData().getColumnTypeName(...). The new tableSchema.getColumn(typeInfo.getFieldName(i)) argument is evaluated for every STRING column on every row for PostgreSQL even though the base implementation ignores it (AbstractSchema.getColumn is a linear indexOf). It is correct but wasteful on wide tables; see Issue 4.
  • Real-server coverage is good (hash split exactly-once coverage, secondary unique key upsert, cursor with fresh metadata cache), but see Issue 1: those tests cannot run in CI where they are placed.

1.2 Compatibility Impact

Fully compatible. New dialect identifier only; PostgreSQL URL matching and behavior are unchanged (covered by JdbcDialectLoaderTest). JdbcDialect.supportsSchemaChange() is a default method returning true, so all existing dialects and third-party dialect implementations are unchanged. No serialization or option changes.

1.3 Performance / Side-Effect Analysis

  • Hash split with FNV32(CAST(col AS STRING)) is not index-friendly (full scan per split, as the existing PostgreSQL hash strategy also is); acceptable and documented as the hash strategy.
  • COUNT(*) for row estimation can scan the whole table or query; documented, with enable_concurrent_read = false as the escape hatch. For very large tables this is a cost users should know about, which the docs already state.
  • No new threads, buffers, or retained state.

1.4 Error Handling and Logging

Rejections are explicit and use CONFIG_VALIDATION_FAILED with actionable messages, which I like. No logging concerns.

Issue 1: CI blocker, CockroachDBDialectIT fails the unit-test naming check (and would never run in CI)

  • Location: seatunnel-connectors-v2/connector-jdbc/src/test/java/.../dialect/cockroachdb/CockroachDBDialectIT.java:1
  • Problem description: the Build check fails in the fork run (Run / Code style, step "Check code specification") with UTClassNameCheckTest.checkUTClassName, which reports this exact file: a class under src/test/java that imports org.junit.jupiter.api.Test must be named Test*, *Test, *Tests, or *TestCase. Beyond the naming rule, an *IT class in a connector module src/test is not run by the unit-test lane (the Javadoc itself says "run with -DskipIT=false"), and it starts a real CockroachDB container, so the unit-test lane is not the right place for it either. The behaviors that only this class verifies (UUID hash splitting, DECIMAL/BYTES/UUID mapping, secondary-unique-key upsert preserving omitted columns, the fresh-metadata-cache cursor read, COUNT(*) for table and filtered query) are not covered by JdbcCockroachDBIT, so as written they would never run in CI.
  • Potential risk: red CI now; and even after a rename, either a Docker-dependent test in the unit lane or silently unexecuted coverage.
  • Best improvement: move these test methods into the E2E module (for example into JdbcCockroachDBIT in connector-jdbc-e2e-part-1, which already starts the same container image) so they are executed by the IT lane, and delete the src/test copy. Keep the pure mock tests in CockroachDBDialectTest.
  • Severity: High
  • Raised by another reviewer: No

Issue 2: Connector-specific validation lives in the shared JdbcSinkFactory

  • Location: JdbcSinkFactory.java:187-195
  • Problem description: the generic factory now special-cases DatabaseIdentifier.COCKROACHDB by name to validate data_save_mode / schema_save_mode. The project guideline is to avoid connector-specific logic leaking into shared entry points; the dialect already has validateTableOptions, which is the existing pattern.
  • Potential risk: each future catalog-less dialect will add another if here.
  • Best improvement: add a small dialect hook (for example a default method such as validateSaveModes(DataSaveMode, SchemaSaveMode) on JdbcDialect, no-op by default) and implement it in CockroachDBDialect, mirroring supportsSchemaChange() and validateTableOptions(...).
  • Severity: Medium
  • Raised by another reviewer: No

Issue 3: Fully qualified type used in code, and comment/doc polish

  • Location: CockroachDBDialect.java tableIdentifier(...) uses java.util.stream.Stream.of(...) inline.
  • Problem description: please import java.util.stream.Stream like the rest of the file. Also CockroachDBDialectFactory has no class-level Javadoc while the sibling classes do; a one-line comment on why acceptsURL returns false is already there, which is great.
  • Potential risk: style only.
  • Best improvement: add the import; optionally add a short class comment.
  • Severity: Low
  • Raised by another reviewer: No

Issue 4: Avoidable per-row lookup in the shared PostgreSQL row converter

  • Location: PostgresJdbcRowConverter.java:112-118
  • Problem description: tableSchema.getColumn(typeInfo.getFieldName(fieldIndex)) is now evaluated for every STRING column of every row on the PostgreSQL path, but only the CockroachDB override uses the Column. AbstractSchema.getColumn is a linear scan.
  • Potential risk: small but real CPU overhead on wide string-heavy PostgreSQL reads at very large row counts; this is the hot read path.
  • Best improvement: resolve the column lazily (pass the index and let the CockroachDB override look up tableSchema.getColumn(...)), or pre-compute the per-field source types once outside the row loop in the CockroachDB converter, so PostgreSQL pays nothing extra.
  • Severity: Low
  • Raised by another reviewer: No

2. Code Quality Assessment

2.1 Coding Standards

Generally good. Core methods in the dialect have explanatory comments (hash and row-count rationale). The only gaps are the items in Issues 3.

2.2 Test Coverage and Test Stability

Coverage is strong in breadth: CockroachDBDialectTest, JdbcSinkFactoryTest, JdbcSinkWriterSchemaChangeSafetyTest, JdbcDialectLoaderTest, the PostgresJdbcRowConverterTest addition, the real-server E2E JdbcCockroachDBIT, and the (misplaced) real-server CockroachDBDialectIT. The E2E job replays the same bounded input twice and asserts no duplicates and that an omitted column is preserved, which is a good idempotency check.
Stability rating: Stable. I did not find Thread.sleep, fixed ports, or order-dependent assertions; the container wait uses a log message with a startup timeout (a log-line wait is a slightly weaker readiness signal than a successful SQL connection, but the following connect() retries nothing, so if you ever see flakiness, a SELECT 1 readiness check would harden it). The only stability problem is the placement in Issue 1.

2.3 Documentation Updates

docs/en and docs/zh are both updated for source and sink, and the two languages are consistent in content. Option and limit descriptions match the code (explicit dialect, APPEND_DATA only, no table_options, no catalog).

3. Architectural Soundness

3.1 Elegance of the Solution

Long-term-friendly dialect extension with a deliberately narrow scope. Issue 2 is the one structural improvement I would ask for.

3.2 Maintainability

Clear boundaries; failures are explicit.

3.3 Extensibility

The supportsSchemaChange() hook is reusable for other catalog-less dialects.

3.4 Historical-Version Compatibility

Compatible; no upgrade action.

4. Issue Summary

Number Issue Location Severity
Issue 1 CockroachDBDialectIT breaks UT naming check and would not run in CI CockroachDBDialectIT.java:1 High
Issue 2 CockroachDB-specific save-mode check in shared sink factory JdbcSinkFactory.java:187-195 Medium
Issue 3 Fully qualified Stream usage, missing class comment CockroachDBDialect.java Low
Issue 4 Per-row column lookup added to shared PostgreSQL path PostgresJdbcRowConverter.java:112-118 Low

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers - must be fixed
    • Issue 1: the current Build check fails on the new *IT class in src/test, and its real-server coverage needs to move to the E2E module so it actually executes.
  2. Recommended fixes - non-blocking
    • Issue 2 (move validation behind a dialect hook), Issue 3, Issue 4.

CI note: the failing item on the current head is Run / Code style -> UTClassNameCheckTest, caused by this PR (not by upstream drift); the branch is 0 commits behind dev, so syncing will not change it. No other reviewers have left findings on this PR yet.

Overall assessment: solid, well-scoped work. Option A (recommended): move the IT methods into JdbcCockroachDBIT. Option B: rename the class to *Test and gate it with an @EnabledIf* Docker check, which keeps a Docker-dependent test in the unit lane and I would avoid.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround, @goutamadwant! I re-reviewed the full current head (941e31e40c). The new commit renames the dialect IT so it passes the unit-test class-name rule, which was the CI failure I raised last round. Below is a complete re-check of every earlier item against this head. There are no new problems; the remaining items are the earlier non-blocking ones, which are still open.

What Problem Does This PR Solve?

  • User pain point: CockroachDB speaks the PostgreSQL wire protocol, but the PostgreSQL dialect fails on it (no HASHTEXT, pg_class.reltuples is NULL, extra metadata queries while a cursor is open break reads).
  • Fix approach: an explicit CockroachDB dialect (subclass of PostgresDialect) selected only by dialect = "CockroachDB", with FNV32 hash splitting, COUNT(*) row counts, a row converter that avoids result-set metadata queries, and fail-fast validation for schema change and save modes.
  • Summary: bounded read and upsert-based write against pre-created CockroachDB tables through the existing JDBC connector.
  • Example: a job with url = "jdbc:postgresql://host:26257/db" and dialect = "CockroachDB" now splits the read by FNV32(CAST(col AS STRING)) % N instead of failing on HASHTEXT.

1. Code Change Review

1.1 Core Logic Analysis

Changes since my previous review (head 906aa5be7b): exactly one commit, which renames CockroachDBDialectIT to TestCockroachDBDialectIT (a 2-line change). No production code changed, so my earlier correctness analysis still holds:

Jdbc source/sink config (dialect="CockroachDB")
  -> JdbcDialectLoader.load(...) -> CockroachDBDialectFactory.create()   (acceptsURL == false: explicit only)
  -> Source: ChunkSplitter -> dialect.hashModForField -> FNV32(CAST(col AS STRING)) % N
             approximateRowCntStatement -> COUNT(*)
             cursor read -> CockroachDBRowConverter.toInternal -> column.getSourceType() (no getMetaData())
  -> Sink: inherited PostgresDialect upsert (INSERT .. ON CONFLICT (keys) DO UPDATE/NOTHING)
           JdbcSinkFactory: only APPEND_DATA + default/IGNORE schema_save_mode
           JdbcSink.supports() == [] and AbstractJdbcSinkWriter.applySchemaChange -> reject
  -> findCatalog("CockroachDB") -> no catalog -> no DDL

Key findings:

  • The normal user path (explicit dialect) reaches all of the new logic; PostgreSQL jobs only touch the refactored PostgresJdbcRowConverter.toInternal.
  • Before/after on the shared converter: the rs.getMetaData().getColumnTypeName(...) call moved from every column into the STRING case via a new getStringColumnType(...) hook. That is behavior preserving for PostgreSQL, but the new argument tableSchema.getColumn(typeInfo.getFieldName(fieldIndex)) is evaluated per STRING column per row on the PostgreSQL path (see Issue 3).
  • Prior blocker status: the UTClassNameCheckTest failure is addressed by the rename (the class is now Test*). See Issue 1 for the remaining question about where this real-server test runs.

1.2 Compatibility Impact

Fully compatible. New dialect identifier only; PostgreSQL URL matching is unchanged (JdbcDialectLoaderTest). JdbcDialect.supportsSchemaChange() is a default method returning true, so existing and third-party dialects are unaffected. No option, serialization, or checkpoint format changes.

1.3 Performance / Side-Effect Analysis

  • Hash split is a full scan per split, as the existing PostgreSQL hash strategy is; acceptable and documented.
  • COUNT(*) row estimation can be expensive on very large tables; the docs state this and point to enable_concurrent_read = false.
  • No new threads, buffers, locks, or retained state.

1.4 Error Handling and Logging

Rejections are explicit (CONFIG_VALIDATION_FAILED) with actionable messages. No logging concerns.

Issue 1: Real-server test is excluded from the unit lane; please confirm where it actually runs

  • Location: seatunnel-connectors-v2/connector-jdbc/src/test/java/.../dialect/cockroachdb/TestCockroachDBDialectIT.java:1
  • Problem description: the rename fixes the naming check, but the root pom.xml surefire configuration excludes **/*IT.java, and the unit-test CI job runs with -DskipIT=true. So this class is never run by the unit lane. It would only run through failsafe in a lane that builds connector-jdbc with -DskipIT=false (for example via -am of a JDBC E2E module). That is an inference from the pom and backend.yml; I could not confirm it from a CI log. Several behaviors are only verified by this class (UUID hash splitting, DECIMAL/BYTES/UUID mapping, secondary-unique-key upsert preserving omitted columns, fresh-metadata-cache cursor read, COUNT(*) for table and filtered query), and JdbcCockroachDBIT does not cover all of them.
  • Potential risk: coverage that silently does not run, or runs duplicated in several IT lanes that all build connector-jdbc via -am, each starting its own CockroachDB container.
  • Best improvement: move these test methods into JdbcCockroachDBIT (same container image, already in connector-jdbc-e2e-part-1) and delete the src/test copy; keep the pure mock tests in CockroachDBDialectTest.
  • Severity: Medium
  • Raised by another reviewer: No (carried over from my previous review, now downgraded from High because the CI failure is fixed)

Issue 2: Connector-specific validation lives in the shared JdbcSinkFactory

  • Location: JdbcSinkFactory.java:187-195
  • Problem description: the generic factory special-cases DatabaseIdentifier.COCKROACHDB by name to validate data_save_mode / schema_save_mode. The project guideline is to keep connector-specific logic out of shared entry points; the dialect already has validateTableOptions, which is the existing pattern. Not changed in this head.
  • Potential risk: each future catalog-less dialect adds another if to the shared factory.
  • Best improvement: add a default no-op hook on JdbcDialect (for example validateSaveModes(DataSaveMode, SchemaSaveMode)) and implement it in CockroachDBDialect, mirroring supportsSchemaChange().
  • Severity: Medium
  • Raised by another reviewer: No (carried over from my previous review)

Issue 3: Avoidable per-row column lookup in the shared PostgreSQL row converter

  • Location: PostgresJdbcRowConverter.java:112-118
  • Problem description: tableSchema.getColumn(typeInfo.getFieldName(fieldIndex)) is evaluated for every STRING column of every row on the PostgreSQL path, but only the CockroachDB override uses the Column; the lookup is a linear scan. This is the hot read path.
  • Potential risk: small but real CPU overhead on wide, string-heavy PostgreSQL reads at very large row counts.
  • Best improvement: pass only the index and let the CockroachDB override resolve the column, or precompute per-field source types once outside the row loop in CockroachDBRowConverter.
  • Severity: Low
  • Raised by another reviewer: No (carried over from my previous review)

Issue 4: Fully qualified type in code and missing class comment

  • Location: CockroachDBDialect.java tableIdentifier(...) (java.util.stream.Stream.of(...)), CockroachDBDialectFactory.java
  • Problem description: please import java.util.stream.Stream instead of using the fully qualified name; the factory lacks a class-level Javadoc that sibling classes have.
  • Potential risk: style only.
  • Best improvement: add the import and a short class comment.
  • Severity: Low
  • Raised by another reviewer: No (carried over from my previous review)

2. Code Quality Assessment

2.1 Coding Standards

Good overall; core dialect methods carry explanatory comments. Remaining gaps are Issue 4.

2.2 Test Coverage and Test Stability

Coverage is broad: CockroachDBDialectTest, JdbcSinkFactoryTest, JdbcSinkWriterSchemaChangeSafetyTest, JdbcDialectLoaderTest, PostgresJdbcRowConverterTest, the real-server JdbcCockroachDBIT (replays the same bounded input twice and asserts no duplicates and an omitted column preserved), and the real-server TestCockroachDBDialectIT.
Stability rating: Stable. I found no Thread.sleep, fixed host ports, or order-dependent assertions; containers use mapped ports and a log-message wait with a 2 minute timeout. The only concern is placement (Issue 1).

2.3 Documentation Updates

docs/en and docs/zh are both updated for source and sink and are consistent; option and limit descriptions match the code. No change needed.

3. Architectural Soundness

3.1 Elegance of the Solution

Long-term solution with a deliberately narrow scope. Issue 2 is the one structural improvement I would still like to see.

3.2 Maintainability

Clear boundaries and explicit failures.

3.3 Extensibility

supportsSchemaChange() is reusable for other catalog-less dialects.

3.4 Historical-Version Compatibility

Compatible; no upgrade action, no config or state changes.

4. Issue Summary

Number Issue Location Severity
Issue 1 Real-server test excluded from unit lane; execution lane unconfirmed TestCockroachDBDialectIT.java:1 Medium
Issue 2 CockroachDB-specific save-mode check in shared sink factory JdbcSinkFactory.java:187-195 Medium
Issue 3 Per-row column lookup added to shared PostgreSQL path PostgresJdbcRowConverter.java:112-118 Low
Issue 4 Fully qualified Stream usage, missing class comment CockroachDBDialect.java Low

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers - must be fixed
    • No blocking issues found in the source. The only gate is CI: the Build check on this head was still in progress when I reviewed, so please let it finish green. The earlier UTClassNameCheckTest failure is fixed by the rename.
  2. Recommended fixes - non-blocking
    • Issue 1 (move the real-server tests into JdbcCockroachDBIT), Issue 2 (dialect hook for save-mode validation), Issue 3, Issue 4.

Residual risks: the real-server coverage in TestCockroachDBDialectIT may not run in any lane, or may run several times (Issue 1); otherwise the change is isolated to an opt-in dialect. The branch is 18 commits behind dev, but CI is not failing, so no sync is needed now.

Overall assessment: solid, well-scoped work and a prompt fix for the CI failure. Alternative to Issue 1: keep the class where it is but confirm in a CI log that failsafe executes it exactly once; moving it into the E2E module remains my recommendation.

@DanielLeens

Copy link
Copy Markdown
Contributor

Quick status update so this thread isn't sitting on a stale CI fact.

In my last review I flagged the class-name CI failure and then re-reviewed 941e31e40c once it was fixed. Since then:

  • CI is green on this head. Build on 941e31e40c has completed successfully, so the class-name failure I raised is fully resolved and nothing on the CI side is outstanding.
  • The remaining gate has changed, though — it's now merge conflicts. GitHub reports this branch as diverged from dev (behind_by = 37, ahead_by = 4) and mergeable_state: dirty, so dev has moved on since this head was cut. Could you please sync with the latest dev and resolve the conflicts? Once that's pushed and the checks rerun, I'm happy to take another pass.

My source-side conclusion on 941e31e40c is unchanged: no new problems, and the earlier non-blocking items I listed are still the only open notes.

For transparency on what the sync may touch, since the dialect subclasses PostgresDialect: the most likely conflict sites are the dialect factory/option list and whatever PostgresDialect members this dialect overrides (FNV32 splitting, the COUNT(*) row count, and the row converter). If PostgresDialect has changed shape on dev, those overrides are the places worth re-checking after the merge rather than assuming they still line up.

Thanks @goutamadwant — the dialect and its ITs are well put together, and this is just the usual upstream-drift dance at the end.

@DanielLeens

Copy link
Copy Markdown
Contributor

The CI fact cited in my previous review has changed: Build for the current unchanged head is now passing. CI was previously the only remaining blocker, and I do not see a new source-side blocker from Daniel's review. GitHub now reports this branch as having merge conflicts with dev. Please sync with the latest dev and resolve the conflicts first, then rerun the required checks. This merge-state blocker is separate from the now-green Build result. I have read-only review controls, so this COMMENT does not change GitHub's displayed review decision; a write-capable maintainer must perform any final approval or dismissal action.

@goutamadwant
goutamadwant force-pushed the feature/cockroachdb-jdbc branch from 941e31e to ee69740 Compare October 21, 2026 05:37

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, @goutamadwant. I noticed the branch was rebuilt on top of the latest dev (it is now 4 commits ahead and 0 behind, and the merge conflict I reported on Oct 19 is gone) and I re-reviewed the complete current diff at head ee69740c, not only the delta. This time I also checked the real-server test's execution lane against pom.xml and backend.yml (Issue 1).

What Problem Does This PR Solve?

  • User pain point: CockroachDB speaks the PostgreSQL wire protocol, but the PostgreSQL dialect fails on it (no HASHTEXT, pg_class.reltuples is NULL, extra metadata queries while a cursor is open break reads).
  • Fix approach: an explicit CockroachDB dialect (subclass of PostgresDialect) selected only by dialect = "CockroachDB", with FNV32 hash splitting, COUNT(*) row counts, a row converter that avoids result-set metadata queries, and fail-fast rejection of schema changes and unsupported save modes.
  • Summary: bounded read and upsert-based write against pre-created CockroachDB tables through the existing JDBC connector.

1. Code Change Review

1.1 Core Logic Analysis

Production code is the same as what I reviewed before (the rebase only re-parented the commits), and the earlier correctness analysis still holds on the new base.

Jdbc source/sink config (dialect="CockroachDB")
  -> JdbcDialectLoader.load(...) -> CockroachDBDialectFactory.create()   (acceptsURL == false: explicit only)
  -> Source: ChunkSplitter -> CockroachDBDialect.hashModForField -> COALESCE(FNV32(CAST(col AS STRING)), 0) % N
             approximateRowCntStatement -> SQLUtils.countForTable / countForSubquery
             cursor read -> CockroachDBRowConverter.getStringColumnType -> column.getSourceType() (no getMetaData())
  -> Sink: inherited PostgresDialect upsert (INSERT .. ON CONFLICT (keys) DO UPDATE / DO NOTHING)
           JdbcSinkFactory.createSink: only APPEND_DATA + default/IGNORE schema_save_mode
           JdbcSink.supports() == [] and AbstractJdbcSinkWriter.applySchemaChange -> reject (RestoreTableSchemaEvent still accepted)
  -> findCatalog("CockroachDB") -> no catalog factory -> no DDL

Key findings:

  • The normal path (explicit dialect) reaches all of the new logic; PostgreSQL jobs only touch the refactored PostgresJdbcRowConverter.toInternal.
  • The NULL handling in hashModForField (COALESCE(..., 0)) keeps nullable partition keys in bucket 0 instead of dropping them; good catch.
  • The shared-converter refactor is behavior preserving for PostgreSQL: rs.getMetaData().getColumnTypeName(...) moved from every column into the STRING case behind a getStringColumnType(...) hook. metaDataColumnType is only used inside that case, so there is no dangling use.
  • tableSchema.getColumn(name) is columns.get(indexOf(name)), so a missing name would throw IndexOutOfBoundsException. I checked that typeInfo comes from tableSchema.toPhysicalRowDataType() in the same method, so the names always resolve; no bug, just worth knowing.

1.2 Compatibility Impact

Fully compatible. New dialect identifier only. acceptsURL returns false so PostgreSQL URL matching is unchanged (JdbcDialectLoaderTest). JdbcDialect.supportsSchemaChange() is a default method returning true, so existing and third-party dialects are unaffected. No option, serialization, checkpoint or state-format change; no upgrade action.

1.3 Performance / Side-Effect Analysis

  • Hash split is a full scan per split, as the existing PostgreSQL hash strategy is; documented.
  • COUNT(*) row estimation can be expensive on very large tables; the docs call this out and point to enable_concurrent_read = false.
  • No new threads, buffers, locks or retained state.

1.4 Error Handling and Logging

Rejections are explicit (CONFIG_VALIDATION_FAILED) with actionable messages and happen before DDL or writer-state mutation. No logging concerns.

Issue 1: Real-server unit-module test is not run by the unit lane; please make its execution lane explicit

  • Location: seatunnel-connectors-v2/connector-jdbc/src/test/java/.../dialect/cockroachdb/TestCockroachDBDialectIT.java:1
  • Problem description: the root pom.xml surefire configuration excludes **/*IT.java (pom.xml:805), and the unit-test jobs in backend.yml run with -DskipUT=false -DskipIT=true (backend.yml:689, :704). So this class is never executed by the unit lane. The E2E lanes (-DskipUT=true -DskipIT=false ... -pl <module> -am, for example backend.yml:828) would build connector-jdbc via -am and may run it through failsafe, which is an inference from the build files; I could not confirm it from a CI log. Several behaviors are verified only by this class (UUID hash splitting, DECIMAL/BYTES/UUID mapping, secondary-unique-key upsert preserving omitted columns, fresh-metadata-cache cursor read, COUNT(*) for table and filtered query), and JdbcCockroachDBIT does not cover all of them.
  • Potential risk: coverage that silently does not run, or runs in several IT lanes that each start their own CockroachDB container.
  • Best improvement: move these methods into JdbcCockroachDBIT (same image, already in connector-jdbc-e2e-part-1) and delete the src/test copy; keep the mock tests in CockroachDBDialectTest. Alternatively show in a CI log that failsafe executes it exactly once.
  • Severity: Medium
  • Raised by another reviewer: No (carried over from my previous reviews, still open)

Issue 2: Connector-specific validation lives in the shared JdbcSinkFactory

  • Location: JdbcSinkFactory.java:187-195
  • Problem description: the generic factory special-cases DatabaseIdentifier.COCKROACHDB by name to validate data_save_mode / schema_save_mode. The project guideline is to keep connector-specific logic out of shared entry points; the dialect already has validateTableOptions(...), which is the existing pattern.
  • Potential risk: every future catalog-less dialect adds another if to the shared factory.
  • Best improvement: add a default no-op hook on JdbcDialect (for example validateSaveModes(DataSaveMode, SchemaSaveMode)) next to supportsSchemaChange(), implement it in CockroachDBDialect, and call it from the factory. JdbcSinkFactoryTest.cockroachRejectsSaveModesThatWouldOtherwiseBeSkipped already pins the behavior, so the refactor is safe.
  • Severity: Medium
  • Raised by another reviewer: No (carried over, still open)

Issue 3: Avoidable per-row column lookup in the shared PostgreSQL row converter

  • Location: PostgresJdbcRowConverter.java:129-133
  • Problem description: tableSchema.getColumn(typeInfo.getFieldName(fieldIndex)) is evaluated for every STRING column of every row on the PostgreSQL path, but only the CockroachDB override uses the Column; the lookup is a linear indexOf. This is the hot read path.
  • Potential risk: small but real CPU overhead on wide, string-heavy PostgreSQL reads at very large row counts.
  • Best improvement: pass only the field index and let the CockroachDB override resolve the column, or precompute per-field source types once outside the row loop in CockroachDBRowConverter.
  • Severity: Low
  • Raised by another reviewer: No (carried over, still open)

Issue 4: Fully qualified type in code and missing class comment

  • Location: CockroachDBDialect.java tableIdentifier(...) (java.util.stream.Stream.of(...)), CockroachDBDialectFactory.java
  • Problem description: please import java.util.stream.Stream instead of using the fully qualified name; the factory class has no class-level Javadoc while its sibling classes do.
  • Potential risk: style only.
  • Best improvement: add the import and a one-line class comment.
  • Severity: Low
  • Raised by another reviewer: No (carried over, still open)

2. Code Quality Assessment

2.1 Coding Standards

Good overall; core dialect methods carry why-comments (hash, row count, cursor metadata). Remaining gaps are Issue 4.

2.2 Test Coverage and Test Stability

Coverage is broad and the tests can fail for the right reasons: CockroachDBDialectTest asserts exact SQL strings, the no-getMetaData() contract (verify(rs, never()).getMetaData()) and verifyNoInteractions(connection) on rejected schema changes; JdbcSinkWriterSchemaChangeSafetyTest asserts the writer schema and output format are untouched after a rejected event, and that RestoreTableSchemaEvent is still accepted; JdbcSinkFactoryTest pins both the supported and rejected save modes and the PostgreSQL contrast; PostgresJdbcRowConverterTest guards the PostgreSQL path. JdbcCockroachDBIT replays the same bounded input twice and asserts no duplicates and a preserved omitted column.
Stability rating: Stable. JdbcCockroachDBIT.java and TestCockroachDBDialectIT.java use mapped ports, a log-message wait with a 2 minute timeout, and no Thread.sleep or order-dependent assertions. The only concern is placement (Issue 1).

2.3 Documentation Updates

docs/en and docs/zh are updated for both source and sink and are consistent with each other and with the code (explicit dialect, APPEND_DATA only, no table_options, no catalog, no schema evolution). No change needed.

3. Architectural Soundness

3.1 Elegance of the Solution

Long-term-friendly dialect extension with a deliberately narrow scope. Issue 2 is the one structural improvement I would still like to see.

3.2 Maintainability

Clear boundaries and explicit failures.

3.3 Extensibility

supportsSchemaChange() is reusable for other catalog-less dialects.

3.4 Historical-Version Compatibility

Compatible; no upgrade action, no config or state changes.

4. Issue Summary

Number Issue Location Severity
Issue 1 Real-server test excluded from unit lane; execution lane unconfirmed TestCockroachDBDialectIT.java:1 Medium
Issue 2 CockroachDB-specific save-mode check in shared sink factory JdbcSinkFactory.java:187-195 Medium
Issue 3 Per-row column lookup added to shared PostgreSQL path PostgresJdbcRowConverter.java:129-133 Low
Issue 4 Fully qualified Stream usage, missing class comment CockroachDBDialect.java Low

5. Merge Recommendation

Conclusion: Ready to merge after fixes

  1. Blockers - must be fixed
    • No source-side blocker. The only gate is CI: Build for ee69740c is still in progress. The conflict with dev from my earlier note is resolved (mergeable is true, 0 commits behind).
  2. Recommended fixes - non-blocking
    • Issue 1 (move the real-server tests into JdbcCockroachDBIT), Issue 2 (dialect hook for save-mode validation), Issue 3, Issue 4.

CI state for head ee69740c, read from your fork run 39550571227 while it was still running: Code style, License header, Build website and the first Iceberg/JDBC integration parts passed. The four unit-test jobs and both edge-agent-it jobs failed in a single case, LLMBooleanOutputTest.readsLegacyFactoryWrapperWithValidationDisabled (InvalidClassException on AbstractMultiCatalogTransform), which is not in this diff; it is tracked in #12929 and also fails on dev. Because that Maven reactor stopped at seatunnel-transforms-v2, I cannot yet say the connector-jdbc unit tests (including your new ones) were executed in those jobs, so please check that after #12929 is resolved or when you rerun. Dead links failed on a 404 for an external InterSystems IRIS driver URL that this PR does not add or change. Several integration jobs were still running, so the CI result is not final.

Overall assessment: solid, well-scoped work and a clean rebase. Once the unrelated unit-test failure is cleared on dev and your run finishes green, the source is ready from my side; the four items above are improvements I would love to see but none blocks merge.

@DanielLeens

Copy link
Copy Markdown
Contributor

A CI-status correction on unchanged head ee69740c183f8394e1b79d694849f11dbeb7d18a: my previous note described a queued/pending Build. The current Build is now failure, so the old pending guidance is obsolete. Failed job families: Run / Dead links, Run / unit-test, Run / edge-agent-it.

Concrete inspected log evidence (one representative JDK/OS per failed family; this does not claim every matrix leg has the identical cause):

  • Run / Dead links: the InterSystems IRIS driver URL ending in JDK18/intersystems-jdbc-3.8.4.jar returns HTTP 404.
  • Run / edge-agent-it (11, ubuntu-latest): LLMBooleanOutputTest.readsLegacyFactoryWrapperWithValidationDisabled fails with InvalidClassException on AbstractMultiCatalogTransform.
  • Run / unit-test (11, ubuntu-latest): LLMBooleanOutputTest.readsLegacyFactoryWrapperWithValidationDisabled fails with InvalidClassException on AbstractMultiCatalogTransform.

Upstream/next-step check:

The archived LLM fixture is tracked in #12929; proposed fix #12938 remains open. Latest dev (99ea16b9d6bdce452d4c4955581ccc7236a81bbd) still has no explicit historical UID on AbstractMultiCatalogTransform. Syncing today will not fix that observed failure. Once the fix lands in dev, sync and rerun the affected failed jobs. Keep unrelated transform-serialization changes out of this PR.

The same IRIS driver link is still in the latest dev JDBC docs (EN source line 354, ZH source line 350); no base-branch correction was found. A simple sync or blind rerun is not a demonstrated fix for a persistent 404. This shared documentation link should be corrected in its own focused change, then incorporated into affected branches; it is not a reason to change this connector's runtime dependencies.

My previous source-level conclusion remains unchanged: no outstanding source blocker from my side. This is a CI-status follow-up, not a fresh full code review or formal approval. The branch is ahead 4, behind 9, compare diverged against dev; this drift is recorded independently, not used as a generic sync request. A successful required Build and write-capable maintainer approval remain merge gates. Thanks for the contribution and for keeping the fix focused.

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks for your patience. The upstream status has changed since my preceding note: #12938 merged into dev at 2026-10-22 10:26 UTC (merge cc54bb433357b4cb45db9cd5d0743589c3111b79). I checked that current dev contains the merge and that its diff restores the historical AbstractMultiCatalogTransform serialization UID and makes the construction-only config transient. My earlier instruction to wait for that fix is now superseded.

The archived-wrapper LLMBooleanOutputTest.readsLegacyFactoryWrapperWithValidationDisabled / InvalidClassException is the shared unit-test failure identified in the preceding review (affected job). This head is still ee69740c183f8394e1b79d694849f11dbeb7d18a; the current dev comparison is diverged, ahead 4 / behind 11. Please sync with the latest dev and rerun the affected unit checks first, plus any stage whose log showed the same archived-wrapper error. Keep unrelated transform-serialization patches out of this PR. This is a targeted remedy for that known upstream failure, not a claim that syncing fixes every failed stage.

Other failed job families in the same head's run are Dead links, edge-agent-it. Their causes/results remain separate; this upstream patch does not establish that they pass. My previous source-level conclusion is unchanged. Required CI and the final write-capable maintainer review remain gates. This is a CI-status follow-up only, with no new source findings or fresh full-review claim.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for syncing with dev, @goutamadwant. The new head is 2a58fe6c, a normal merge of dev on top of ee69740c that I reviewed last round. I re-read the complete PR diff against current dev (21 files) from scratch, not only the increment. This is a static analysis; nothing was built or executed locally.

What Problem Does This PR Solve?

  • User pain point: CockroachDB speaks the PostgreSQL wire protocol, but the PostgreSQL dialect fails on it (no HASHTEXT, pg_class.reltuples is NULL, extra metadata queries while a cursor is open break reads).
  • Fix approach: an explicit CockroachDB dialect (subclass of PostgresDialect) selected only by dialect = "CockroachDB", with FNV32 hash splitting, COUNT(*) row counts, a row converter that avoids result-set metadata queries, and fail-fast rejection of schema changes and unsupported save modes.
  • One sentence: bounded read and upsert-based write against pre-created CockroachDB tables through the existing JDBC connector.

1. Code Change Review

1.1 Core Logic Analysis

I compared every file of the PR between ee69740c and this head: all 21 PR files are identical, so the merge only brought in unrelated dev content. My earlier analysis therefore still holds on the new base.

Jdbc source/sink config (dialect="CockroachDB")
  -> JdbcDialectLoader.load(...) -> CockroachDBDialectFactory.create()   (acceptsURL == false: explicit only)
  -> Source: ChunkSplitter -> CockroachDBDialect.hashModForField -> COALESCE(FNV32(CAST(col AS STRING)), 0) % N
             approximateRowCntStatement -> SQLUtils.countForTable / countForSubquery
             cursor read -> CockroachDBRowConverter.getStringColumnType -> column.getSourceType() (no getMetaData())
  -> Sink: inherited PostgresDialect upsert (INSERT .. ON CONFLICT (keys) DO UPDATE / DO NOTHING)
           JdbcSinkFactory.createSink: only APPEND_DATA + default/IGNORE schema_save_mode
           JdbcSink.supports() == [] and AbstractJdbcSinkWriter.applySchemaChange -> reject (RestoreTableSchemaEvent still accepted)
  -> findCatalog("CockroachDB") -> no catalog factory -> no DDL

The normal path (explicit dialect) reaches all of the new logic; PostgreSQL jobs only touch the refactored PostgresJdbcRowConverter.toInternal, where the getMetaData().getColumnTypeName(...) call moved into the STRING case behind a getStringColumnType(...) hook (behavior preserving for PostgreSQL).

1.2 Compatibility Impact

Fully compatible. New dialect identifier only; acceptsURL returns false so PostgreSQL URL matching is unchanged; JdbcDialect.supportsSchemaChange() is a default method returning true, so existing dialects are unaffected. No option, serialization, checkpoint or state-format change; no upgrade action.

1.3 Performance / Side-Effect Analysis

The hash split is a full scan per split, like the existing PostgreSQL hash strategy, and COUNT(*) row estimation can be expensive on very large tables (both documented). No new threads, buffers, locks or retained state. Issue 3 is the only hot-path cost.

1.4 Error Handling and Logging

Rejections are explicit (CONFIG_VALIDATION_FAILED) with actionable messages, and happen before DDL or writer-state mutation. No logging concerns.

Issue 1: Real-server unit-module test is not run by the unit lane

  • Location: seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/cockroachdb/TestCockroachDBDialectIT.java:1
  • Problem: root pom.xml:805 excludes **/*IT.java from surefire, and the unit-test jobs run with -DskipUT=false -DskipIT=true, so this class is not executed by the unit lane. Several behaviors are verified only here (UUID hash splitting, DECIMAL/BYTES/UUID mapping, secondary-unique-key upsert preserving omitted columns, fresh-metadata-cache cursor read, COUNT(*) for table and filtered query), and JdbcCockroachDBIT does not cover all of them. Whether an IT lane runs it through failsafe is my inference from the build files; I could not confirm it from a CI log.
  • Potential risk: coverage that silently does not run, or runs in several IT lanes that each start their own CockroachDB container.
  • Best improvement: move these methods into JdbcCockroachDBIT (same image, already in connector-jdbc-e2e-part-1) and delete the src/test copy, keeping the mock tests in CockroachDBDialectTest; or show in a CI log that failsafe executes it exactly once.
  • Severity: Medium
  • Raised by another reviewer: No (carryover from my previous reviews)

Issue 2: Connector-specific validation lives in the shared JdbcSinkFactory

  • Location: JdbcSinkFactory.java:187-195
  • Problem: the generic factory special-cases DatabaseIdentifier.COCKROACHDB by name to validate data_save_mode and schema_save_mode; connector-specific logic should stay out of shared entry points, and the dialect already has the validateTableOptions(...) pattern.
  • Potential risk: every future catalog-less dialect adds another if to the shared factory.
  • Best improvement: add a default no-op hook on JdbcDialect (for example validateSaveModes(DataSaveMode, SchemaSaveMode)) next to supportsSchemaChange(), implement it in CockroachDBDialect, and call it from the factory. JdbcSinkFactoryTest.cockroachRejectsSaveModesThatWouldOtherwiseBeSkipped already pins the behavior.
  • Severity: Medium
  • Raised by another reviewer: No (carryover)

Issue 3: Avoidable per-row column lookup in the shared PostgreSQL row converter

  • Location: PostgresJdbcRowConverter.java:129-133
  • Problem: tableSchema.getColumn(typeInfo.getFieldName(fieldIndex)) runs for every STRING column of every row on the PostgreSQL path, but only the CockroachDB override uses the Column; the lookup is a linear indexOf.
  • Potential risk: small CPU overhead on wide, string-heavy PostgreSQL reads at very large row counts.
  • Best improvement: pass only the field index and let the CockroachDB override resolve the column, or precompute per-field source types once outside the row loop in CockroachDBRowConverter.
  • Severity: Low
  • Raised by another reviewer: No (carryover)

Issue 4: Fully qualified type in code and missing class comment

  • Location: CockroachDBDialect.java:77 (java.util.stream.Stream.of(...)), CockroachDBDialectFactory.java:27
  • Problem: please import java.util.stream.Stream; the factory class has no class-level Javadoc while sibling classes do.
  • Potential risk: style only.
  • Best improvement: add the import and a one-line class comment.
  • Severity: Low
  • Raised by another reviewer: No (carryover)

2. Code Quality Assessment

2.1 Coding Standards

Good overall; core dialect methods carry why-comments. Remaining gaps are Issue 4.

2.2 Test Coverage and Test Stability

The tests can fail for the right reasons: CockroachDBDialectTest asserts exact SQL and the no-getMetaData() contract; JdbcSinkWriterSchemaChangeSafetyTest asserts the writer schema is untouched after a rejected event and that RestoreTableSchemaEvent is still accepted; JdbcSinkFactoryTest pins supported and rejected save modes; PostgresJdbcRowConverterTest guards the PostgreSQL path; JdbcCockroachDBIT replays the same input twice and asserts no duplicates. Stability rating: Stable (mapped ports, log-message wait with a 2 minute timeout, no Thread.sleep); the only concern is placement (Issue 1).

2.3 Documentation Updates

docs/en and docs/zh for source and sink are consistent with each other and with the code. No change needed.

3. Architectural Soundness

3.1 Elegance of the Solution

Long-term-friendly dialect extension with a deliberately narrow scope; Issue 2 is the one structural improvement I would still like to see.

3.2 Maintainability

Clear boundaries and explicit failures.

3.3 Extensibility

supportsSchemaChange() is reusable for other catalog-less dialects.

3.4 Historical-Version Compatibility

Compatible; no upgrade action, no config or state changes.

4. Issue Summary

Number Issue Location Severity
1 Real-server test excluded from unit lane; execution lane unconfirmed TestCockroachDBDialectIT.java:1 Medium
2 CockroachDB-specific save-mode check in shared sink factory JdbcSinkFactory.java:187-195 Medium
3 Per-row column lookup added to shared PostgreSQL path PostgresJdbcRowConverter.java:129-133 Low
4 Fully qualified Stream usage, missing class comment CockroachDBDialect.java:77 Low

5. Merge Recommendation

Conclusion: Ready to merge after fixes

Blockers

  • No source-side blocker. The only gate is CI: the Build check for 2a58fe6c has just been queued (fork run 39903840703), so there is no result for this head yet. Merge state is blocked only because the required check and a write-capable maintainer approval are pending; there is no conflict (the branch is 1 commit behind dev and diverged only through the merge itself).
  • The earlier failures on ee69740c (LLMBooleanOutputTest archived-wrapper InvalidClassException, tracked in #12929 and fixed by #12938) are now in dev and included in this merge. The Dead links failure was an external InterSystems IRIS driver URL (404) that this PR does not touch; if it recurs it is a shared docs problem, not a reason to change this connector.

Recommended fixes (non-blocking)

  • Issue 1, Issue 2, Issue 3, Issue 4 above.

Overall assessment: solid, well-scoped work with broad tests and consistent bilingual docs. Once the new Build is green, the source is ready from my side. Daniel has read-only review controls, so the final approval has to come from a maintainer with write access.

Better alternative: the same design with the save-mode check moved behind a dialect hook (Issue 2); no different overall approach is needed.

…conflicts

Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for syncing again, @goutamadwant. The new head is 1c61d4cc628f69081fe5e720ec05343cc7fb63bf, a merge of dev (including the Jdbc doc fixes from #12911 and #12771) on top of 2a58fe6c, which I reviewed last round. I compared every PR file between the two heads. All 17 source and test files are identical, and only the four Jdbc docs changed (EN/ZH source and sink), which is the conflict resolution. I re-read the complete PR diff against current dev anyway. The branch is now 0 commits behind dev with no conflicts.

One correction to my last review: its conclusion label said "Ready to merge after fixes", although I listed no blocker. The open items were all non-blocking then and still are, so the label below is now "Ready to merge" to match.

What Problem Does This PR Solve?

  • User pain point: CockroachDB speaks the PostgreSQL wire protocol, but the PostgreSQL dialect fails on it: there is no HASHTEXT, pg_class.reltuples is NULL, and extra metadata queries while a cursor is open break reads.
  • Fix approach: an explicit CockroachDB dialect (a subclass of PostgresDialect) selected only by dialect = "CockroachDB". It uses FNV32 hash splitting and COUNT(*) row counts, adds a row converter that avoids result-set metadata queries, and rejects schema changes and unsupported save modes up front.
  • One-sentence summary: bounded reads and upsert-based writes against pre-created CockroachDB tables through the existing JDBC connector.

1. Code Change Review

1.1 Core Logic Analysis

Production code is unchanged since my last review:

Jdbc source/sink config (dialect="CockroachDB")
  -> JdbcDialectLoader.load(...) -> CockroachDBDialectFactory.create()   (acceptsURL == false: explicit only)
  -> Source: ChunkSplitter -> CockroachDBDialect.hashModForField -> COALESCE(FNV32(CAST(col AS STRING)), 0) % N
             approximateRowCntStatement -> SQLUtils.countForTable / countForSubquery
             cursor read -> CockroachDBRowConverter.getStringColumnType -> column.getSourceType() (no getMetaData())
  -> Sink: inherited PostgresDialect upsert (INSERT .. ON CONFLICT (keys) DO UPDATE / DO NOTHING)
           JdbcSinkFactory.createSink: only APPEND_DATA + default/IGNORE schema_save_mode
           JdbcSink.supports() == [] and AbstractJdbcSinkWriter.applySchemaChange -> reject (RestoreTableSchemaEvent still accepted)
  -> findCatalog("CockroachDB") -> no catalog factory -> no DDL

The normal path (explicit dialect) reaches all of the new logic. PostgreSQL jobs only touch the refactored PostgresJdbcRowConverter.toInternal, which still behaves the same for PostgreSQL. The dialect is registered through @AutoService(JdbcDialectFactory.class) inside the existing connector-jdbc artifact, so no plugin-mapping or dist change is needed.

Merged docs: the CockroachDB sections and dialect-table rows sit cleanly on top of the updated dev content in all four files. I found nothing from #12911 or #12771 that was dropped or reverted, and the EN and ZH texts still match each other and the code (APPEND_DATA only, default/IGNORE schema_save_mode, table_options rejected, explicit-dialect selection).

1.2 Compatibility Impact

Fully compatible. This adds a new dialect identifier only. acceptsURL returns false, so PostgreSQL URL matching is unchanged. JdbcDialect.supportsSchemaChange() is a default method returning true, so existing dialects are not affected. There are no option, serialization, checkpoint or state changes.

1.3 Performance / Side-Effect Analysis

Unchanged: the hash split is a full scan per split, and the COUNT(*) row estimate can be expensive on large tables (both documented). Issue 3 is the only cost on a hot path.

1.4 Error Handling and Logging

Rejections are explicit (CONFIG_VALIDATION_FAILED) and happen before any DDL or writer-state change. There are no logging concerns. Formal issues (all carried over from my previous reviews, all non-blocking):

Issue 1: The real-server test lives in the unit module, and its execution lane is implicit

  • Location: seatunnel-connectors-v2/connector-jdbc/src/test/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/cockroachdb/TestCockroachDBDialectIT.java:1
  • Problem: surefire excludes **/*IT.java (pom.xml:805), so the unit lane never runs it. Failsafe is a build plugin for every module, so the class only runs when an IT lane builds connector-jdbc through -am with -DskipIT=false, possibly in several JDBC E2E parts. Several behaviors are covered only here: UUID hash splitting, DECIMAL/BYTES/UUID mapping, a secondary-unique-key upsert that preserves omitted columns, and COUNT(*) for a table and a filtered query. Other connectors use the same Test*IT pattern (for example TestVitessSourceReaderIT), so this is a placement concern, not a rule violation.
  • Risk: important coverage runs only as a side effect of other lanes, and possibly more than once.
  • Best improvement: fold these methods into JdbcCockroachDBIT, or link a CI log on this head showing that it ran.
  • Severity: Medium
  • Raised by another reviewer: No (carryover)

Issue 2: CockroachDB-specific save-mode check in the shared JdbcSinkFactory

  • Location: seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkFactory.java:187-195
  • Problem: the generic factory checks DatabaseIdentifier.COCKROACHDB by name.
  • Risk: every future catalog-less dialect would add another branch to a shared entry point.
  • Best improvement: a default no-op JdbcDialect.validateSaveModes(DataSaveMode, SchemaSaveMode) hook, overridden in CockroachDBDialect. JdbcSinkFactoryTest already pins the behavior.
  • Severity: Medium
  • Raised by another reviewer: No (carryover)

Issue 3: Per-row column lookup added to the shared PostgreSQL row converter

  • Location: seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/psql/PostgresJdbcRowConverter.java:129-133
  • Problem: tableSchema.getColumn(...) (a linear indexOf) runs for every STRING field of every row on the PostgreSQL path, but only the CockroachDB override uses the result.
  • Risk: small CPU overhead on wide, string-heavy PostgreSQL reads at very large row counts.
  • Best improvement: pass the field index and resolve the column only in the override, or precompute the source types once per reader.
  • Severity: Low
  • Raised by another reviewer: No (carryover)

Issue 4: Fully qualified Stream and missing class Javadoc

  • Location: CockroachDBDialect.java:77, CockroachDBDialectFactory.java:27
  • Problem / improvement: import java.util.stream.Stream, and add a one-line class comment to the factory.
  • Severity: Low
  • Raised by another reviewer: No (carryover)

2. Code Quality Assessment

2.1 Coding Standards

Good overall; the core dialect methods explain why they do what they do. Only Issue 4 remains.

2.2 Test Coverage and Test Stability

The tests are unchanged and fail for the right reasons. CockroachDBDialectTest checks the exact SQL and that no getMetaData() call happens. JdbcSinkWriterSchemaChangeSafetyTest checks that writer state is untouched after a rejected event. JdbcSinkFactoryTest pins the save-mode behavior, PostgresJdbcRowConverterTest guards the PostgreSQL path, and JdbcCockroachDBIT covers replay with idempotent upserts. Stability rating: Stable (mapped ports, wait for a log message with a timeout, no sleeps). The only concern is placement (Issue 1).

2.3 Documentation Updates

The EN/ZH source and sink docs are consistent with each other and with the code after the merge. No change is needed.

3. Architectural Soundness

3.1 Elegance

This is a long-term dialect extension with a deliberately narrow scope. Issue 2 is the one structural improvement I would still suggest.

3.2 Maintainability

Clear boundaries, and unsupported operations fail explicitly.

3.3 Extensibility

supportsSchemaChange() can be reused by other catalog-less dialects.

3.4 Historical-Version Compatibility

Compatible; no upgrade action needed.

4. Issue Summary

No. Issue Location Severity
1 Real-server test placement / implicit execution lane TestCockroachDBDialectIT.java:1 Medium
2 CockroachDB-specific save-mode check in shared sink factory JdbcSinkFactory.java:187-195 Medium
3 Per-row column lookup on shared PostgreSQL path PostgresJdbcRowConverter.java:129-133 Low
4 Fully qualified Stream, missing class Javadoc CockroachDBDialect.java:77 Low

5. Merge Recommendation

Conclusion: Ready to merge

  • Blockers (must fix): None. No blocking issues found.
  • Recommended fixes (non-blocking): Issues 1-4, here or as a follow-up. Issue 2 is the one I would most like to see.
  • CI: the fork Build run for this head is still in progress with its jobs queued, so there is no verified result yet. The earlier LLMBooleanOutputTest failure is fixed in dev by #12938 and included here. Merge still needs a green Build and a committer approval.
  • Overall assessment: solid, well-scoped work with broad tests and consistent bilingual docs, and the doc conflicts were resolved cleanly. Residual risk is limited to the test-placement question in Issue 1.
  • Better alternative? Only the same design with the save-mode check moved behind a dialect hook (Issue 2).

Thanks for keeping this up to date.

Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow-up, @goutamadwant. I re-reviewed the PR at head f8a5440d7. Compared with 1c61d4cc6, which I reviewed last, the head adds one commit ("Isolate CockroachDB validation and integration coverage") touching 8 files; I re-read that diff and traced the call chain against the new head. Review is by code reading only, nothing was executed locally.

All four non-blocking items from my last review are addressed by this commit:

  • Previous Issue 1 (test placement): TestCockroachDBDialectIT moved out of the unit module into the JDBC E2E part-1 lane as JdbcCockroachDBDialectIT (same module as JdbcCockroachDBIT), so it no longer runs only as a side effect of other lanes.
  • Previous Issue 2 (CockroachDB check in shared factory): JdbcSinkFactory now calls a new default no-op JdbcDialect.validateSaveModes(...), and CockroachDBDialect overrides it with the same rule and message.
  • Previous Issue 3 (per-row lookup on the PostgreSQL path): getStringColumnType now receives (rs, tableSchema, typeInfo, fieldIndex); the base implementation calls getColumnTypeName(fieldIndex + 1) and only the CockroachDB override resolves the column by name.
  • Previous Issue 4: Stream is imported and the factory has a class comment.

What Problem Does This PR Solve?

  • User pain point: CockroachDB speaks the PostgreSQL wire protocol, but the PostgreSQL dialect fails on it (no HASHTEXT, NULL pg_class.reltuples, extra metadata queries break reads while a cursor is open).
  • Fix approach: an explicit CockroachDB dialect (subclass of PostgresDialect) selected only by dialect = "CockroachDB", using FNV32 hash splitting, COUNT(*) row counts, a row converter that avoids result-set metadata queries, and up-front rejection of schema changes and unsupported save modes.
  • One-sentence summary: bounded reads and upsert-based writes against pre-created CockroachDB tables through the existing JDBC connector.

1. Code Change Review

1.1 Core Logic Analysis

Key before/after of the new commit:

// JdbcSinkFactory.createSink
// before: if (DatabaseIdentifier.COCKROACHDB.equals(dialect.dialectName()) && (...)) throw ...
// after:  dialect.validateSaveModes(dataSaveMode, schemaSaveMode);   // JdbcDialect default: no-op

// PostgresJdbcRowConverter
// before: getStringColumnType(rs, tableSchema.getColumn(name), resultSetIndex)   // linear lookup per STRING field per row
// after:  getStringColumnType(rs, tableSchema, typeInfo, fieldIndex)             // base: rs.getMetaData().getColumnTypeName(fieldIndex + 1)

Runtime path:

Jdbc source/sink config (dialect="CockroachDB")
  -> JdbcDialectLoader.load -> CockroachDBDialectFactory.create (acceptsURL == false: explicit only)
  -> Source: ChunkSplitter -> CockroachDBDialect.hashModForField -> COALESCE(FNV32(CAST(col AS STRING)), 0) % N
             row count -> COUNT(*)
             cursor read -> CockroachDBRowConverter.getStringColumnType -> column.getSourceType() (no getMetaData())
  -> Sink: inherited PostgresDialect upsert (ON CONFLICT (keys) DO UPDATE / DO NOTHING)
           JdbcSinkFactory.createSink -> dialect.validateSaveModes (APPEND_DATA + default/IGNORE only)
           JdbcSink.supports() == [] and AbstractJdbcSinkWriter schema-change rejection

The normal path (explicit dialect) reaches all new logic. Behavior for PostgreSQL is preserved: the base getStringColumnType returns the same getColumnTypeName for the same column (fieldIndex + 1 equals the previous resultSetIndex), and the only other subclass of PostgresJdbcRowConverter in the module, DsqlJdbcRowConverter, does not override this method, so the signature change is safe. The save-mode rule and exception message are identical to the previous inline check, and JdbcSinkFactoryTest still pins it.

1.2 Compatibility Impact

Fully compatible. A new dialect identifier is added; acceptsURL stays false so PostgreSQL URL matching is unchanged. validateSaveModes and supportsSchemaChange are default methods, so existing dialects behave as before. getStringColumnType is protected and only the CockroachDB override was affected. No option, serialization, checkpoint or state change.

1.3 Performance / Side-Effect Analysis

The per-row column lookup is gone from the PostgreSQL hot path (it now runs only in the CockroachDB override, which is a cheap name lookup). Hash splitting does a full scan per split and COUNT(*) can be expensive on large tables; both are documented.

1.4 Error Handling and Logging

Rejections are explicit (CONFIG_VALIDATION_FAILED) and happen before any DDL or writer-state change. No logging concerns. No new issues found.

2. Code Quality Assessment

2.1 Coding Standards

Good: no fully qualified types in code bodies, class Javadoc on the new factory, and explanatory comments on the converter override.

2.2 Test Coverage and Test Stability

CockroachDBDialectTest checks exact SQL and the absence of getMetaData(); JdbcSinkWriterSchemaChangeSafetyTest checks that writer state is untouched after a rejected event; JdbcSinkFactoryTest pins save-mode rejection; the new PostgresJdbcRowConverterTest#testStringReadDoesNotLookUpColumnByName fails if the by-name lookup is reintroduced on the PostgreSQL path; JdbcCockroachDBIT and JdbcCockroachDBDialectIT cover real-server behavior. Stability rating: Stable (mapped ports, log-message waits with timeouts, no sleeps; nothing was weakened).

2.3 Documentation Updates

EN/ZH source and sink Jdbc docs are unchanged in this commit and remain consistent with the code.

3. Architectural Soundness

3.1 Elegance

Long-term dialect extension with a narrow scope; the save-mode check now lives behind a dialect hook instead of a name check in the shared factory.

3.2 Maintainability

Clear boundaries; unsupported operations fail explicitly.

3.3 Extensibility

validateSaveModes and supportsSchemaChange can be reused by other catalog-less dialects.

3.4 Historical-Version Compatibility

Compatible; no upgrade action needed.

4. Issue Summary

No open issues. Previous Issues 1-4 are fixed on this head.

5. Merge Recommendation

Conclusion: Ready to merge

Blockers (must fix): none. Recommended fixes (non-blocking): none.

CI for f8a5440d7: the apache-side Build check is pending and the fork run (40160509252) is still queued, so there is no verified result yet. Because this commit moves an IT class into the JDBC E2E part-1 lane, please confirm in the Build run that JdbcCockroachDBDialectIT and JdbcCockroachDBIT actually execute and pass. The branch is 8 commits behind dev with no conflicts, so no sync is needed unless CI shows an unrelated failure. Merge also needs a committer approval (review decision is still required).

Overall assessment: solid, well-scoped work, and every note from earlier rounds is now resolved. Thanks for the careful follow-through!

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing all four follow-up notes. I re-read the complete current twenty-one-file diff and traced the new dialect through source splitting, fresh-cursor conversion and generated writes. The server test now lives in JDBC E2E, save-mode validation is a dialect hook, PostgreSQL no longer pays the extra schema-column lookup, and the factory/style comments are addressed. No new blocking finding was found. I also checked the actual selective CI logs: both new CockroachDB test classes pass on JDK 11 and 17, rather than inferring coverage from a green aggregate.

What problem this PR solves

  • User pain: A PostgreSQL wire URL alone selects PostgreSQL behavior that is unsuitable for CockroachDB: HASHTEXT is unavailable, reltuples is not a usable count, and result-set metadata queries can conflict with an open read cursor.
  • Fix approach: Add an explicitly selected PostgreSQL-compatible CockroachDB dialect with FNV32/null-safe hash splitting, actual counts, schema-based string conversion and clearly rejected unsupported DDL/save modes.
  • One-line summary: Support bounded reads and replay-safe keyed writes against existing CockroachDB tables through the JDBC connector.

Example: A nullable STRING or UUID partition key is assigned to exactly one of three hash splits, including its NULL row. Replaying an input with an existing unique-key value updates only incoming non-key columns and preserves omitted target columns.

1. Code-change review

1.1 Core logic analysis

All twenty-one files (+1306/-6; complete 1582-line diff), four bilingual documentation sections, all new production classes, shared PostgreSQL/writer/factory changes, complete UTs and both complete integration classes/config were read. The complete target-relative diff was read at f8a5440d729d36906866f0cdc72fb61d2933b04d, not just the latest commit. A focused dialect extension with additive capability defaults; no new connector artifact or driver is introduced.

Before / after:

PostgreSQL URL alone -> existing PostgreSQL factory (unchanged). Explicit dialect=CockroachDB -> new AutoService factory; acceptsURL returns false.
HASHTEXT / reltuples / per-result metadata queries -> COALESCE(FNV32(CAST(key AS STRING)),0)%N / COUNT(*) / discovered sourceType for STRING conversion.
PostgreSQL converter previously fetched metadata for every field -> only STRING calls getStringColumnType; Cockroach override resolves sourceType locally.
Shared factory name-specific save-mode branch -> dialect.validateSaveModes; default no-op preserves existing dialects.
Schema-change writer now rejects unsupported physical DDL before schema mutation/flush, while local RestoreTableSchemaEvent remains allowed.

Complete relevant execution chain:

JdbcSourceFactory/JdbcSinkFactory -> JdbcConnectionConfig explicit dialect -> JdbcDialectLoader.load -> AutoService-discovered CockroachDBDialectFactory
 -> acceptsURL=false preserves PostgreSQL URL discovery; create(compatible_mode,fieldIde) constructs new dialect
Source setup -> JdbcCatalogUtils.findCatalog returns empty for CockroachDB -> existing JDBC metadata fallback -> discovered table schema/native types
 -> JdbcSourceSplitEnumerator:82 -> ChunkSplitter.create:77 / generateSplits:108 (single split if concurrent read disabled)
 -> fixed query/partition path or dynamic table path -> hashModForField:90 produces null-safe FNV32 equality buckets
 -> dynamic count -> approximateRowCntStatement:102 -> existing SQLUtils COUNT(table/subquery), statements/results close
 -> JdbcSourceReader -> JdbcInputFormat creates converter at runtime (:94), opens cursor statement -> toInternal (:361)
 -> PostgresJdbcRowConverter.toInternal:126 -> only STRING invokes protected getter; CockroachDBRowConverter:35 uses schema sourceType, not ResultSetMetaData
Sink creation -> validateTableOptions + validateSaveModes before writer -> no optional catalog/save-mode handler for CockroachDB
 -> JdbcSinkWriter -> JdbcOutputFormatBuilder -> inherited PostgresDialect.getUpsertStatement:184
 -> INSERT ... ON CONFLICT(configured keys) DO UPDATE incoming non-key fields / key-only DO NOTHING -> batched writes and existing commit lifecycle
 -> repeated non-null matching key updates the same target; nullable unique keys retain database NULL conflict semantics
Schema event -> JdbcSink.supports returns empty; defensive AbstractJdbcSinkWriter.applySchemaChange:74 rejects physical event before mutation/prepareCommit
 -> RestoreTableSchemaEvent remains local runtime recovery, no physical DDL
Reader/writer close owns existing JDBC connections/statements; no new scheduler or checkpoint-state owner.

Key findings:

  • Normal explicitly configured CockroachDB jobs reach the new behavior. Ordinary PostgreSQL URLs and explicit Postgres retain their original selection and converter semantics.
  • NULL hash keys map to bucket zero; real-server tests enumerate STRING/UUID buckets and numeric dynamic splits with exact row-set and no-duplicate assertions.
  • The fresh-reader-connection test avoids schema-discovery metadata cache masking the original cursor problem; it also covers explicit schemas with no sourceType.
  • Inherited ON CONFLICT preserves the configured secondary unique conflict target and omitted columns; it deliberately avoids the different physical-primary-key semantics of UPSERT shorthand.
  • Unsupported table options, schema save/data modes and physical schema evolution are rejected before unsafe side effects. Catalog discovery/automatic DDL, XA, CDC and range/auto string support are expressly outside this first scope.

Community context: There are no non-Daniel reviews, discussion replies or inline findings in the retrieved community input. All four Daniel carryovers are addressed: Issue 1 moves the real-server suite into connector-jdbc-e2e-part-1 and current CI proves it executes; Issue 2 uses the new default dialect validation hook; Issue 3 removes the extra column-name lookup from the shared PostgreSQL path; Issue 4 adds the factory Javadoc/import. Prior technical approval was conditional on then-pending CI; the current exact-head evidence is now successful and replaces the older LLM/website/edge-job guidance.

1.2 Compatibility impact

Compatible for existing JDBC configuration and PostgreSQL jobs. The new dialect name is opt-in and does not participate in URL autodetection. New JdbcDialect defaults are additive, no-op save validation and true schema-change capability, preserving existing implementations. No existing config/default, external protocol, checkpoint payload or public method is removed. PostgresDialect explicitly retains its serialization UID; runtime converters are created by the existing input/output owners rather than added as checkpoint state. This is not a claim that arbitrary archived standalone converter objects have a new cross-version persistence guarantee. No migration is required for existing PostgreSQL jobs.

1.3 Performance / side effects

The production cost and ownership implications are described below. FNV32 hash predicates can scan the input once per split, and exact COUNT(*) replaces an inexpensive estimate; large tables/queries can incur significant submission/splitting work. The docs correctly offer concurrent-read=false when one reader is enough. String conversion uses a per-STRING schema lookup on CockroachDB, while the old shared PostgreSQL column lookup concern is removed; numeric PostgreSQL fields no longer query result metadata. No new thread, cache, lock, retry policy or distributed resource is added. Existing transaction batching and commit boundaries remain. Keyed replay relies on a matching non-null primary/unique constraint; it is not XA exactly-once and nullable unique keys are explicitly qualified. Statement/result resources close with existing connection owners.

1.4 Error handling and logging

The existing exception and logging boundaries remain in place. Table-option/save-mode/schema capability violations use CONFIG_VALIDATION_FAILED with CockroachDB context. The writer guard runs before schema mutation, prepareCommit or physical DDL, and tests verify untouched state/output format. RestoreTableSchemaEvent is intentionally permitted as runtime-only schema refresh. Query/count failures propagate through the existing JDBC errors rather than returning a false empty estimate. No new credential logging was introduced. Samples use environment-supplied passwords and require trusted TLS roots for production; insecure connections are confined to disposable tests.

No blocking findings and no new formal issue. Previous Issues 1-4 are closed as described above; no unresolved source or documentation blocker is carried forward.

2. Code-quality assessment

2.1 Code conventions

ASF headers, explicit imports and meaningful class/capability comments are present. Production and test changes stay within JDBC; existing loader/converter/factory test classes are extended, and separate server/pipeline suites cover distinct new behaviors. The scoped whitespace check produced no entries.

2.2 Test coverage and stability

Stability rating: Stable for the changed tests by inspection and the inspected current-head runs. No local build, unit/integration test, container or service was run. Unit coverage asserts explicit-only factory discovery, exact hash/upsert/identifier SQL, no metadata call for Cockroach strings, no added lookup on PostgreSQL strings and no metadata for PostgreSQL numeric fields. Factory tests pin allowed/rejected save modes and capability advertisement. Writer safety tests prove unsupported physical DDL cannot mutate schema/output format or commit, while local restore is still accepted. JdbcCockroachDBDialectIT:74-367 uses a mapped-port real v24.3 server, immediate real SQL after readiness, scoped connections/results, exact row sets/counts/types, fresh reader connections and repeated secondary-key upserts. Its source fixture is read-only across those tests; only the independent upsert table is mutated. JdbcCockroachDBIT:82-117 resets its target per invocation, runs the real bounded pipeline twice, compares both directions with EXCEPT and asserts four ordered keys plus preserved/default columns. Containers close in teardown, no fixed sleep was added, and the separate classes use separate containers/mapped ports. The tests establish the documented v24.3 scope, not every CockroachDB version or unsupported XA/DDL feature.

Exact-head fork Build40160509252 succeeds at f8a5440, including all four JDK11/17 Windows/Ubuntu unit lanes. The fixed jdbc-connectors-it-part-1 lane is skipped, but that is not the actual execution path for this connector-only change: the changes job lists JDBC E2E modules and selective shard2 runs them. I read the JDK11 selective-shard2 log and JDK17 counterpart. Each reports JdbcCockroachDBIT: 7 tests, 0 failures/errors/skips, and JdbcCockroachDBDialectIT: 5 tests, 0 failures/errors/skips. Thus coverage is established from the class summaries, not from a skipped lane or a green aggregate alone. The former LLM wrapper fix cc54bb4 is an ancestor of this head (static merge-base check exit0); its old failure guidance is superseded. Apache required-check/reviewer controls remain independent of these fork results.

2.3 Documentation

EN/ZH source and sink sections agree on explicit dialect selection, pre-created tables, TLS, FNV32/null handling, COUNT scan cost, metadata-free cursor reads, supported types, replay/null-key limits and unsupported modes. Examples use real existing JDBC options and dotted sink paths supported by the factory. No new runtime default or incompatible data format requires an upgrade entry.

3. Architectural soundness

3.1 Solution quality

A narrow long-term dialect extension rather than changing PostgreSQL globally. The added save-mode capability hook is the cleaner version of the earlier shared-factory special case.

3.2 Maintainability

Backend-specific behavior is concentrated in the new dialect/converter; shared PostgreSQL behavior has explicit regression guards. Capability rejection is aligned between advertised support and the writer boundary.

3.3 Extensibility

The default validation/capability hooks can serve other catalog-less dialects without another database-name branch. Additional CockroachDB features should add explicit tested capability rather than inherit unsupported PostgreSQL behavior silently.

3.4 Historical compatibility

Existing PostgreSQL URL selection, supported option/default behavior and checkpoint formats remain compatible. New CockroachDB jobs require explicit selection and pre-created target constraints; no existing cluster is automatically switched to this dialect.

4. Findings summary

No. Finding Location Status
1 (previous) Real-server test placement/execution evidence JdbcCockroachDBDialectIT in JDBC part-1 E2E Closed
2 (previous) Save-mode validation ownership JdbcDialect.validateSaveModes / CockroachDB override Closed
3 (previous) PostgreSQL per-row schema lookup PostgresJdbcRowConverter.getStringColumnType Closed
4 (previous) Factory Javadoc / Stream import CockroachDB dialect/factory Closed

5. Merge conclusion

Conclusion: Can merge

  1. Blocking items: No source/documentation/inspected-fork-CI blocker from Daniel. Confirm Apache required checks on the final head and obtain the effective write-capable maintainer approval.
  2. Non-blocking recommendations: No additional changes are required by this review. Treat large-table COUNT/hash cost and the declared unsupported capabilities as operational limits, not reasons to add unrelated features here.

My technical conclusion is approve for this current version. The prior source notes are closed and the exact-head fork Build, unit lanes and actual CockroachDB server/pipeline tests succeed. The remaining repository approval/merge controls belong to a write-capable maintainer; this READ-permission COMMENT does not pretend to change those controls.

Compare against dev: diverged, ahead 7 / behind 13, merge conflict=False. Drift is recorded independently; it does not itself justify a sync-first comment without an unrelated CI failure.

Daniel has READ permission. This COMMENT is a technical assessment, not an effective write-level approval. A write-capable maintainer must confirm repository gates and supply the effective approval.

Local evidence: exact-head fetch/checkout on seatunnel-review-12828, complete diff and source call-chain reads cited above. No runtime verification was claimed.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick follow-up on my previous review: the CI fact I cited there has changed. The Build check on the current head (f8a5440d72) is now green. My previous round already had no code-side blockers for this head, so CI was the only remaining gate, and I am updating my conclusion to approve. Thanks again for the contribution! A write-capable committer still needs to give the final approval for the merge gate.

@davidzollo davidzollo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
LGTM 🚀

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks @davidzollo for the +1.

For the record, the state I see on the unchanged head f8a5440d7: all selective CI checks that ran are green (6 success), the source-side review has no open blockers, and GitHub reports the merge state as clean with no conflicts. The branch is behind dev by a number of commits, but that alone is not a blocker here since there is nothing to resolve; @goutamadwant does not need to sync just for that.

Thanks again @goutamadwant for the dialect and its ITs. Nothing further is needed from you; this is ready for a write-capable committer to merge.

@goutamadwant

Copy link
Copy Markdown
Collaborator Author

@davidzollo thanks for the approval. The branch is rebased on dev, CI is green and there are no open threads. Could you merge when convenient?

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks @goutamadwant. My source-clear conclusion stands and current Build is green. The branch has advanced relative to its base comparison since earlier snapshots, but behind/diverged metadata alone is not a request to sync. The next action is with a write-capable maintainer for merge; nothing further is requested from you by this review.

This is an unchanged-head discussion/CI update, not a second full source review. No local tests were run. Daniel has READ permission; any approval records my technical conclusion, while effective maintainer approval, dismissal and merge remain separate.

@davidzollo
davidzollo added this pull request to the merge queue Nov 6, 2026
Merged via the queue into apache:dev with commit df59bb4 Nov 6, 2026
6 checks passed
zhangshenghang pushed a commit to zhangshenghang/seatunnel that referenced this pull request Nov 6, 2026
Resolve Jdbc.md (EN/ZH) conflicts: keep the dev-side dialect list with
CockroachDB and Inceptor verified in apache#12828.
zhangshenghang pushed a commit to zhangshenghang/seatunnel that referenced this pull request Nov 6, 2026
Resolve JDBC dialect-list and option-table conflicts (EN/ZH): keep the
dev-side dialect ordering with CockroachDB verified in apache#12828 and the
option-table wording verified in apache#13050.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants