ALTER RESOURCE POOL

2023-12-25 08:49:41  Updated

Purpose

You can use this statement to modify a resource pool.

Syntax

ALTER RESOURCE POOL {
    pool_name
    UNIT [=] unit_name,
    UNIT_NUM [=] unit_num [DELETE UNIT = (unit_id_list)],
    ZONE_LIST [=] ('zone_name' [, 'zone_name' ...])
 | MERGE
   ('pool_name'[, 'pool_name' ...])
    INTO ('merge_pool_name')
 | SPLIT INTO ('pool_name' [, 'pool_name' ...])
   ON ('zone_name' [, 'zone_name' ...])
};

Parameters

Parameter Description
unit_name The name of the resource unit to be used.
unit_num The number of units in a zone after the modification, which must be less than or equal to the number of OBServer nodes in the zone.

Notice

After a resource pool is allocated to a tenant, you cannot use the ALTER RESOURCE POOL statement to change the number of units in the resource pool. Instead, you must use the ALTER RESOURCE TENANT statement. For more information, see ALTER RESOURCE TENANT.

unit_id_list When you attempt to decrease the value of unit_num, you can use the DELETE UNIT keyword to specify the units to be deleted. If the DELETE UNIT parameter is not specified, the system automatically selects the units to be deleted.

Notice

When you use DELETE UNIT to specify the unit_id of the units to be deleted, take note of the following considerations:

  • In the unit_id list, the number of units to be deleted from each zone must be the same. Currently, OceanBase Database does not allow you to delete different numbers of units from different zones when you scale in tenant resources.
  • In the unit_id list, the number of units to be deleted from each zone must match the value of unit_num.

ZONE_LIST The zone list of the resource pool.
MERGE Merges multiple resource pools. The resource pools can still be used by the tenant when they are being merged. They are merged into one resource pool only from the perspective of the management layer in which the RootService is located, to facilitate unified maintenance.
SPLIT Splits a resource pool into multiple resource pools.
merge_pool_name The name of the merged resource pool.

Examples

  • You can modify only one attribute of resource pool pool1 at a time. For example, the following statement attempts to modify the UNIT, UNIT_NUM, and ZONE_LIST attributes at a time, and an error will occur during its execution.

    obclient> 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 supported
    

    When you attempt to decrease the value of UNIT_NUM, you can specify the units to be deleted.

    obclient> ALTER RESOURCE POOL pool1 UNIT_NUM=1 DELETE UNIT = (1002);
    Query OK, 0 rows affected
    
  • Modify the UNIT attribute of resource pool pool1.

    obclient> ALTER RESOURCE POOL pool1 UNIT='unit2';
    Query OK, 0 rows affected
    
  • Split resource pool pool1 into resource pools pool10 and pool11.

    obclient> CREATE RESOURCE POOL pool1 unit='unit1',unit_num=1,zone_list=('zone1','zone2');
    Query OK, 0 rows affected
    
    
    obclient> ALTER RESOURCE POOL pool1 SPLIT INTO ('pool10','pool11') ON ('zone1','zone2');
    Query OK, 0 rows affected
    
  • Merge resource pools pool0, pool1, and pool2 of tenant1 for unified management.

    obclient>ALTER RESOURCE POOL MERGE ('pool0','pool1','pool2') INTO ('pool3');
    Query OK, 0 rows affected
    

Contact Us