Purpose
The ALTER RESOURCE POOL statement is used to modify the properties of a resource pool, including the UNIT, UNIT_NUM, and ZONE_LIST.
Limitations and considerations
When using the
ALTER RESOURCE POOLstatement to modify the properties of a resource pool, only one property can be modified at a time. If you need to modify two or more properties fromUNIT,UNIT_NUM, andZONE_LIST, you must execute multiple statements.OceanBase Database supports both homogeneous and heterogeneous zone modes for tenants. In homogeneous zone mode, all zones under a tenant must have the same number of units. In heterogeneous zone mode, different zones can have different numbers of units, but a tenant can have at most two types of
unit_num. When modifyingUNIT_NUM:In heterogeneous zone mode, you can use the
ALTER RESOURCE POOLstatement to increase or decreaseUNIT_NUMfor a resource pool, regardless of whether the resource pool has been allocated to a tenant.Notice
By default, existing tenants or tenants upgraded to the current version of OceanBase Database operate in homogeneous zone mode. To enable heterogeneous zone mode, you need to set the
zone_deploy_modeparameter tohetero. Once modified, it cannot be changed back tohomo.In homogeneous zone mode, if a resource pool has been allocated to a tenant, you cannot use the
ALTER RESOURCE POOLstatement to modify it. Instead, you must use theALTER RESOURCE TENANTstatement. For more information about theALTER RESOURCE TENANTstatement, see ALTER RESOURCE TENANT.
Privilege requirements
Only the root user of the sys tenant (root@sys) can modify a resource pool. Other tenants do not support modifying resource pools.
Syntax
ALTER RESOURCE POOL
ALTER RESOURCE POOL pool_name
UNIT [=] unit_name
| UNIT_NUM [=] unit_num [DELETE UNIT = (unit_id_list)]
| ZONE_LIST [=] ('zone_name' [, 'zone_name' ...]);
Parameters
| Parameter | Description |
|---|---|
| unit_name | The name of the resource specification to be used for the resource pool. |
| unit_num | The number of units in a single zone after modification. When increasing unit_num, its value must be less than or equal to the number of nodes in the target zone. <main id="notice" type=notice'>NoticeIn heterogeneous zone mode, when increasing or decreasing For example, if a tenant has three resource pools |
| DELETE UNIT | When decreasing unit_num, you can use DELETE UNIT to delete the specified unit. If you do not specify DELETE UNIT, the system will randomly delete the corresponding number of units. <main id="notice" type=notice'>NoticeWhen using
|
| ZONE_LIST | The list of zones for the resource pool after modification. |
Examples
You cannot modify multiple properties of a resource pool at the same time. For example, the following statement attempts to modify the
UNIT,UNIT_NUM, andZONEproperties of the resource poolpool1at the same time, which will result in an error.obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT='unit2', UNIT_NUM=1, ZONE_LIST=('zone1'); ERROR 1235 (0A000): alter unit_num, resource_unit, zone_list in one cmd not supportedSpecifically, when decreasing
UNIT_NUM, you can delete the specified unit.obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_NUM=1 DELETE UNIT = (1002);Change the resource specification used by the resource pool
pool1tounit2.obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT='unit2';