Switchover
You can manually select one of the MySQL instances as the primary instance. This is called a switchover.
No downtime occurs when the current placement does not change in a switchover. This occurs when you switchover to the existing primary instance. You can do this to change the preferred placement to the current placement.
It is recommended that you perform a switchover during a period of low activity, or reduce or pause write operations on the DB system where possible. Avoid performing a switchover while large or long-running transactions are being applied.
- New transactions are blocked from the time the switchover is initiated.
- Running transactions are allowed to continue to execute. After 5 minutes, any transactions that have not reached the commit state are aborted and rolled back. Transactions that have already entered the commit state are allowed to complete. The switchover process waits until all running transactions have completed and MySQL has finished rolling back any aborted transactions.
Large or long-running transactions and high system load can increase the time required for transactions to complete or roll back. New transactions remain blocked during this time. Therefore, a switchover can take longer than 5 minutes to complete.
- The DB system endpoint is assigned to the newly promoted primary instance immediately after all running transactions have completed and aborted transactions have finished rolling back.
- Existing connections to the previous primary instance are closed. The client application must reopen new connections.
- Running transactions are allowed to complete. The switchover process waits until all running transactions finish and commit.
- New transactions are accepted and can perform reads and writes but, when the MySQL instance is promoted to be the new primary instance, and the connection to the previous primary instance is broken, all uncommitted transactions are rolled back.
- The DB system endpoint is assigned to the newly promoted primary instance.
- Existing connections to the previous primary instance are closed. The client application must reopen new connections.
After a switchover, the current binary log file name and position of the new primary may be different from the old primary. As the binary logs of each instance are managed independently, each transaction recorded in the binary logs may be written to a different binary log file and position in different instances.
Switchover Scenarios
You can use switchover in the following scenarios:
- Application testing: Ensuring your application works correctly with the newly promoted primary instance.
- Proximity of availability domain: While fault domains are contained in the same data center, availability domains are spread across different data centers. Even though these availability domains are connected with a low-latency network, it may be necessary to test that latency by moving primary instance from availability domain to availability domain to confirm the best location for your primary instance. For example, switching to an instance in the same availability domain as the application which connects to its.
HeatWave Cluster Support
When the current placement changes in a switchover, the HeatWave cluster is detached from the previous primary instance. If the new primary instance is located in the same availability domain (AD) as the previous primary instance, the same HeatWave cluster is reused and it is attached to the new primary instance. If the new primary instance is located in a different AD, the existing HeatWave cluster is deleted. A new HeatWave cluster has to be created in the same AD as the new primary instance and it is attached to the new primary instance. The data in the HeatWave cluster is automatically recovered from the Storage Layer or reloaded from the DB system or Lakehouse Object Storage.
When the current placement changes in a switchover, a long running query offloaded to the HeatWave cluster can get aborted. In this case, you need to reconnect and rerun the query after the HeatWave cluster is ready.
- Using the Console
- Using the CLI
- Using the REST API, run the UpdateDbSystem operation with the
availabilityDomainorfaultDomainattribute.
Using the Console
Use the Console to promote a secondary MySQL instance as the primary instance.
- A running DB system with high availability enabled.
Using the CLI
Use the command-line interface to promote a secondary MySQL instance to the primary instance.
- The OCID of a running DB system with high availability enabled.
- A policy that permits you to update DB system.
- A properly configured CLI installation. See Command Line Interface.