DanielLeens opened a new pull request, #13678:
URL: https://github.com/apache/seatunnel/pull/13678
### Purpose of this pull request
Yes, I am contributing to Apache SeaTunnel. This patch was prepared with
OpenAI Codex assistance.
Closes #13660.
The JDBC STRING path calls `getObject` to recognize a BLOB and then calls
`getString` for non-BLOB values. With MySQL Connector/J, `getObject` for a
textual column already decodes its value. A second getter repeats that work.
The behavior originated in the BLOB-compatible reader introduced by #9305;
removing BLOB handling globally would be incompatible.
Add a protected string-read hook whose default still delegates to the
unchanged `JdbcFieldTypeUtils`. Only the exact `MysqlJdbcRowConverter` uses the
fast path, and only when optional metadata reports `java.lang.String` as the
driver's object class. It calls `getString` directly. Unknown/unavailable
metadata uses the original getter/BLOB decoding and release path.
This deliberately retains `getString` rather than reusing the String
returned by `getObject`: Connector/J can use a different
`clobCharacterEncoding` for the latter. Actual data-access exceptions still
propagate; only optional metadata access has a fallback. MySQL converter
subclasses, including StarRocks, retain their prior cursor contract. Other
dialects and CockroachDB's no-metadata-query regression protection are
unchanged.
The new protected method changes implicit Java serialization identities, so
the original Abstract/MySQL UIDs are explicitly retained. There is no cache or
retained cursor/connection, no new dependency, and no configuration/default,
schema, sink binding, batching, transaction, retry, factory/SPI or packaging
change. Existing MySQL UT/IT classes and the English/Chinese JDBC source guide
are updated.
### Verification
Fresh base: `0bef81d003a9dcc3266a10140dc639534ad81bfd` (including #12005).
Using JDK 11 and Maven, for both the clean baseline and the six-file
candidate:
```sh
mvn -nsu -Dmaven.gitcommitid.skip=true -T 3C \
-pl seatunnel-connectors-v2/connector-jdbc -am spotless:apply
mvn -nsu -Dmaven.gitcommitid.skip=true -T 3C \
-pl seatunnel-connectors-v2/connector-jdbc -am verify \
'-Dtest=*,!KingbaseCatalogContainerTest,!KingbaseDialectContainerTest,!OracleCatalogTest,!OracleDialectTest'
\
-Dsurefire.failIfNoSpecifiedTests=false
```
Baseline: 1,850 tests, zero failures/errors, five existing skips. Candidate:
1,853 tests, zero failures/errors, five existing skips. Four Docker-only
Oracle/Kingbase classes were explicitly excluded because the local Docker
environment is unavailable; their assertions were not altered. These numbers do
not claim container-suite success. The engine UI was unchanged and excluded
from the affected reactor.
The existing MySQL IT now reads temporary TEXT values through the public
dialect/converter path with different CLOB and connection encodings, covering
Unicode, empty and NULL values. The added UT coverage also preserves full BLOB
decoding/release, unavailable metadata, subclass isolation, and switching
ResultSets. No private method is tested reflectively.
Both fresh baseline and candidate passed the added MySQL IT method on the
existing isolated self-hosted MySQL 8.0.35 instance with Connector/J 8.0.33.
The method body and all assertions were replayed unchanged; only fixture
connection wiring differs. Actual loaded converter/JAR identity and private
connections were verified. This is not a claim that the full Testcontainers
lifecycle ran locally.
The actual fresh baseline serialized both MySQL and Generic converters; the
candidate deserialized them, verified Unicode/empty/NULL values, then
serialized the populated converters again. Original UIDs and all six values
passed.
For a separate real-JDBC conversion diagnostic, both versions read 1,000,000
rows containing seven string fields, including complete Unicode/LOB/JSON text,
NULL and empty values. Every returned field was compared against a separate
reference cursor. A 100,000-row preceding process warmed the host/database for
each version; each measured process used a fresh JVM, 1 GiB heap and 1 MiB G1
regions. Three pairs alternated process order. The caller's allocated bytes and
nanoseconds were measured only around public `toInternal`; cursor advances and
reference getters were excluded.
| Pair | Baseline allocated bytes | Candidate allocated bytes | Allocation
reduction | Baseline conversion seconds | Candidate conversion seconds |
| --- | ---: | ---: | ---: | ---: | ---: |
| 1 | 5,316,953,144 | 3,191,065,712 | 39.98% | 4.329 | 2.679 |
| 2 | 5,316,903,984 | 3,190,228,184 | 40.00% | 4.268 | 2.698 |
| 3 | 5,316,510,632 | 3,190,548,736 | 39.99% | 4.169 | 2.888 |
Conversion time was 30.74–38.13% lower in these three diagnostic pairs.
These are caller allocation/conversion measurements, not complete-engine
throughput or a 19-field acceptance result. An experimental metadata cache
showed less than 1% additional benefit over the stateless version and was
omitted.
### Complete-engine measurements and limits
A separate source-pinned full-engine experiment used the previously measured
`5cf050be` runtime, original canonical JDBC baseline and this same executable
converter change, a self-hosted MySQL 8.0.35 source, Connector/J 8.0.33, and
Elasticsearch 8.9.0. One writer, 1 GiB heap, matched 2,000-document batches,
matching 1 MiB G1 regions, and DataX completion polling of 1,000 ms were
explicit. Each fresh JVM received a preceding host/database warmup; this is not
same-JVM JIT warmup.
Three alternating triplets reconciled all 1,000,000 rows and all 19 declared
values, including complete text/binary encodings and explicit NULLs. Private
preconnect guards and process-group socket audits passed.
Refresh/search/reconciliation and cleanup of the job-owned disposable index
occurred outside timing; every profile used the same cleaned fixture. Elapsed
time includes engine startup and process exit.
| Triplet | DataX seconds | ST baseline seconds | ST candidate seconds |
Candidate throughput change vs ST baseline |
| --- | ---: | ---: | ---: | ---: |
| 1 | 71.146 | 73.080 | 73.277 | -0.27% |
| 2 | 75.057 | 76.234 | 70.809 | +7.66% |
| 3 | 71.973 | 75.358 | 72.564 | +3.85% |
The first triplet has no full-job improvement, and the candidate does not
beat DataX in all triplets. These results are retained rather than replaced
with the best pilot. This focused source allocation optimization does not claim
to finish the broader connector performance work or guarantee a whole-job
speedup. The fresh-dev component results above are distinct from this older
full-engine runtime; neither is relabeled as the other.
One independent Maintainer reviewed normal paths, encoding/BLOB contracts,
subclass isolation, serialization, tests, bilingual documentation, and file
scope. GitHub CI on the published head remains a separate merge gate.
### Check list
- [x] Six existing files only; no POM, dependencies, defaults, factory/SPI
or unrelated deletions.
- [x] Existing regression tests retained; MySQL IT and both language guides
updated.
- [x] Exact original getString semantics and serialization identity
preserved.
- [x] Local formatting/build/key tests and actual JDBC validation recorded
with explicit exclusions.
- [ ] Current-head GitHub CI and full container lifecycle must be assessed
independently.
--
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]