Updated on 2022-08-16 GMT+08:00

Resource Management Functions

This section describes the functions of the resource management module.

  • gs_wlm_readjust_user_space(oid)

    Description: This function calibrates the permanent storage space of a user. The input parameter is the user OID. If the input parameter is set to 0, the permanent storage space of all users is calibrated.

    Return type: text

    Example:

    select gs_wlm_readjust_user_space(0);
    gs_wlm_readjust_user_space
    ----------------------------
    Exec Success
    (1 row)
  • pgxc_wlm_readjust_schema_space()

    Description: This function calibrates the permanent storage space of a schema.

    Return type: text

    Example:

    select pgxc_wlm_readjust_schema_space();
    pgxc_wlm_readjust_schema_space
    --------------------------------
    Exec Success
    (1 row)
  • pgxc_wlm_get_schema_space(cstring)

    Description: Obtains the schema space of each instance in a specified logical cluster on the CN.

    Return type: record

    The following table describes return columns.

    Column

    Type

    Description

    schemaname

    text

    Schema name

    schemaid

    oid

    Schema OID

    databasename

    text

    Database name

    databaseid

    oid

    Database OID

    nodename

    text

    Instance name

    nodegroup

    text

    Name of the node group

    usedspace

    bigint

    Size of the used space

    permspace

    bigint

    Upper limit of the space

    Example:

     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 | gaussdb     |      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 | gaussdb     |      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 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     dbms_job           |     3988 | gaussdb     |      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 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     sys                |    11693 | test1        |      16384 | datanode1    | installation |         0 |        -1
     utl_file           |    14644 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     utl_raw            |    14669 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     dbms_sql           |    14674 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     dbms_output        |    14662 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     dbms_random        |    14666 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     dbms_lob           |    14701 | gaussdb     |      15253 | datanode1    | installation |         0 |        -1
     information_schema |    14300 | gaussdb     |      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 | gaussdb     |      15253 | datanode1    | installation |  13049856 |        -1
     redisuser          |    16387 | gaussdb     |      15253 | datanode1    | installation |    630784 |        -1
     pg_toast           |       99 | gaussdb     |      15253 | datanode1    | installation |   3080192 |        -1
     cstore             |      100 | gaussdb     |      15253 | datanode1    | installation |   2408448 |        -1
     pg_catalog         |       11 | test1        |      16384 | datanode2    | installation |   9469952 |        -1
     public             |     2200 | gaussdb     |      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 | gaussdb     |      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 | gaussdb     |      15253 | datanode2    | installation |         0 |        -1
     dbms_job           |     3988 | gaussdb     |      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)

    Description: Obtains the schema space of a specified logical cluster on the CN.

    Return type: record

    The following table describes return columns.

    Column

    Type

    Description

    schemaname

    text

    Schema name

    databasename

    text

    Database name

    nodegroup

    text

    Name of the node group

    total_value

    bigint

    Total cluster space in the current schema

    avg_value

    bigint

    Average space of instances in the current schema

    skew_percent

    integer

    Skew ratio

    extend_info

    text

    Extended information, including the maximum space of a single instance, minimum space of a single instance, and name of the instance with the maximum or minimum space

    Example:

     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             | gaussdb     | 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         | gaussdb     | 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            | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     dbms_job           | gaussdb     | 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                | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     sys                | test1        | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     utl_file           | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     utl_raw            | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     dbms_sql           | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     dbms_output        | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     dbms_random        | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     dbms_lob           | gaussdb     | installation |           0 |         0 |            0 | min:0 datanode1,max:0 datanode1
     information_schema | gaussdb     | 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         | gaussdb     | installation |    75431936 |  12571989 |            3 | min:12124160 datanode4,max:13049856 datanode1
     redisuser          | gaussdb     | installation |     1884160 |    314026 |           50 | min:16384 datanode4,max:630784 datanode1
     pg_toast           | gaussdb     | installation |    17154048 |   2859008 |            7 | min:2637824 datanode4,max:3080192 datanode1
     cstore             | gaussdb     | installation |    15294464 |   2549077 |            5 | min:2408448 datanode1,max:2703360 datanode6
    (31 rows)
    
  • gs_wlm_set_queryband_action(cstring,cstring,int4)

    Description: Sets the action and query order of query_band.

    Return type: boolean

    The following table describes the input parameters.

    Name

    Type

    Description

    qband

    cstring

    Query band key-value pair. The maximum length is 63 characters.

    action

    cstring

    Action associated to a query band

    order

    int4

    Query band query order. The default value is -1.

    Example:

     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)

    Description: Sets the query_band query order.

    Return type: boolean

    The following table describes the input parameters.

    Name

    Type

    Description

    qband

    cstring

    query_band key-value pairs

    order

    int4

    query_band query order. The default value is -1.

    Example:

    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)

    Description: Obtains the action and query order of query_band.

    Return type: record

    The following table describes return columns.

    Column

    Type

    Description

    qband

    cstring

    query_band key-value pairs

    respool_id

    Oid

    OID of the resource pool associated with query_band

    respool

    text

    Name of the resource pool associated with query_band

    priority

    text

    Intra-queue priority associated with query_band

    qborder

    int4

    query_band query order

    Example:

    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()

    Description: This function loads the Cgroup configuration file online on the current instance.

    Return type: record

    The following table describes return columns.

    Column

    Type

    Description

    node_name

    text

    Instance name

    node_host

    text

    IP address of the node where the instance is located

    result

    text

    Whether Cgroup online loading is successful

    Example:

    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()

    Description: This function loads the Cgroup configuration file online on all instances of the system.

    Return type: record

    The following table describes return columns.

    Column

    Type

    Description

    node_name

    text

    Instance name

    node_host

    text

    IP address of the node where the instance is located

    result

    text

    Whether Cgroup online loading is successful

    Example:

     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)

    Description: This function loads the Cgroup configuration file online on a node. The input parameter is the IP address of the node.

    Return type: record

    The following table describes return columns.

    Column

    Type

    Description

    node_name

    text

    Instance name

    node_host

    text

    IP address of the node where the instance is located

    result

    text

    Whether Cgroup online loading is successful

    Example:

    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)
    
  • pg_wlm_jump_queue(pid int)

    Description: Moves a task to the top of the CN queue.

    Return type: Boolean

    Note: Each of these functions returns true if they are successful and false otherwise.

  • gs_wlm_switch_cgroup(pid int, cgroup text)

    Description: Moves a job to other Cgroup to improve the job priority.

    Return type: Boolean

    Note: Each of these functions returns true if they are successful and false otherwise.

  • gs_wlm_node_recover(boolean isForce)

    Description: Updates and restores job information and counts on the CCN in dynamic resource management mode. This function can be executed only by administrators, and is usually used to restore a faulty CN after it was restarted. This function is called by the Cluster Manager (CM). Its usage are as follows:

    • If this function is executed by CN, it instructs the CCN to clear job information and counts on the CN.
    • If this function is executed by CCN, it resets job counts and obtains the latest slow lane job information from the CN.

    Return type: bool

  • gs_wlm_node_clean(cstring nodename)

    Description: On the CCN in dynamic resource management mode, clears the job information and counts of a specified CN. This function can be executed only by administrators, and is usually used to restore a faulty CN after it was restarted. This function is called by the Cluster Manager (CM). Generally, users are not advised to call it.

    Return type: bool