ryanmeowy opened a new pull request, #12708:
URL: https://github.com/apache/seatunnel/pull/12708
# PR draft (pending maintainer confirmation on #11007 design note)
## Title
`[Fix][Connector-V2][MySQL CDC] Validate startup.specific-offset.* only
bound under STARTUP_MODE = SPECIFIC`
## Commit message (single-line, 100 col)
`[Fix][Connector-V2][MySQL CDC] Validate specific-offset options are only
bound under STARTUP_MODE = SPECIFIC`
## Body
### What
Enums five `startup.specific-offset.*` options
(file/pos/gtid-set/skip-events/skip-rows)
are now validated statically at factory option-rule level instead of only
failing at
runtime ERROR when `STARTUP_MODE` is not (or not defaulted to) `SPECIFIC`.
- NEW guard: `MySqlSpecificOffsetGuards` — a small extension-cond set:
- without `STARTUP_MODE` or with a non-`SPECIFIC` explicit mode: reject
each of the
five options with the runtime-derived template text ("can only be used
when
STARTUP_MODE is or defaults to SPECIFIC"), already probed by 8/a 94-98
original
`OptionalCheck` templates.
- pair constraint: `startup.specific-offset.file` and `...pos` must appear
together —
partial anchoring (file-only / pos-only) is rejected at the missing
counterpart.
- blank values: `gtid-set` and `file` reject blank strings (`" "` / `""`).
- bounds: `ignore-events` / `ignore-rows` must be >= 0.
- `MySqlIncrementalSourceFactory.optionRule` adds the conditions next to the
existing
`STARTUP_MODE`/TIMESTAMP conditional block, plus a mode fallback
conditional for the
pair (FILE+POS) — see MyS-I 56-115 lines.
- OceanBase inherits this behaviour by factory subclassing — 3 new
inherited-rule tests.
### Why
- Runtime error text was introduced at MyS-I 109-113/116-121 and MyS-I
188-196;
static errors must NOT bypass the configs-aware mispatch scan range (per
cap 6/a
design note).
- `Conditions.extension` semantics: for each of the five options,
`converts...` —
verifies the specific-offset group — cf. OptionRule.Conditions grammar.
- Runtime template for them was already ERROR — now consistent at static
phase too.
### Compatibility matrix
11 new test methods in `MySqlIncrementalSourceFactoryTest`:
accepts file+pos-only / metadata-carrying / absent-mode (baseline happy
path) /
empty-lists / unknown keys; rejects empty, partial-anchor (both directions),
blank
gtid-set + blank file, negative ignores, explicit wrong mode (every option),
and
omitted-mode violation (every option).
`OceanBaseIncrementalSourceFactoryTest` adds 3 inherited-rule checks
(SUPERSEDED base
class contract): accept file+pos-only anchor, reject explicit wrong mode,
reject
omitted-mode violation.
### Verification note re formatting
This repo pins GJF 1.7 (AOSP, via spotless 2.29.0). Local dev machine
provides only
JDK 21 where google-java-format 1.7 crashes on javac internals
(`JCTree$JCImport.getQualifiedIdentifier()` removed in 21.x) →
`spotless:apply` /
`spotless:check` cannot run locally. Files were instead checked with
google-java-format 1.28.0 `--aosp`:
- the modified files have NO re-flow vs. my hand-written version;
- the HEAD baseline of the two pre-existing files had zero code-region drift
(1.28 only reshuffles its own import grouping, which is managed by
spotless's
`importOrder` step, unaffected by this diff).
CI (JDK 8/11, pinned GJF 1.7) is the authoritative check.
### Scope
- connector-cdc-mysql: option rule + guards class + static tests;
- connector-cdc-oceanbase: inherited-rule test coverage only;
- no changes to Vitess / SQLServer / Db2 / MongoDB / Postgres.
### Tracking
Umbrella #11007 (retire-MySQL-GAP lane). Design note linked there; proposal
text:
run #12690 rule-set / avoid runtime-template duplication.
--
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]