Note
- For V4.2.x, this parameter is available starting with V4.2.5.
- For V4.3.x, this parameter is available starting with V4.3.5 BP2.
Description
enable_lock_priority specifies whether to enable lock priority. When this parameter is set to TRUE, the RENAME TABLE statement has the highest lock priority. That is, when other DDL operations, locking operations, or DML operations are waiting for locks, the RENAME TABLE statement will obtain the lock first after the corresponding lock is released.
Privilege requirements
Query the parameter
The
systenant and all user tenants can query this parameter by using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify the parameter
The
systenant and user tenants can use theALTER SYSTEM SETstatement to modify this parameter.
Attributes
| Attribute | Description |
|---|---|
| Type | BOOL |
| Default value | FALSE |
| Value range |
|
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
Before you use gh-ost or OceanBase Developer Center (ODC) to execute online DDL operations, you must enable the enable_lock_priority parameter for the corresponding tenant. After you enable the parameter, you must query the GV$OB_PARAMETERS view to ensure that the setting takes effect on all servers in the tenant. After you complete the online DDL operations, you must disable the enable_lock_priority parameter to prevent DDL operations from affecting DML operations.
Examples
Enable lock priority.
ALTER SYSTEM SET enable_lock_priority = TRUE;Query 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 setDisable lock priority.
ALTER SYSTEM SET enable_lock_priority = FALSE;
