Purpose
The ALTER RESOURCE POOL statement is used to modify the attributes of a resource pool, including the UNIT, UNIT_NUM, and ZONE_LIST attributes.
Limitations and considerations
When using the
ALTER RESOURCE POOLstatement to modify resource pool attributes, each statement can modify only one attribute at a time. If you want to modify two or more attributes fromUNIT,UNIT_NUM, andZONE_LIST, you must execute multiple statements.In earlier versions, OceanBase Database supported only homogeneous zone mode for tenants. In homogeneous zone mode, the number of units in each zone of a tenant must be the same. Starting from V4.2.5 BP5 (only for V4.2.5), OceanBase Database supports heterogeneous zone mode for tenants. In heterogeneous zone mode, the number of units in each zone of a tenant can be different, but a tenant can have at most two
unit_numvalues. When you increase or decreaseUNIT_NUM:In heterogeneous zone mode, you can increase or decrease
UNIT_NUMfor a resource pool regardless of whether the resource pool is allocated to the tenant. You can use theALTER RESOURCE POOLstatement for this purpose.Notice
By default, homogeneous zone mode is enabled for existing tenants or tenants upgraded to a later version. If you want to enable heterogeneous zone mode, you must set the
zone_deploy_modeparameter tohetero(heterogeneous zone mode). After you modify the parameter, you cannot change it back tohomo(homogeneous zone mode).In homogeneous zone mode, if the resource pool is allocated to the 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 resource pools. Other tenants cannot modify resource pools.
Syntax
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 each zone after the modification. When you increase the value of unit_num, it must not exceed the number of nodes in the target zone. <main id="notice" type=notice'>NoticeIn heterogeneous zone mode, when you increase or decrease the value of For example, a tenant has three resource pools named |
| DELETE UNIT | Specifies whether to delete the specified units when you decrease the value of unit_num. If you do not specify DELETE UNIT, the system randomly deletes the specified number of units. <main id="notice" type=notice'>NoticeWhen you use
|
| ZONE_LIST | The list of zones of the resource pool after the modification. |
Examples
You cannot modify multiple attributes of the same resource pool at the same time. For example, the following statement simultaneously modifies the
UNIT,UNIT_NUM, andZONEattributes ofpool1. The system returns an error when it is executed.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 supportedIn particular, when you decrease the value of
UNIT_NUM, you can delete the specified units.obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_NUM=1 DELETE UNIT = (1002);Change the resource specification of
pool1tounit2.obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT='unit2';