DanielLeens opened a new pull request, #13604:
URL: https://github.com/apache/seatunnel/pull/13604

   ### Purpose of this pull request
   
   Yes, I am contributing to Apache SeaTunnel.
   
   Closes #13601
   
   The JDBC sink guide mentions `rewriteBatchedStatements=true` but does not 
explain how server-side preparation and statement-cache SQL length interact. A 
rewritten multi-row INSERT can exceed Connector/J's cache SQL length limit, so 
enabling caching alone may not reuse it.
   
   Add a scoped MySQL non-XA batch-tuning section to the existing English and 
Chinese guides. It shows an opt-in URL/batch-size fragment, explains 
per-connection cache count and SQL-length limits, links official driver 
references, and tells users to measure row width, memory, concurrency and 
server limits. Source and sink effects must be evaluated independently. The 
numeric example is a measurement starting point, not a new default or universal 
recommendation.
   
   ### Does this PR introduce any user-facing change?
   
   Documentation and configuration guidance only. The existing runtime already 
accepts these JDBC URL properties. No Java code, POM, dependency, SeaTunnel 
option/default, connector registration, stored-data contract, generated SQL, 
transaction policy, XA behavior or checkpoint behavior changes. The fragment is 
merged into a working sink configuration and does not replace its required 
connection/table settings.
   
   ### How was this patch tested?
   
   With JDK 11, from this documentation-only sparse worktree:
   
   ```sh
   mvn -nsu -Dmaven.gitcommitid.skip=true -T 3C -N spotless:apply
   mvn -nsu -Dmaven.gitcommitid.skip=true -T 3C -N -q -DskipTests verify
   git diff --check
   ```
   
   All commands returned exit code 0. `-N` checks only the root project; it is 
not a claim that connector tests or the full reactor ran from this worktree. 
Spotless currently has Markdown formatting disabled, so both Markdown fences 
and configuration fragments are checked separately. The two property references 
were opened and their defaults cross-checked with the tested Connector/J 8.0.33 
source. No Java tests were added for this documentation-only change. The 
unchanged UI, connector compilation, Docker E2E and other database families are 
outside this two-file verification scope.
   
   Real runs reused the unmodified source-pinned complete engine/runtime 
manifest: latest pinned JDBC was rebuilt from `5cf050be`, and the reused 
engine/API/common runtime modules have no source/POM differences from the 
previously validated runtime. No metadata-cache candidate, including #13589, is 
layered onto these measurements. A separate 1,001-row SeaTunnel run with batch 
1000 passed all 19 values, covering the partial final batch. One independent 
Maintainer reviewed this exact diff and the raw evidence before submission and 
found no blockers. GitHub CI is a separate gate, not claimed passed here.
   
   ### Reproduced configuration and results
   
   Pinned SeaTunnel dev `5cf050be3ffc77c0065d67d4eb8af83f24a2a620` and DataX 
master `5993b26cda90f3e6a4a2fd2e42843efeb770ab3d`, using both complete engines 
on the same existing 4-vCPU/16-GiB host and self-hosted MySQL 8.0.35. Both 
tools use Connector/J 8.0.33, Java 11, a 1-GiB maximum heap, 
parallelism/channel=1, 1,000 rows per batch, plain INSERT, and a commit after 
each batch. Checkpointing is disabled. The host retains its existing background 
services and is not exclusive. Each job starts a new JVM; the 100,000-row 
warmups cover the database/host rather than same-JVM JIT warmup.
   
   The fixed source contains 1,000,000 rows and 19 mixed fields, including 
numeric, decimal, Unicode/large text, date/time/timestamp, NULL and empty 
values. The `binary_hex` projection is text and is not a claim about a native 
binary/LOB schema on every database. All 19 values are reconciled by ID outside 
timing. Elapsed time covers complete engine startup, acknowledged writes and 
normal process exit, not only a JDBC component loop. A preconnect 
private-address guard and owned-process socket audit are applied to both tools. 
All observed data endpoints are loopback.
   
   Both source and sink MySQL URLs receive the same explicit driver profile:
   
   ```text
   
rewriteBatchedStatements=true&useServerPrepStmts=true&cachePrepStmts=true&prepStmtCacheSize=4&prepStmtCacheSqlLimit=65536
   ```
   
   After one warmup per tool, three pairs alternate execution order (DataX/ST, 
ST/DataX, DataX/ST):
   
   | Pair | DataX seconds | SeaTunnel seconds | SeaTunnel throughput gain |
   | --- | ---: | ---: | ---: |
   | 1 | 71.494 | 66.003 | 8.32% |
   | 2 | 71.530 | 66.245 | 7.98% |
   | 3 | 71.575 | 66.141 | 8.22% |
   
   Every job passed exact reconciliation. A separate SeaTunnel 1,001-row job 
with batch_size=1000 also passed, covering a partial final batch. These are 
MySQL-to-MySQL pipeline results, not a sink-only attribution or a universal 
speed guarantee. No source optimization PR was layered onto this dev runtime.
   
   For context, the previous rewrite-only single-pair diagnostic used 
`useServerPrepStmts=false` and took 71.645s for DataX / 78.398s for SeaTunnel. 
Enabling server preparation and caching while retaining the default SQL length 
limit took 101.496s / 89.182s in another diagnostic pair; that profile slowed 
both tools and is not promoted as a successful optimization. Adding an explicit 
SQL length limit recovered DataX's earlier approximately 71.5s performance 
while reducing SeaTunnel's time. The phases are separate, so those diagnostics 
are not an exact randomized before/after speedup claim.
   
   
   A separate attribution diagnostic kept both tools' MySQL source URLs on the 
earlier client-preparation profile and changed only their sink URLs to the 
long-cache profile. The million-row pair took 71.539s for DataX and 66.830s for 
SeaTunnel, with all 19 values equal. This confirms the sink-only example runs 
successfully for this fixture; it is a single diagnostic pair, not a second 
three-pair acceptance result.
   
   ### Scope and trade-offs
   
   Keep this as explicit driver guidance rather than changing or automatically 
injecting driver settings. The diagnostic server-preparation profile with the 
short SQL cache limit slowed both tools; blindly enabling a setting is not 
justified. The correct choice depends on driver/server support, SQL shapes, row 
width, memory and workload. This PR does not duplicate #11883's connection 
lifecycle changes or #13589's row-layout caching.
   
   ### Check list
   
   * [x] English and Chinese guidance updated together.
   * [x] Existing configuration/defaults/data semantics preserved.
   * [x] Only two existing Markdown files changed; no new tests, binaries or 
dependencies.
   


-- 
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]

Reply via email to