zhangshenghang opened a new pull request, #13342: URL: https://github.com/apache/seatunnel/pull/13342
## Purpose Fix two MySQL source splitting defects that cause severe performance degradation on tables without indexes: ### 1. Split collapse when InnoDB statistics are stale `SHOW TABLE STATUS` returns an InnoDB statistics estimate for the Rows column. After a bulk load without `ANALYZE TABLE`, the estimate can stay at 0 while the table actually holds millions of rows. This causes the split enumerator to calculate `shardCount = 0/chunkSize + 1 = 1`, collapsing concurrent read to a single split regardless of the configured parallelism. **Fix**: In `MysqlDialect#approximateRowCntStatement`, when the estimate is 0, re-check with `COUNT(*)`. A genuinely empty table still returns 0 (COUNT(*) on empty table is instant), while a stale zero is corrected to the real count. This mirrors the existing zero-fallback pattern in `OracleDialect`. ### 2. Hash chunk read amplification on unindexed string columns String partition columns with case-insensitive collation (e.g., `utf8mb3_general_ci`) fall back to hash-based splitting. Each hash chunk predicate wraps the column in `ABS(MD5(col) % N) = i`, which no index can serve. With N chunks, the table is scanned N times (e.g., 86 chunks = 86 full table scans). **Fix**: In `DynamicChunkSplitter#createStringColumnSplits`, cap the hash chunk count at the reader parallelism explicitly configured on the source plugin. This keeps every reader busy while bounding read amplification at the parallelism. Controlled by new option `split.hash-shard-parallelism-cap` (default `true`). The cap is skipped when plugin-level parallelism is not explicitly configured (env-level parallelism is not observable by the connector). ## Tests - `MysqlDialectRowCntArbiterTest` (3 new tests): stale zero corrected by COUNT(*); genuinely empty table stays zero; healthy estimate skips COUNT(*) (verified with `never()`) - Local A/B benchmark on 9M-row table: read-side throughput improved from 21k to 391k rows/s (18.3x) ## Check list - [x] Code changed - [x] Unit tests added - [x] Spotless applied -- 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]
