JNSimba opened a new pull request, #62337:
URL: https://github.com/apache/doris/pull/62337

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   This PR fixes two independent issues in the `cdc_client` module:
   
   1. **JDBC connection leak on snapshot re-prepare** 
(`JdbcIncrementalSourceReader`, `MySqlSourceReader`)
      `prepareSnapshotSplits` used to call `snapshotReaderContexts.clear()` 
directly, dropping references to the previous snapshot split readers without 
closing them. Each reader owns a JDBC connection (plus a Debezium queue), so 
every re-prepare leaked connections until the upstream database hit its 
connection limit. The fix closes every previous reader before clearing the 
context list.
   
   2. **Unhandled exceptions in REST endpoints** (`ClientController`)
      `/api/fetchEndOffset` and `/api/compareOffset` propagated any exception 
from the underlying `SourceReader` as an unhandled 500 with no useful body. 
They are now wrapped in try/catch, logged with the `jobId`, and return 
`RestResponse.internalError(rootCauseMessage)` so the caller gets an actionable 
error.
   
   ### Release note
   
   Fix JDBC connection leak in cdc_client snapshot reader re-prepare, and 
return structured error responses from `fetchEndOffset` / `compareOffset` 
instead of unhandled 500s.
   
   ### Check List (For Author)
   
   - Test
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [x] No need to test or manual test. Explain why:
           - [x] Previous test can cover this change.
   
   - Behavior changed:
       - [x] Yes.
         - `fetchEndOffset` / `compareOffset` no longer throw unhandled 
exceptions; failures now return `internalError` with the root cause message.
         - Previous snapshot split readers are closed before being dropped on 
re-prepare.
   
   - Does this need documentation?
       - [x] No.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


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

Reply via email to