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 the lock priority for table locks. If you set this parameter to TRUE, the RENAME TABLE statement will have the highest lock priority. That is, when other DDL statements, locking operations, or DML statements are waiting for a lock, 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 the value of this parameter by using theSHOW PARAMETERSstatement or theGV$OB_PARAMETERSview.Modify the parameter
The
systenant and user tenants can modify the value of this parameter by using theALTER SYSTEM SETstatement.
Attributes
| Attribute | Description |
|---|---|
| Parameter 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 perform 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 of the tenant. After the online DDL operations are completed, you must disable the enable_lock_priority parameter to prevent DDL operations from affecting user DML operations.
Examples
Enable the lock priority for table locks.
ALTER SYSTEM SET enable_lock_priority = TRUE;Query the value of the parameter.
SHOW PARAMETERS LIKE 'enable_lock_priority';The returned 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 the lock priority for table locks.
ALTER SYSTEM SET enable_lock_priority = FALSE;