Before you use the lock-free schema change feature of Data Management (DMS), you must enable it for the target instance.
Prerequisites
-
Supported database types: ApsaraDB RDS for MySQL, PolarDB for MySQL, MyBase for MySQL, and MySQL from other sources.
-
The control mode of the instance is Stable Change or Security Collaboration. For more information, see View control modes.
-
You have the role of a DBA or an administrator. To view your role, see View my system roles.
Procedure
Log in to DMS 5.0.
-
On the console homepage, in the Database Instances list, right-click the target instance and select Lock-free Schema Change.
NoteAlternatively, you can go to from the top menu bar. On the Instance List tab, click to the right of the target instance, and enable lock-free schema change in the Advanced Information section.
The following table describes the options.
Option
Description
Remarks
Enable (DMS OnlineDDL First)
DMS uses its proprietary DDL lock-free change engine to ensure that the table is not locked.
NoteIn the following cases, DMS OnlineDDL cannot be used, and the system automatically falls back to MySQL native OnlineDDL. The task fails if DMS detects that the native execution will lock the table or return an error.
-
The target table is empty. Native execution is used because it is faster and performing DDL on an empty table is low-risk.
-
DMS OnlineDDL does not support adding a unique constraint (UK).
Execution is slower than MySQL native OnlineDDL, but it does not affect replication behavior and is less likely to cause replication lag.
Enable (MySQL Native OnlineDDL First)
DMS first tries MySQL native OnlineDDL. If DMS detects that native execution will lock tables or fail, it automatically switches to DMS OnlineDDL to prevent table locking.
Execution is relatively fast, but it may cause the instance's parallel replication to fall back to serial replication, which can lead to replication lag.
Close
DMS sends the native statement directly to MySQL for execution without any processing.
N/A
-
-
In the Modify Lock-free Schema Change dialog box, click OK.
After enabling lock-free schema change for the instance, you can submit a lock-free schema change ticket.
Related operations
After you enable lock-free schema change for an instance, DMS prioritizes this method for the following types of tickets on that instance:
-
Note
Schema changes submitted in a normal data change ticket typically use the lock-free schema change method. However, if the ticket targets an entire instance instead of a specific database, lock-free schema change is not currently supported. In this case, the task falls back to the native execution method even if the feature is enabled for the instance.