修改不了资源单元数量?ERROR 4179 (HY000): alter pool unit num which is granted to a tenant not allowed

【 使用环境 】测试环境
【 使用版本 】
4.0
【问题现象及影响】
root@cp01:~# obclient -h127.0.0.1 -P2881 -uroot@test_tenant -Doceanbase -A
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221511050
Server version: OceanBase_CE 4.0.0.0 (r100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be) (Built Nov 1 2022 14:57:18)

Copyright (c) 2000, 2018, OB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

obclient [oceanbase]> SELECT a.TENANT_NAME, b.RESOURCE_POOL_ID,b.NAME resource_pool_name,b.UNIT_CONFIG_ID,b. UNIT_COUNT FROM oceanbase.DBA_OB_TENANTS a,oceanbase.DBA_OB_RESOURCE_POOLS b WHERE b.TENANT_ID=a.TENANT_ID;
ERROR 1146 (42S02): Table ‘oceanbase.dba_ob_tenants’ doesn’t exist
obclient [oceanbase]> exit
Bye
root@cp01:~# obclient -h127.0.0.1 -P2881 -uroot@sys -Doceanbase -A
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221511266
Server version: OceanBase_CE 4.0.0.0 (r100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be) (Built Nov 1 2022 14:57:18)

Copyright (c) 2000, 2018, OB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

obclient [oceanbase]> SELECT a.TENANT_NAME, b.RESOURCE_POOL_ID,b.NAME resource_pool_name,b.UNIT_CONFIG_ID,b. UNIT_COUNT FROM oceanbase.DBA_OB_TENANTS a,oceanbase.DBA_OB_RESOURCE_POOLS b WHERE b.TENANT_ID=a.TENANT_ID;
±------------±-----------------±-------------------±---------------±-----------+
| TENANT_NAME | RESOURCE_POOL_ID | resource_pool_name | UNIT_CONFIG_ID | UNIT_COUNT |
±------------±-----------------±-------------------±---------------±-----------+
| sys | 1 | sys_pool | 1 | 1 |
| test_tenant | 1001 | pool1 | 1001 | 1 |
±------------±-----------------±-------------------±---------------±-----------+
2 rows in set (0.016 sec)

obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS WHERE UNIT_CONFIG_ID=‘1001’;
±---------------±------±---------------------------±---------------------------±--------±--------±------------±--------------±---------±---------±------------+
| UNIT_CONFIG_ID | NAME | CREATE_TIME | MODIFY_TIME | MAX_CPU | MIN_CPU | MEMORY_SIZE | LOG_DISK_SIZE | MAX_IOPS | MIN_IOPS | IOPS_WEIGHT |
±---------------±------±---------------------------±---------------------------±--------±--------±------------±--------------±---------±---------±------------+
| 1001 | unit1 | 2022-11-09 16:26:45.159548 | 2022-11-09 16:26:45.159548 | 1 | 1 | 2147483648 | 6442450944 | 10000 | 10000 | 1 |
±---------------±------±---------------------------±---------------------------±--------±--------±------------±--------------±---------±---------±------------+
1 row in set (0.003 sec)

obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_NUM = 2;
ERROR 4179 (HY000): alter pool unit num which is granted to a tenant not allowed
obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_NUM = 1;
ERROR 4179 (HY000): alter pool unit num which is granted to a tenant not allowed
obclient [oceanbase]> select * from oceanbase.DBA_OB_RESOURCE_POOLS;
±-----------------±---------±----------±---------------------------±---------------------------±-----------±---------------±----------±-------------+
| RESOURCE_POOL_ID | NAME | TENANT_ID | CREATE_TIME | MODIFY_TIME | UNIT_COUNT | UNIT_CONFIG_ID | ZONE_LIST | REPLICA_TYPE |
±-----------------±---------±----------±---------------------------±---------------------------±-----------±---------------±----------±-------------+
| 1 | sys_pool | 1 | 2022-11-09 15:31:10.606347 | 2022-11-09 15:31:10.616206 | 1 | 1 | zone1 | FULL |
| 1001 | pool1 | 1002 | 2022-11-09 16:27:01.027920 | 2022-11-09 16:28:29.117547 | 1 | 1001 | zone1 | FULL |
±-----------------±---------±----------±---------------------------±---------------------------±-----------±---------------±----------±-------------+
2 rows in set (0.003 sec)

obclient [oceanbase]> select * from oceanbase.DBA_OB_RESOURCE_POOLS\G
*************************** 1. row ***************************
RESOURCE_POOL_ID: 1
NAME: sys_pool
TENANT_ID: 1
CREATE_TIME: 2022-11-09 15:31:10.606347
MODIFY_TIME: 2022-11-09 15:31:10.616206
UNIT_COUNT: 1
UNIT_CONFIG_ID: 1
ZONE_LIST: zone1
REPLICA_TYPE: FULL
*************************** 2. row ***************************
RESOURCE_POOL_ID: 1001
NAME: pool1
TENANT_ID: 1002
CREATE_TIME: 2022-11-09 16:27:01.027920
MODIFY_TIME: 2022-11-09 16:28:29.117547
UNIT_COUNT: 1
UNIT_CONFIG_ID: 1001
ZONE_LIST: zone1
REPLICA_TYPE: FULL
2 rows in set (0.003 sec)

obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_COUNT = 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ‘UNIT_COUNT = 1’ at line 1
obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_NUM = 1;
ERROR 4179 (HY000): alter pool unit num which is granted to a tenant not allowed
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_UNIT_CONFIGS\G
*************************** 1. row ***************************
UNIT_CONFIG_ID: 1
NAME: sys_unit_config
CREATE_TIME: 2022-11-09 15:31:10.601384
MODIFY_TIME: 2022-11-09 15:31:10.601384
MAX_CPU: 1
MIN_CPU: 1
MEMORY_SIZE: 2147483648
LOG_DISK_SIZE: 2147483648
MAX_IOPS: 10000
MIN_IOPS: 10000
IOPS_WEIGHT: 1
*************************** 2. row ***************************
UNIT_CONFIG_ID: 1001
NAME: unit1
CREATE_TIME: 2022-11-09 16:26:45.159548
MODIFY_TIME: 2022-11-09 16:26:45.159548
MAX_CPU: 1
MIN_CPU: 1
MEMORY_SIZE: 2147483648
LOG_DISK_SIZE: 6442450944
MAX_IOPS: 10000
MIN_IOPS: 10000
IOPS_WEIGHT: 1
2 rows in set (0.003 sec)

obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_SERVERS\G
*************************** 1. row ***************************
SVR_IP: 127.0.0.1
SVR_PORT: 2882
ZONE: zone1
SQL_PORT: 2881
CPU_CAPACITY: 16
CPU_CAPACITY_MAX: 16
CPU_ASSIGNED: 2
CPU_ASSIGNED_MAX: 2
MEM_CAPACITY: 5368709120
MEM_ASSIGNED: 4294967296
LOG_DISK_CAPACITY: 25769803776
LOG_DISK_ASSIGNED: 8589934592
LOG_DISK_IN_USE: 1275068416
DATA_DISK_CAPACITY: 21474836480
DATA_DISK_IN_USE: 1304428544
DATA_DISK_HEALTH_STATUS: NORMAL
MEMORY_LIMIT: 6442450944
DATA_DISK_ABNORMAL_TIME: NULL
SSL_CERT_EXPIRED_TIME: NULL
1 row in set (0.003 sec)

obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_UNITS\G
*************************** 1. row ***************************
SVR_IP: 127.0.0.1
SVR_PORT: 2882
UNIT_ID: 1
TENANT_ID: 1
ZONE: zone1
MAX_CPU: 1
MIN_CPU: 1
MEMORY_SIZE: 2147483648
MAX_IOPS: 10000
MIN_IOPS: 10000
IOPS_WEIGHT: 1
LOG_DISK_SIZE: 2147483648
LOG_DISK_IN_USE: 330560531
DATA_DISK_IN_USE: 538968064
STATUS: NORMAL
CREATE_TIME: 2022-11-09 15:30:31.149294
*************************** 2. row ***************************
SVR_IP: 127.0.0.1
SVR_PORT: 2882
UNIT_ID: 1001
TENANT_ID: 1001
ZONE: zone1
MAX_CPU: NULL
MIN_CPU: NULL
MEMORY_SIZE: 1073741824
MAX_IOPS: NULL
MIN_IOPS: NULL
IOPS_WEIGHT: NULL
LOG_DISK_SIZE: 644245094
LOG_DISK_IN_USE: 492533494
DATA_DISK_IN_USE: 417333248
STATUS: NORMAL
CREATE_TIME: 2022-11-09 16:28:29.118951
*************************** 3. row ***************************
SVR_IP: 127.0.0.1
SVR_PORT: 2882
UNIT_ID: 1001
TENANT_ID: 1002
ZONE: zone1
MAX_CPU: 1
MIN_CPU: 1
MEMORY_SIZE: 1073741824
MAX_IOPS: 10000
MIN_IOPS: 10000
IOPS_WEIGHT: 1
LOG_DISK_SIZE: 5798205850
LOG_DISK_IN_USE: 289621818
DATA_DISK_IN_USE: 348127232
STATUS: NORMAL
CREATE_TIME: 2022-11-09 16:28:29.118951
3 rows in set (0.003 sec)

obclient [oceanbase]> ALTER RESOURCE UNIT unit1 MAX_CPU 1, MEMORY_SIZE ‘1G’;
ERROR 1235 (0A000): unit MEMORY_SIZE less than __min_full_resource_pool_memory not supported
obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_NUM = 2;
ERROR 4179 (HY000): alter pool unit num which is granted to a tenant not allowed
obclient [oceanbase]> ALTER RESOURCE POOL pool1 UNIT_NUM = 3;
ERROR 4179 (HY000): alter pool unit num which is granted to a tenant not allowed
obclient [oceanbase]>

就一台机器,unit_num=2怎么可能呢?

参数 unit_num 表示在集群的一个 Zone 里面包含的资源单元个数。该值小于等于一个 Zone 中的 OBServer 的个数。

哦哦,单机只能一个unit

您好,请教一下,我在测试的时候,zone下有两个observer,从1修改2,和从2修改为1的时候,都是报这个错误,应该怎么处理呢?
看这个报错的提示是指已经绑定租户的资源池无法修改啊,测试没绑定租户的时候的确是可以修改的。

我有3个observer,在同一个zone下,都是正常状态,资源也充足。都不能对租户的资源池进行在线扩容吗???这不合理呀 @张雨齐

OB 4.0里的语法是:
ALTER RESOURCE TENANT 租户名 UNIT_NUM = xxx;
说明:当前OB4.0还不支持unit_num 缩容。

测试了一下,的确是这个语法,可以增加。
租户下无数据的情况下,执行sql对unit_num 缩容,也不会报错,查看资源占用也的确少了,租户可以连接,但无法使用,并且此时该租户会无法删除(DROP TENANT XXX FORCE),报错5150 - Tenant not in this server。(实际是在对应server上执行的语句)。
租户有数据的情况下,可以扩容,执行sql缩容会提示错误。