数据仓库服务 GAUSSDB(DWS)-扫描残留文件函数:pgxc_get_scan_residualfiles(query_flag)

时间:2024-04-18 16:25:04

pgxc_get_scan_residualfiles(query_flag)

描述:pg_get_scan_residualfiles()的CN统一执行函数。该函数为集群级函数,与当前所在的数据库无关,在CN实例上运行。

参数说明:query_flag。参数类型int,用于表示执行范围。1表示CN,2表示主DN,4表示备DN,通过或运算可以得到查询并集,如1|2=3表示CN+主DN,1|2|4=7表示CN+主DN+备DN,默认值是7。

返回类型:record

返回信息如下:

表4 返回字段

名称

类型

描述

nodename

name

节点名称。

instance_id

text

实例名称。

handled

bool

是否已处理。

dbname

text

数据库名称。

residualfile

text

残留文件路径。

size

bigint

文件大小,单位为byte。

inode

bigint

残留文件stat信息中的Inode。

atime

timestamptz

残留文件stat信息中的Access time。

mtime

timestamptz

残留文件stat信息中的Modifie time。

ctime

timestamptz

残留文件stat信息中的Chang time。

filepath

text

对应pgscrf_meta文件。

notes

text

注释。

示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SELECT * FROM pgxc_get_scan_residualfiles();
  node_name   | instance_id | handled |  dbname  |                            residualfile                             | size  |   inode    |         atime          |         mtime          |         ctime          |                     filepath                      | notes 
--------------+-------------+---------+----------+---------------------------------------------------------------------+-------+------------+------------------------+------------------------+------------------------+---------------------------------------------------+-------
 dn_6001_6002 | dn_6001     | f       | postgres | base/16323/2147494191                                               | 81920 |  805444689 | 2023-10-27 14:21:49+08 | 2023-10-27 14:23:08+08 | 2023-10-27 14:23:08+08 | pgscrf_meta_1663_16323_20231027144103839354       | 
 dn_6001_6002 | dn_6001     | f       | postgres | base/16323/2147494191_fsm                                           |     0 |  805444690 | 2023-10-27 14:21:49+08 | 2023-10-27 14:21:49+08 | 2023-10-27 14:21:49+08 | pgscrf_meta_1663_16323_20231027144103839354       | 
 dn_6001_6002 | dn_6001     | f       | postgres | base/16323/2147494191_vm                                            |     0 |  805444691 | 2023-10-27 14:21:49+08 | 2023-10-27 14:21:49+08 | 2023-10-27 14:21:49+08 | pgscrf_meta_1663_16323_20231027144103839354       | 
 dn_6001_6002 | dn_6001     | f       | postgres | pg_tblspc/2147484281/PG_9.2_201611171_dn_6001_6002/16323/2147894282 |     0 | 7247789391 | 2023-10-27 14:37:03+08 | 2023-10-27 14:37:03+08 | 2023-10-27 14:37:03+08 | pgscrf_meta_2147484281_16323_20231027144103839826 | 
 cn_5001      | cn_5001     | f       | postgres | base/16323/2147784070                                               | 40960 |  537070896 | 2023-10-27 14:38:59+08 | 2023-10-27 14:39:17+08 | 2023-10-27 14:39:17+08 | pgscrf_meta_1663_16323_20231027144103946217       | 
 dn_6007_6008 | dn_6008     | f       | postgres | base/16323/2147784073                                               | 24576 | 7784666105 | 2023-10-27 14:40:21+08 | 2023-10-27 14:40:34+08 | 2023-10-27 14:40:34+08 | pgscrf_meta_1663_16323_20231027144104171311       | 
(6 rows)
support.huaweicloud.com/sqlreference-830-dws/dws_06_0373.html