-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sink(ticdc): Add Support for Multiple MySQL-Compatible Downstream Addresses in TiCDC for High Availability #11527
base: master
Are you sure you want to change the base?
sink(ticdc): Add Support for Multiple MySQL-Compatible Downstream Addresses in TiCDC for High Availability #11527
Conversation
…s before each retry attempt Introduced the `WithPreExecutionWhenRetry` feature to allow a PreExecution action to be specified, which will be executed before each retry attempt, but only if the initial execution fails. This ensures that the PreExecution function is triggered before every retry following the first failure. If the initial execution is successful, no retry occurs, and the PreExecution function will not be executed.
…or MySQL Syncpoint Store
…ql-addresses-in-sink-uri
…instances within a single cluster
…ying all DOWN_TIDB_STATUS to DOWN_TIDB_STATUS_1
…tidb_cluster` command
…nstances into a separate script
…_downstream_tidb_instances script
…m addresses feature
Skipping CI for Draft Pull Request. |
/test cdc-integration-kafka-test |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #11527 +/- ##
================================================
+ Coverage 57.4429% 57.5027% +0.0597%
================================================
Files 851 852 +1
Lines 126421 126580 +159
================================================
+ Hits 72620 72787 +167
+ Misses 48394 48363 -31
- Partials 5407 5430 +23 |
…e naming convention for changefeed-id
9708137
to
97db8dd
Compare
…ntegration test for testing DDL Sink when handling connection error
…retryable when encounter network error
/test verify |
/test cdc-integration-mysql-test |
1 similar comment
/test cdc-integration-mysql-test |
/test cdc-integration-mysql-test |
/test cdc-integration-kafka-test |
/test cdc-integration-pulsar-test |
PR needs rebase. Instructions 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 kubernetes-sigs/prow repository. |
What problem does this PR solve?
Issue Number: close #11475
What is changed and how it works?
Description:
This PR introduces a new feature in TiCDC to enhance the fault tolerance of Changefeeds that target MySQL-compatible downstream databases. Previously, TiCDC could only connect to one MySQL-compatible server in a downstream cluster, and if that server became unavailable, it required manual intervention (i.e., recreating the Changefeed) to restore functionality.
New Feature:
Automatic Failover for Multiple Downstream Addresses:
--sink-uri
option during Changefeed creation or update.Key Additions and Changes:
DBConnector Implementation:
DBConnector
struct and methods have been added in thepkg/sink/mysql
package. The core methods include:SwitchToAnAvailableDB
: Automatically tries to switch to another available database in the event of a failure.ConfigureDBWhenSwitch
: Allows custom configuration logic to be applied when switching to a new connection.Integration into Existing Components:
DBConnector
. This includes:DBConnector
, these components now benefit from automatic failover, making TiCDC more resilient in the face of database outages.Unit Testing:
DBConnector
to ensure it handles reconnection and failover logic correctly. These tests can be found inpkg/sink/mysql/mysql_connector_test.go
.Integration Testing:
start_downstream_tidb_instances
to start multiple TiDB instances for testing the failover functionality. Thetest_prepare
file has been updated to register three downstream TiDB instance ports for these tests. While the integration tests now support up to three TiDB instances by default, more instances can be added if needed by modifying the registered ports.Minor Changes to Existing Scripts:
run.sh
) have been modified to accommodate the new multi-instance setup. These changes are purely related to port assignments and do not alter the test logic.Testing and Validation:
DBConnector
.cdc cli changefeed create
andcdc cli changefeed update
with multiple downstream addresses. Verified that TiCDC correctly switches between downstream instances during failures with multiple TiDB instances to confirm the automatic failover functionality works as expected.This enhancement greatly improves TiCDC’s reliability and ease of use, especially in complex deployment environments, by reducing dependency on external load balancers and ensuring smooth failover between multiple downstream MySQL-compatible databases.
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
No
Do you need to update user documentation, design documentation or monitoring documentation?
Yes, the user documentation should be updated to reflect the new support for specifying multiple downstream addresses in the
--sink-uri
option, along with instructions on how to configure and use this feature. Additionally, any design documentation that explains the architecture of TiCDC's database connection management should be updated to include details on the newDBConnector
and its failover capabilities. Monitoring documentation should also be updated to account for the behavior and health of multiple downstream connections, including potential alerts when failover occurs.Release note