Note
- In V4.3.x, this parameter is introduced starting from V4.3.5 BP2.
- In V4.2.x, this parameter is introduced starting from V4.2.5.
Description
enable_lock_priority is a switch for table lock priority. Once enabled, specific DDL operations (RENAME TABLE) will have the highest lock priority. This means that when other DDL, locking operations, or DML are waiting for locks simultaneously, RENAME TABLE will be the first to acquire the lock once the corresponding lock is released.
Privilege requirements
Query the parameters
The
systenant and all user tenants can use theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview to query this parameter.Modify a parameter
The
systenant and user tenants can use theALTER SYSTEM SETstatement to modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | Bool |
| Default value | FALSE |
| Value range |
|
| Modifiable | Yes. You can modify it by using the ALTER SYSTEM SET statement. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
Before using gh-ost or OceanBase Developer Center (ODC) to execute Online DDL, you need to enable the enable_lock_priority for the corresponding tenant. After enabling it, query the GV$OB_PARAMETERS view to ensure it takes effect on all machines under the tenant. Once the online DDL operation is complete, disable this parameter to prevent DDL operations from affecting user DML transactions.
Configuration example
Enable the table lock priority.
ALTER SYSTEM SET enable_lock_priority = TRUE;View the value of the parameter.
SHOW PARAMETERS LIKE 'enable_lock_priority';The return result is as follows:
+-------+----------+----------------+----------+----------------------+-----------+-------+-----------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | zone | svr_type | svr_ip | svr_port | name | data_type | value | info | section | scope | source | edit_level | default_value | isdefault | +-------+----------+----------------+----------+----------------------+-----------+-------+-----------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ | zone1 | observer | xxx.xx.xxx.001 | 2882 | enable_lock_priority | NULL | True | specifies whether to enable lock priority, which, when activated, gives certain DDL operations the highest table lock precedence. | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE | False | 0 | | zone2 | observer | xxx.xx.xxx.002 | 2882 | enable_lock_priority | NULL | True | specifies whether to enable lock priority, which, when activated, gives certain DDL operations the highest table lock precedence. | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE | False | 0 | | zone3 | observer | xxx.xx.xxx.003 | 2882 | enable_lock_priority | NULL | True | specifies whether to enable lock priority, which, when activated, gives certain DDL operations the highest table lock precedence. | TRANS | TENANT | DEFAULT | DYNAMIC_EFFECTIVE | False | 0 | +-------+----------+----------------+----------+----------------------+-----------+-------+-----------------------------------------------------------------------------------------------------------------------------------+---------+--------+---------+-------------------+---------------+-----------+ 3 row in setSet the priority of table lock to low.
ALTER SYSTEM SET enable_lock_priority = FALSE;