Purpose
The ALTER RESOURCE POOL statement is used to modify the properties of a resource pool, including UNIT, UNIT_NUM, and ZONE_LIST.
Limitations and considerations
When using the
ALTER RESOURCE POOLstatement to modify resource pool properties, each statement can only modify one property at a time. If you need to modify two or more properties fromUNIT,UNIT_NUM, andZONE_LISTsimultaneously, you need to execute multiple statements.OceanBase Database supports both homogeneous and heterogeneous zone modes for tenants. In homogeneous zone mode, the number of units in each zone of the tenant must be the same. In heterogeneous zone mode, the number of units in each zone of the tenant can be different, but a tenant can have at most two different
unit_numvalues. When increasing or decreasingUNIT_NUM:In heterogeneous zone mode, you can use the
ALTER RESOURCE POOLstatement to increase or decreaseUNIT_NUMregardless of whether the resource pool is allocated to the tenant.Notice
By default, existing tenants or upgraded tenants are in homogeneous zone mode. To enable heterogeneous zone mode, you need to set the
zone_deploy_modeparameter tohetero. After modification, it is not supported to change it back tohomo.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 need to 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 the 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 named |
| 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 the modification. |
Examples
You cannot modify multiple properties of a resource pool in a single statement. For example, the following statement attempts to modify the
UNIT,UNIT_NUM, andZONEproperties of resource poolpool1, 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 resource pool
pool1tounit2.obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT='unit2';
