更新时间:2024-01-31 GMT+08:00
分享

资源管理函数

资源管理模块相关函数介绍。

gs_wlm_readjust_user_space(oid)

描述:用户永久存储空间校准函数。入参为用户oid,入参为0的情况下,会校准所有用户的永久存储空间。

返回值类型:text

示例:

1
2
3
4
5
SELECT gs_wlm_readjust_user_space(0);
gs_wlm_readjust_user_space
----------------------------
Exec Success
(1 row)

pgxc_wlm_readjust_schema_space()

描述:Schema永久存储空间校准函数。

返回值类型:text

示例:

1
2
3
4
5
SELECT pgxc_wlm_readjust_schema_space();
pgxc_wlm_readjust_schema_space
--------------------------------
Exec Success
(1 row)

pgxc_wlm_readjust_relfilenode_size_table()

描述:空间统计校准函数,不重建PG_RELFILENODE_SIZE系统表,重新校准用户和schema空间。

由于校准函数执行时与其余业务之间的事务隔离性,校准函数对其它的正在执行的业务不可见,导致校准函数会漏掉此类业务的空间变化,为避免校准之后出现空间差误,建议用户使用空间校准函数时,应选择空间大小稳定无变化的时候执行校准。

返回值类型:text

示例:

1
2
3
4
5
SELECT pgxc_wlm_readjust_schema_space();
pgxc_wlm_readjust_relfilenode_size_table
-----------------------------------------
Exec Success
(1 row)

pgxc_wlm_readjust_relfilenode_size_table(integer)

描述:空间统计校准函数。

由于校准函数执行时与其余业务之间的事务隔离性,校准函数对其它的正在执行的业务不可见,导致校准函数会漏掉此类业务的空间变化,为避免校准之后出现空间差误,建议用户使用空间校准函数时,应选择空间大小稳定无变化的时候执行校准。

参数:取值范围为0~4,不同的入参值代表不同的校准粒度。

  • 入参为0(默认入参为0):不重建PG_RELFILENODE_SIZE系统表,重新校准用户和schema空间。
  • 入参为1:重建PG_RELFILENODE_SIZE系统表,并且重新校准用户和schema空间。
  • 入参为2:重建PG_RELFILENODE_SIZE系统表。
  • 入参为3:重新校准schema空间。
  • 入参为4:重新校准用户空间。

返回值类型:text

示例:

1
2
3
4
5
SELECT * FROM  pgxc_wlm_readjust_relfilenode_size_table(1);
    result
--------------
 Exec success
(1 row)

pgxc_wlm_get_schema_space(cstring)

描述:在CN上查询某个逻辑集群下各实例的Schema空间信息,入参为逻辑集群名称。

返回值类型:record

函数返回字段如下:

名称

类型

描述

schemaname

text

模式名

schemaid

oid

模式OID

databasename

text

数据库名

databaseid

oid

数据库OID

nodename

text

实例名称

nodegroup

text

节点组名称

usedspace

bigint

已使用的空间大小

permspace

bigint

空间上限值

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
SELECT * FROM pgxc_wlm_get_schema_space('group1');
     schemaname     | schemaid | databasename | databaseid |   nodename   |  nodegroup   | usedspace | permspace
--------------------+----------+--------------+------------+--------------+--------------+-----------+-----------
 pg_catalog         |       11 | test1        |      16384 | datanode1    | installation |   9469952 |        -1
 public             |     2200 | postgres     |      15253 | datanode1    | installation |  25280512 |        -1
 pg_toast           |       99 | test1        |      16384 | datanode1    | installation |   1859584 |        -1
 cstore             |      100 | test1        |      16384 | datanode1    | installation |         0 |        -1
 data_redis         |    18106 | postgres     |      15253 | datanode1    | installation |    655360 |        -1
 data_redis         |    18116 | test1        |      16384 | datanode1    | installation |         0 |        -1
 public             |     2200 | test1        |      16384 | datanode1    | installation |     16384 |        -1
 dbms_om            |     3987 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 dbms_job           |     3988 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 dbms_om            |     3987 | test1        |      16384 | datanode1    | installation |         0 |        -1
 dbms_job           |     3988 | test1        |      16384 | datanode1    | installation |         0 |        -1
 sys                |    11693 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 sys                |    11693 | test1        |      16384 | datanode1    | installation |         0 |        -1
 utl_file           |    14644 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 utl_raw            |    14669 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 dbms_sql           |    14674 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 dbms_output        |    14662 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 dbms_random        |    14666 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 dbms_lob           |    14701 | postgres     |      15253 | datanode1    | installation |         0 |        -1
 information_schema |    14300 | postgres     |      15253 | datanode1    | installation |    294912 |        -1
 information_schema |    14300 | test1        |      16384 | datanode1    | installation |    294912 |        -1
 utl_file           |    14644 | test1        |      16384 | datanode1    | installation |         0 |        -1
 dbms_output        |    14662 | test1        |      16384 | datanode1    | installation |         0 |        -1
 dbms_random        |    14666 | test1        |      16384 | datanode1    | installation |         0 |        -1
 utl_raw            |    14669 | test1        |      16384 | datanode1    | installation |         0 |        -1
 dbms_sql           |    14674 | test1        |      16384 | datanode1    | installation |         0 |        -1
 dbms_lob           |    14701 | test1        |      16384 | datanode1    | installation |         0 |        -1
 pg_catalog         |       11 | postgres     |      15253 | datanode1    | installation |  13049856 |        -1
 redisuser          |    16387 | postgres     |      15253 | datanode1    | installation |    630784 |        -1
 pg_toast           |       99 | postgres     |      15253 | datanode1    | installation |   3080192 |        -1
 cstore             |      100 | postgres     |      15253 | datanode1    | installation |   2408448 |        -1
 pg_catalog         |       11 | test1        |      16384 | datanode2    | installation |   9469952 |        -1
 public             |     2200 | postgres     |      15253 | datanode2    | installation |  25214976 |        -1
 pg_toast           |       99 | test1        |      16384 | datanode2    | installation |   1859584 |        -1
 cstore             |      100 | test1        |      16384 | datanode2    | installation |         0 |        -1
 data_redis         |    18106 | postgres     |      15253 | datanode2    | installation |    655360 |        -1
 data_redis         |    18116 | test1        |      16384 | datanode2    | installation |         0 |        -1
 public             |     2200 | test1        |      16384 | datanode2    | installation |     16384 |        -1
 dbms_om            |     3987 | postgres     |      15253 | datanode2    | installation |         0 |        -1
 dbms_job           |     3988 | postgres     |      15253 | datanode2    | installation |         0 |        -1
 dbms_om            |     3987 | test1        |      16384 | datanode2    | installation |         0 |        -1
 dbms_job           |     3988 | test1        |      16384 | datanode2    | installation |         0 |        -1

pgxc_wlm_analyze_schema_space(cstring)

描述:在CN上查询某个逻辑集群下集群整体的Schema空间信息,入参为逻辑集群名称。

返回值类型:record

函数返回字段如下:

名称

类型

描述

schemaname

text

模式名

databasename

text

数据库名

nodegroup

text

节点组名称

total_value

bigint

该模式的集群空间总值

avg_value

bigint

该模式的各实例空间平均值

skew_percent

integer

倾斜率

extend_info

text

提供信息包括:单实例空间最大值、单实例空间最小值以及最大最小空间所在的实例名

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
SELECT * FROM pgxc_wlm_analyze_schema_space('group1');
     schemaname     | databasename |  nodegroup   | total_value | avg_value | skew_percent |                  extend_info
--------------------+--------------+--------------+-------------+-----------+--------------+-----------------------------------------------
 pg_catalog         | test1        | installation |    56819712 |   9469952 |            0 | min:9469952 datanode1,max:9469952 datanode1
 public             | postgres     | installation |   150495232 |  25082538 |            0 | min:24903680 datanode6,max:25280512 datanode1
 pg_toast           | test1        | installation |    11157504 |   1859584 |            0 | min:1859584 datanode1,max:1859584 datanode1
 cstore             | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 data_redis         | postgres     | installation |     1966080 |    327680 |           50 | min:0 datanode4,max:655360 datanode1
 data_redis         | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 public             | test1        | installation |       98304 |     16384 |            0 | min:16384 datanode1,max:16384 datanode1
 dbms_om            | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_job           | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_om            | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_job           | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 sys                | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 sys                | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 utl_file           | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 utl_raw            | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_sql           | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_output        | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_random        | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_lob           | postgres     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 information_schema | postgres     | installation |     1769472 |    294912 |            0 | min:294912 datanode1,max:294912 datanode1
 information_schema | test1        | installation |     1769472 |    294912 |            0 | min:294912 datanode1,max:294912 datanode1
 utl_file           | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_output        | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_random        | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 utl_raw            | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_sql           | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 dbms_lob           | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
 pg_catalog         | postgres     | installation |    75431936 |  12571989 |            3 | min:12124160 datanode4,max:13049856 datanode1
 redisuser          | postgres     | installation |     1884160 |    314026 |           50 | min:16384 datanode4,max:630784 datanode1
 pg_toast           | postgres     | installation |    17154048 |   2859008 |            7 | min:2637824 datanode4,max:3080192 datanode1
 cstore             | postgres     | installation |    15294464 |   2549077 |            5 | min:2408448 datanode1,max:2703360 datanode6
(31 rows)

gs_wlm_set_queryband_action(cstring,cstring,int4)

描述:设置query_band关联行为和次序。

返回值类型:boolean

函数入参字段如下:

名称

类型

描述

qband

cstring

query_band键值对,长度上限为63个字符。

action

cstring

query_band关联行为。

order

int4

query_band搜索次序,缺省参数,默认为-1。

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT * FROM gs_wlm_set_queryband_action('a=1','respool=p1');
 gs_wlm_set_queryband_action
-----------------------------
 t
(1 row)
SELECT * FROM gs_wlm_set_queryband_action('a=3','respool=p1;priority=rush',1);
 gs_wlm_set_queryband_action
-----------------------------
 t
(1 row)

gs_wlm_set_queryband_order(cstring,int4)

描述:设置query_band次序。

返回值类型:boolean

函数入参字段如下:

名称

类型

描述

qband

cstring

query_band键值对

order

int4

query_band搜索次序,缺省参数,默认为-1

示例:

1
2
3
4
5
SELECT * FROM gs_wlm_set_queryband_order('a=1',2);
 gs_wlm_set_queryband_action
-----------------------------
 t
(1 row)

gs_wlm_get_queryband_action(cstring)

描述:查询query_band关联行为和次序。

返回值类型:record

函数返回字段如下:

名称

类型

描述

qband

cstring

query_band键值对

respool_id

Oid

query band关联资源池OID

respool

text

query band关联资源池名

priority

text

query band关联队队列内优先级

qborder

int4

query_band搜索次序

示例:

1
2
3
4
5
SELECT * FROM gs_wlm_get_queryband_action('a=1');
qband | respool_id | respool | priority | qborder
-------+------------+---------+----------+---------
 a=1   |      16388 | p1      | Medium   |      -1
(1 row)

gs_cgroup_reload_conf()

描述:在当前实例上进行cgroup配置文件在线加载。

返回值类型:record

函数返回字段如下:

名称

类型

描述

node_name

text

实例名称

node_host

text

实例所在节点的IP地址

result

text

cgroup在线加载是否成功

示例:

1
2
3
4
SELECT * FROM gs_cgroup_reload_conf();
 node_name |   node_host    | result
-----------+----------------+---------
 cn_5001   | 192.168.178.35 | success

pgxc_cgroup_reload_conf()

描述:在系统所有实例上进行cgroup配置文件在线加载。

返回值类型:record

函数返回字段如下:

名称

类型

描述

node_name

text

实例名称

node_host

text

实例所在节点的IP地址

result

text

cgroup在线加载是否成功

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
SELECT * FROM pgxc_cgroup_reload_conf();
  node_name   |    node_host    | result
--------------+-----------------+---------
 dn_6025_6026 | 192.168.178.177 | success
 dn_6049_6050 | 192.168.179.79  | success
 dn_6051_6052 | 192.168.179.79  | success
 dn_6055_6056 | 192.168.179.79  | success
 dn_6067_6068 | 192.168.181.57  | success
 dn_6023_6024 | 192.168.178.39  | success
 dn_6009_6010 | 192.168.181.21  | success
 dn_6011_6012 | 192.168.181.21  | success
 dn_6015_6016 | 192.168.181.21  | success
 dn_6029_6030 | 192.168.178.177 | success
 dn_6031_6032 | 192.168.178.177 | success
 dn_6045_6046 | 192.168.179.45  | success
 cn_5001      | 192.168.178.35  | success
 cn_5003      | 192.168.178.39  | success
 dn_6061_6062 | 192.168.181.179 | success
 cn_5006      | 192.168.179.45  | success
 cn_5004      | 192.168.178.177 | success
 cn_5002      | 192.168.181.21  | success
 cn_5005      | 192.168.178.187 | success
 dn_6019_6020 | 192.168.178.39  | success
 dn_6007_6008 | 192.168.178.35  | success
 dn_6071_6072 | 192.168.181.57  | success
 dn_6003_6004 | 192.168.178.35  | success
 dn_6013_6014 | 192.168.181.21  | success
 dn_6035_6036 | 192.168.178.187 | success
 dn_6037_6038 | 192.168.178.187 | success
 dn_6001_6002 | 192.168.178.35  | success
 dn_6063_6064 | 192.168.181.179 | success
 dn_6005_6006 | 192.168.178.35  | success
 dn_6057_6058 | 192.168.181.179 | success
 dn_6069_6070 | 192.168.181.57  | success
 dn_6027_6028 | 192.168.178.177 | success
 dn_6059_6060 | 192.168.181.179 | success
 dn_6041_6042 | 192.168.179.45  | success
 dn_6043_6044 | 192.168.179.45  | success
 dn_6047_6048 | 192.168.179.45  | success
 dn_6033_6034 | 192.168.178.187 | success
 dn_6065_6066 | 192.168.181.57  | success
 dn_6021_6022 | 192.168.178.39  | success
 dn_6017_6018 | 192.168.178.39  | success
 dn_6039_6040 | 192.168.178.187 | success
 dn_6053_6054 | 192.168.179.79  | success
(42 rows)

pgxc_cgroup_reload_conf(text)

描述:在某个节点上进行cgroup配置文件在线加载。入参为节点的IP地址。

返回值类型:record

函数返回字段如下:

名称

类型

描述

node_name

text

实例名称

node_host

text

实例所在节点的IP地址

result

text

cgroup在线加载是否成功

示例:

1
2
3
4
5
6
7
8
9
SELECT * FROM pgxc_cgroup_reload_conf('192.168.178.35');
  node_name   |   node_host    | result
--------------+----------------+---------
 cn_5001      | 192.168.178.35 | success
 dn_6007_6008 | 192.168.178.35 | success
 dn_6003_6004 | 192.168.178.35 | success
 dn_6001_6002 | 192.168.178.35 | success
 dn_6005_6006 | 192.168.178.35 | success
(5 rows)

gs_wlm_node_recover(boolean isForce)

描述:动态资源管理模式下,对CCN管控计数和作业信息进行更新恢复。该函数仅支持管理员执行,通常用于CN实例故障重启后的实例恢复,由集群管理组件(CM)调用,不建议用户直接调用。具体功能如下:

  • CN执行:通知CCN清理该CN执行的作业信息和作业对应的管控计数信息。
  • CCN执行:重置管控计数信息,并从CN上获取最新的慢车道作业信息。

返回值类型:bool

gs_wlm_node_clean(cstring nodename)

描述:动态资源管理模式下,对CCN上入参指定的CN执行的作业信息和对应的管控计数信息进行清理。该函数仅支持管理员执行,通常用于CN实例故障重启后的实例恢复,由集群管理组件(CM)调用,正常情况下不建议用户直接调用。

返回值类型:bool

pg_stat_get_wlm_node_resource_info(int4)

描述:显示所有DN资源的汇总信息。

返回值类型:record

函数返回字段如下:

名称

类型

描述

min_mem_util

integer

DN最小内存使用率。

max_mem_util

integer

DN最大内存使用率。

min_cpu_util

integer

DN最小CPU使用率。

max_cpu_util

integer

DN最大CPU使用率。

min_io_util

integer

DN最小IO使用率。

max_io_util

integer

DN最大IO使用率。

phy_usemem_rate

integer

物理节点最大内存使用率。

pg_stat_get_workload_struct_info()

描述:定位CCN排队问题的负载管理函数。此函数为内部函数,如需使用请联系技术支持工程师。

返回值类型:record

分享:

    相关文档

    相关产品