maks3201 opened a new pull request, #66559:
URL: https://github.com/apache/doris/pull/66559
### What problem does this PR solve?
Issue Number: close #66558
Related PR: N/A
Problem Summary:
In `MySqlSourceReader.generateMySqlConfig()`, the startup mode block
(handling `offset=latest`, `earliest`, and timestamp) calls
`initializeEffectiveOffset()`, which opens a JDBC connection to the source
MySQL to resolve the current binlog filename and position. However, SSL
properties (`ssl_mode`, `ssl_rootcert`) and JDBC connection properties are
applied **after** this block.
This means on any MySQL instance configured with
`require_secure_transport=ON`, the JDBC connection inside
`initializeEffectiveOffset()` attempts a plaintext connection, which the server
rejects. The streaming job fails immediately at startup.
The fix moves the JDBC properties and SSL configuration block to **before**
the startup mode switch block. This ensures `initializeEffectiveOffset()` uses
the correct SSL settings when building its temporary connection.
**Why the reordering is safe for non-SSL users:** When `ssl_mode` is not
specified in the job properties, the SSL `if`-blocks are skipped entirely and
`jdbcProperties` contains only the URL connection parameters (same as before).
The JDBC connection inside `initializeEffectiveOffset()` behaves identically
whether the properties object is set on the factory before or after the startup
mode block — the only difference is that now it is _available_ at the point it
is needed.
**Affected offset modes:**
- `latest` — calls `initializeEffectiveOffset()` ✗ fails without this fix
- `earliest` — calls `initializeEffectiveOffset()` ✗ fails without this fix
- timestamp (13-digit epoch) — calls `initializeEffectiveOffset()` ✗ fails
without this fix
- `initial` / `snapshot` — do NOT call `initializeEffectiveOffset()` →
unaffected
### Release note
Fixed a bug where CDC streaming jobs with `offset=latest`,
`offset=earliest`, or a timestamp offset failed immediately on MySQL instances
that require SSL (`require_secure_transport=ON`). The SSL connection properties
were being configured after the code that needed them.
### Check List (For Author)
- Test
- [x] No regression test included
**Note on testing:** The defect is a method-call ordering issue within a
single method. A unit test cannot meaningfully assert that JDBC properties are
set on the factory before `initializeEffectiveOffset()` is called without
fragile mocking of internal sequencing. A meaningful regression test requires a
live MySQL instance with `require_secure_transport=ON`, which is not available
in upstream CI. The fix has been validated manually against Aurora MySQL 8.0
with SSL required.
- [x] If it changes/adds/deletes any user-facing features or behaviours
(**NO** — the fix restores intended behaviour, no new features):
- [x] N/A — no docs or audit log changes needed
- [x] If it affects the operation/behaviour of existing data (**NO**):
- [x] N/A — no data migration needed
---
**Backport:** Please label `dev/4.1.x`. This bug is present in 4.1.2 and
4.1.3. The fix applies cleanly to `branch-4.1`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]