sink/mysql: split DML and control DB pools (#5397) - #5763
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
@hongyunyan This PR has conflicts, I have hold it. |
|
@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/unhold |
|
Cherry-pick conflicts appear resolved; removing the |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hongyunyan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is an automated cherry-pick of #5397
What problem does this PR solve?
Issue Number: close #5360
The MySQL sink used one shared
*sql.DBpool for DML writers and control-plane work such as DDL execution, DDL-ts metadata, syncpoint metadata, and active-active progress updates. When a DML writer held the only available connection, control-plane operations could block while waiting for a connection. In the reported failure, the DDL was received and dispatched but did not reach downstream because the DDL path could not acquire a connection from the shared pool.What is changed and how it works?
This PR splits the MySQL sink connection usage into two independent bounded pools created from the same effective DSN:
NewMysqlConfigAndDBsingle-pool API is preserved for existing callers.NewMysqlConfigAndDBshelper creates the sink-specific DML/control pools and closes the DML pool if control pool creation fails.MySQLSinkForceSingleConnectionnow only constrains the DML pool, so the stress path can still simulate DML session starvation without starving DDL/control operations.Sink.Closecloses both pools and avoids double-closing when tests pass the same DB for both.The control pool is bounded to 4 open and idle connections.
Check List
Tests
Commands:
make fmtgo test --tags=intest ./pkg/sink/mysql ./downstreamadapter/sink/mysqlNot run:
make integration_test_mysql CASE=ddl_default_current_timestamp, becausemake check_third_party_binaryfails in this worktree: the required third-party binaries underbin/are not present.Questions
Will it cause performance regression or break compatibility?
No compatibility break is expected. Existing single-pool factory callers keep the same API. The MySQL sink now opens a small additional control pool, which should reduce DDL/control starvation risk. The DML pool keeps one extra connection for prepared-statement cache misses instead of reserving the historical broader control-plane margin.
Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
Summary by CodeRabbit
Improvements
Tests