Files
doc-exports/docs/dws/dev/dws_06_0373.html
luhuayi 177cd61a57 DWS DEVG 910.211 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: luhuayi <luhuayi@huawei.com>
Co-committed-by: luhuayi <luhuayi@huawei.com>
2025-05-05 07:44:03 +00:00

563 lines
63 KiB
HTML

<a name="EN-US_TOPIC_0000001811515453"></a><a name="EN-US_TOPIC_0000001811515453"></a>
<h1 class="topictitle1">Functions for Scanning Residual Files</h1>
<div id="body0000001739838957"><p id="EN-US_TOPIC_0000001811515453__p3125214427">Only cluster 8.3.0 and later versions support the function of scanning residual files. All functions described in this section can be invoked only by the <strong id="EN-US_TOPIC_0000001811515453__b12749201216202">sysadmin</strong> role.</p>
<div class="section" id="EN-US_TOPIC_0000001811515453__section118151314474"><h4 class="sectiontitle">pg_scan_residualfiles()</h4><p id="EN-US_TOPIC_0000001811515453__p1473846115910">Description: This function scans all residual file records in the database connected to the current node. It is an instance-level function and is related to the current database, and it can run on any instance.</p>
<ul id="EN-US_TOPIC_0000001811515453__ul2163153185916"><li id="EN-US_TOPIC_0000001811515453__li18163183115911">When it is executed on a CN, it scans the database of the CN and OBS for residual files.</li><li id="EN-US_TOPIC_0000001811515453__li7163133116594">When it is executed on a CN, it scans the database of the DN for residual files.</li></ul>
<p id="EN-US_TOPIC_0000001811515453__p16571411194812">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p1432715712487">The following information is displayed:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table189751315184918" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row209761115144919"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.2.6.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p6976171594911">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.2.6.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p79761315204914">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.91%" id="mcps1.3.2.6.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p1097691514919">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row1097711584911"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.2.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p98451559205919">pgscrf</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.2.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p3845959115913">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.2.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p208454596594">Local path of the metadata file that records residual file information.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001811515453__p5266145412112">Example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001811515453__screen17759751145517"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span>
<span class="normal">6</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_scan_residualfiles</span><span class="p">();</span>
<span class="w"> </span><span class="n">pgscrf</span><span class="w"> </span>
<span class="c1">--------------------------------------------------------------------</span>
<span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_1663_16323_20231027143716005244</span>
<span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_2147484281_16323_20231027143716005713</span>
<span class="p">(</span><span class="mi">2</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="note" id="EN-US_TOPIC_0000001811515453__en-us_topic_0000001444933648_note11841105717509"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001811515453__p71919471204">The restrictions on using this function are as follows:</p>
<ul id="EN-US_TOPIC_0000001811515453__ul129555317262"><li id="EN-US_TOPIC_0000001811515453__li1395673172619">Only the current database can be scanned for residual files. Currently, only the default tablespace<span id="EN-US_TOPIC_0000001811515453__ph10647104042111">, OBS tablespace,</span> and user-defined tablespace are scanned.</li><li id="EN-US_TOPIC_0000001811515453__li1395613162610">This function is a heavy-load operation and cannot be used concurrently on a single node. You should avoid using this function when the service is overloaded or the resource is scarce.</li><li id="EN-US_TOPIC_0000001811515453__li1612916471543">Only hot partitions in cold-hot-partition-separated tables are supported. Cold partitions are not supported.</li><li id="EN-US_TOPIC_0000001811515453__li10431161413563">Do not use this function during the upgrade observation period.</li><li id="EN-US_TOPIC_0000001811515453__li9276198006">Residual files in the deleted database cannot be scanned.</li><li id="EN-US_TOPIC_0000001811515453__li273012919419">Inconsistent cluster metadata information can cause this function incorrectly scan valid data files.</li></ul>
</div></div>
<div class="section" id="EN-US_TOPIC_0000001811515453__section14054464914"><h4 class="sectiontitle">pgxc_scan_residualfiles(query_flag)</h4><p id="EN-US_TOPIC_0000001811515453__p1563412035010">Description: Unified CN execution function of <strong id="EN-US_TOPIC_0000001811515453__b8647316132811">pg_scan_residualfiles()</strong> This function is a cluster-level function and is related to the current database. It runs on CNs.</p>
<p id="EN-US_TOPIC_0000001811515453__p14809121511170">Parameter description: <strong id="EN-US_TOPIC_0000001811515453__b1429624463113">query_flag</strong>. The parameter type is int, indicating the execution range. <strong id="EN-US_TOPIC_0000001811515453__b1987413492332">1</strong> indicates the CN, <strong id="EN-US_TOPIC_0000001811515453__b1254345517337">2</strong> indicates the primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b1863714597332">4</strong> indicates the standby DN. The query union set can be obtained through the OR operation. For example, <strong id="EN-US_TOPIC_0000001811515453__b123831240173413">1|2=3</strong> indicates the CN and primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b1853255517342">1|2|4=7</strong> indicates the CN, primary DN, and standby DN. The default value is <strong id="EN-US_TOPIC_0000001811515453__b08013333340">7</strong>.</p>
<p id="EN-US_TOPIC_0000001811515453__p10634220125017">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p05042685513">The command output is as follows.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table1830893912316" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row1430911391134"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.4.6.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p113096393312">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.4.6.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p18309939134">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.91%" id="mcps1.3.4.6.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p163090391133">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row1730919391133"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.4.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p113093391239">nodename</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p193098394317">name</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.4.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p430933914318">Node name.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row205174013813"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.4.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p05171908388">instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1451714013816">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.4.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p19518190153820">Instance name.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row1430917391232"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.4.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p13094399317">pgscrf</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p18310103911317">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.4.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p131073911314">Local path of the metadata file that records residual file information.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001811515453__p1263714202505">Example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001811515453__screen18513217195611"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span>
<span class="normal">16</span>
<span class="normal">17</span>
<span class="normal">18</span>
<span class="normal">19</span>
<span class="normal">20</span>
<span class="normal">21</span>
<span class="normal">22</span>
<span class="normal">23</span>
<span class="normal">24</span>
<span class="normal">25</span>
<span class="normal">26</span>
<span class="normal">27</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_scan_residualfiles</span><span class="p">();</span>
<span class="w"> </span><span class="n">node_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">instance_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pgscrf</span><span class="w"> </span>
<span class="c1">--------------+-------------+--------------------------------------------------------------------</span>
<span class="w"> </span><span class="n">dn_6001_6002</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_1663_16323_20231027144103839354</span>
<span class="w"> </span><span class="n">dn_6001_6002</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_2147484281_16323_20231027144103839826</span>
<span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_1663_16323_20231027144103946217</span>
<span class="w"> </span><span class="n">dn_6007_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_1663_16323_20231027144104171311</span>
<span class="p">(</span><span class="mi">4</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
<span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_scan_residualfiles</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
<span class="w"> </span><span class="n">node_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">instance_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pgscrf</span><span class="w"> </span>
<span class="c1">-----------+-------------+--------------------------------------------------------------</span>
<span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_1663_16323_20231027144421861628</span>
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
<span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_scan_residualfiles</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>
<span class="w"> </span><span class="n">node_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">instance_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pgscrf</span><span class="w"> </span>
<span class="c1">--------------+-------------+--------------------------------------------------------------------</span>
<span class="w"> </span><span class="n">dn_6001_6002</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_1663_16323_20231027144424210395</span>
<span class="w"> </span><span class="n">dn_6001_6002</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_2147484281_16323_20231027144424210855</span>
<span class="p">(</span><span class="mi">2</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
<span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_scan_residualfiles</span><span class="p">(</span><span class="mi">4</span><span class="p">);</span>
<span class="w"> </span><span class="n">node_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">instance_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pgscrf</span><span class="w"> </span>
<span class="c1">--------------+-------------+--------------------------------------------------------------</span>
<span class="w"> </span><span class="n">dn_6007_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">pgscrf_meta_1663_16323_20231027144427492060</span>
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="note" id="EN-US_TOPIC_0000001811515453__note1785114610617"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001811515453__p67313473114">The restrictions on using this function are as follows:</p>
<ul id="EN-US_TOPIC_0000001811515453__ul17862472018"><li id="EN-US_TOPIC_0000001811515453__li88574710117">Only the current database can be scanned for residual files. Currently, only the default tablespace, OBS tablespace, and user-defined tablespace are scanned.</li><li id="EN-US_TOPIC_0000001811515453__li185114715115">This function is a heavy-load operation and cannot be used concurrently on a single node. You should avoid using this function when the service is overloaded or the resource is scarce.</li><li id="EN-US_TOPIC_0000001811515453__li188514477116">Only hot partitions in cold-hot-partition-separated tables are supported. Cold partitions are not supported.</li><li id="EN-US_TOPIC_0000001811515453__li985124720120">Do not use this function during the upgrade observation period.</li><li id="EN-US_TOPIC_0000001811515453__li1686747514">Residual files in the deleted database cannot be scanned.</li><li id="EN-US_TOPIC_0000001811515453__li1086447010">Inconsistent cluster metadata information can cause this function incorrectly scan valid data files.</li></ul>
</div></div>
<div class="section" id="EN-US_TOPIC_0000001811515453__section1630384295114"><h4 class="sectiontitle">pg_get_scan_residualfiles()</h4><p id="EN-US_TOPIC_0000001811515453__p1883785544">Description: Obtains all residual file records scanned on the current node. This function is an instance-level function and is irrelevant to the current database. It can run on any instance.</p>
<p id="EN-US_TOPIC_0000001811515453__p16883289548">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p15883882549">The command output is as follows.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table186110116317" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row46111311235"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.6.5.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p1461115115319">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.6.5.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p10611411532">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.91%" id="mcps1.3.6.5.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p5612121115315">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row36121811933"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p9612511338">handled</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p13612711836">bool</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p4908598325">Whether residual files have been processed, moved, or modified.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row16129116318"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p1961214116310">dbname</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p166127113319">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p26129111038">Database name</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row86121011834"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p1961218118312">residualfile</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p761301114315">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p1561351112311">Path of the residual file</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row66131011837"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p7613711937">size</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p36138118319">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p86137119316">File size, in bytes. For residual files in the OBS path, the value of this parameter is <strong id="EN-US_TOPIC_0000001811515453__b14258613181513">0</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row1461314111320"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p126131611033">inode</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p161313111636">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p1161371116314">Inode in the stat information of the residual file. For residual files in the OBS path, the value of this parameter is <strong id="EN-US_TOPIC_0000001811515453__b1997843731518">0</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row2613611338"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p961315111135">atime</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p261331111311">timestamptz</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p961319112314"><strong id="EN-US_TOPIC_0000001811515453__b1575175813394">Access time</strong> in the stat information of the residual file. For residual files in the OBS path, the value of this parameter is empty.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row761316111531"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p561412112319">mtime</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p136146111834">timestamptz</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p561431115315"><strong id="EN-US_TOPIC_0000001811515453__b487614519812">Modify time</strong> in the <strong id="EN-US_TOPIC_0000001811515453__b169463381080">stat</strong> information of the residual file. For residual files in the OBS path, the value of this parameter is empty.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row76149112313"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p6614171119312">ctime</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p126149111631">timestamptz</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p56141711131"><strong id="EN-US_TOPIC_0000001811515453__b26497188402">Change time</strong> in the stat information of the residual file. For residual files in the OBS path, the value of this parameter is empty.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row1561412116318"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p76144111439">filepath</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p961421112312">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p1061441113315">Local path of the metadata file that records residual file information, corresponding to the <strong id="EN-US_TOPIC_0000001811515453__b18337132316160">pgscrf_meta</strong> file.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row1561441118316"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.6.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p11614711136">notes</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.6.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p4614911839">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.6.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p13615111834">Notes</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001811515453__section317811492523"><h4 class="sectiontitle">pgxc_get_scan_residualfiles(query_flag)</h4><p id="EN-US_TOPIC_0000001811515453__p1910444410547">Description: Unified CN execution function of <strong id="EN-US_TOPIC_0000001811515453__b840518014414">pg_get_scan_residualfiles()</strong> This function is a cluster-level function and is irrelevant to the current database. It runs on CNs.</p>
<p id="EN-US_TOPIC_0000001811515453__p144694901414">The <strong id="EN-US_TOPIC_0000001811515453__b12312173431620">query_flag</strong> parameter is of the int type and indicates the execution range. <strong id="EN-US_TOPIC_0000001811515453__b5446745101617">1</strong> indicates the CN, <strong id="EN-US_TOPIC_0000001811515453__b17447194571617">2</strong> indicates the primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b19447154521619">4</strong> indicates the standby DN. The query union set can be obtained through the OR operation. For example, <strong id="EN-US_TOPIC_0000001811515453__b2044784551617">1|2=3</strong> indicates the CN and primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b0448204512164">1|2|4=7</strong> indicates the CN, primary DN, and standby DN. The default value is <strong id="EN-US_TOPIC_0000001811515453__b1294482101710">7</strong>.</p>
<p id="EN-US_TOPIC_0000001811515453__p20104444105419">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p317831335516">The command output is as follows.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table3385361944" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row538666947"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.7.6.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p338616147">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.7.6.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p19386361542">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.91%" id="mcps1.3.7.6.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p1238619614415">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row7162150103519"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p9739222362">nodename</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p117212229365">name</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p971522103617">Node name</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row119513353379"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p3951133573714">instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p3951535193710">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p7951113517377">Instance name</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row1838617612418"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p1338613616415">handled</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p9387561748">bool</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p188111837183911">Whether residual files have been processed, moved, or modified.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row13387461742"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p16387146248">dbname</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p6387861346">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p8387061843">Database name</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row83872067415"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p1838718617416">residualfile</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p93871761242">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p123871561246">Path of the residual file</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row173871961648"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p15387261247">size</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p19388760411">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p15388266420">File size, in bytes. For residual files in the OBS path, the value of this parameter is <strong id="EN-US_TOPIC_0000001811515453__b123972911173">0</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row10388116344"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p1738815613420">inode</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1738818613417">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p2388126140">Inode in the stat information of the residual file. For residual files in the OBS path, the value of this parameter is <strong id="EN-US_TOPIC_0000001811515453__b14733141110175">0</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row33881862044"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p63885615413">atime</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p238811612417">timestamptz</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p11388461149"><strong id="EN-US_TOPIC_0000001811515453__b1750525415416">Access time</strong> in the stat information of the residual file. For residual files in the OBS path, the value of this parameter is empty.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row19389136249"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p73893610418">mtime</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p12389768410">timestamptz</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p7389146741"><strong id="EN-US_TOPIC_0000001811515453__b469316419816">Modify time</strong> in the <strong id="EN-US_TOPIC_0000001811515453__b1693241284">stat</strong> information of the residual file. For residual files in the OBS path, the value of this parameter is empty.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row10389066415"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p143891961245">ctime</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p103891361446">timestamptz</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p638914611414"><strong id="EN-US_TOPIC_0000001811515453__b73043579411">Change time</strong> in the stat information of the residual file. For residual files in the OBS path, the value of this parameter is empty.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row9390462417"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p33901261545">filepath</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p83901660416">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p143901961548">Local path of the metadata file that records residual file information, corresponding to the <strong id="EN-US_TOPIC_0000001811515453__b798118208173">pgscrf_meta</strong> file.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row12390161248"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.7.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p9390176346">notes</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.7.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1539017615420">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.7.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p1739086740">Notes</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001811515453__section163605107536"><h4 class="sectiontitle">pg_archive_scan_residualfiles()</h4><p id="EN-US_TOPIC_0000001811515453__p2131155135411">Description: Archives all residual file records scanned on the database connected to the current node. This function is an instance-level function and is related to the current database. It can run on any instance.</p>
<p id="EN-US_TOPIC_0000001811515453__p1913355125412">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p16498101675515">The command output is as follows.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table91335517545" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row10147557547"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.8.5.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p171412554545">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.97%" id="mcps1.3.8.5.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p514145510545">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.940000000000005%" id="mcps1.3.8.5.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p7143551549">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row121414557543"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.8.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p19556192013410">archive</p>
</td>
<td class="cellrowborder" valign="top" width="20.97%" headers="mcps1.3.8.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1055752016419">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.940000000000005%" headers="mcps1.3.8.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p15579201544">Path of the local folder after archiving. Residual files in the OBS path are archived in the corresponding OBS database directory.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row915115511548"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.8.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p18557120640">count</p>
</td>
<td class="cellrowborder" valign="top" width="20.97%" headers="mcps1.3.8.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1255719209418">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.940000000000005%" headers="mcps1.3.8.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p255782020414">Number of archived residual files.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row18151455125416"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.8.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p85571208413">size</p>
</td>
<td class="cellrowborder" valign="top" width="20.97%" headers="mcps1.3.8.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1255716201548">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.940000000000005%" headers="mcps1.3.8.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p14557132010419">Total size of archived residual files, in bytes.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001811515453__p41575515414">Example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001811515453__screen12571122905615"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_archive_scan_residualfiles</span><span class="p">();</span>
<span class="w"> </span><span class="n">archive</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">count</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">size</span><span class="w"> </span>
<span class="c1">--------------------------------------------------------------+-------+-------</span>
<span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">archive</span><span class="o">/</span><span class="n">pgscrf_archive_20231027144613791801</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">81920</span>
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001811515453__note1212964924513"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001811515453__ul1129204964511"><li id="EN-US_TOPIC_0000001811515453__li15129184964512">This function can archive only the residual files recorded in the current login database. During archiving, the residual files are verified. The verification results are as follows:<ul id="EN-US_TOPIC_0000001811515453__ul1413094918453"><li id="EN-US_TOPIC_0000001811515453__li513074913457">Verification passed: After the verification is passed, the residual files are archived and marked as handled.</li><li id="EN-US_TOPIC_0000001811515453__li3130104934514">Verification failed: If the verification fails, the residual files are not archived and marked as handled.</li><li id="EN-US_TOPIC_0000001811515453__li2131849204519">Verification delayed: If the verification is delayed, it indicates that verification is not possible at the moment, and archiving is skipped. The verification delay is related to the transaction completion status and the standby node's redo progress.</li></ul>
</li><li id="EN-US_TOPIC_0000001811515453__li6131164984514">The actual archive directory and the corresponding tablespace are in the same file system. Deleting the tablespace also deletes the archived residual files.</li><li id="EN-US_TOPIC_0000001811515453__li1613234994510">This function cannot be used after DDL delay is enabled.</li><li id="EN-US_TOPIC_0000001811515453__li1913214916453">This function is a heavy-load operation and cannot be used concurrently on a single node. You should avoid using this function when the service is overloaded or the resource is scarce.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001811515453__section184002514538"><h4 class="sectiontitle">pgxc_archive_scan_residualfiles(query_flag)</h4><p id="EN-US_TOPIC_0000001811515453__p772973015433">Description: Unified CN execution function of <strong id="EN-US_TOPIC_0000001811515453__b1545017114384">pg_archive_scan_residualfiles()</strong> This function is a cluster-level function and is related to the current database. It runs on CNs.</p>
<p id="EN-US_TOPIC_0000001811515453__p11844195616173">The <strong id="EN-US_TOPIC_0000001811515453__b78556359177">query_flag</strong> parameter is of the int type and indicates the execution range. <strong id="EN-US_TOPIC_0000001811515453__b09999373173">1</strong> indicates the CN, <strong id="EN-US_TOPIC_0000001811515453__b599915376175">2</strong> indicates the primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b399973711172">4</strong> indicates the standby DN. The query union set can be obtained through the OR operation. For example, <strong id="EN-US_TOPIC_0000001811515453__b8999163771710">1|2=3</strong> indicates the CN and primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b8999183714173">1|2|4=7</strong> indicates the CN, primary DN, and standby DN. The default value is <strong id="EN-US_TOPIC_0000001811515453__b1224794010175">7</strong>.</p>
<p id="EN-US_TOPIC_0000001811515453__p4861458175412">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p1621792105513">The command output is as follows.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table158614586545" frame="border" border="1" rules="all"><caption><b>Table 6 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row8871858155419"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.9.6.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p138719587545">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.9.6.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p6875583545">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.91%" id="mcps1.3.9.6.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p198816581541">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row183311514512"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p17677741194514">nodename</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1933213594518">name</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p633217514453">Node name.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row396924450"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p4971021453">instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p697172114513">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p69719224510">Instance name.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row1888858155412"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p1073413241159">archive</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p37341324452">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p95227624612">Path of the local folder after archiving. Residual files in the OBS path are archived in the corresponding OBS database directory.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row16881258145416"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p127349248512">count</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p373462415510">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p073472411515">Number of archived residual files.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row13897582545"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.9.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p17345241352">size</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.9.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p1073410241753">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.9.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p1573510247515">Total size of archived residual files, in bytes.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001811515453__p890185845411">Example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001811515453__screen1267063218560"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span>
<span class="normal">6</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_archive_scan_residualfiles</span><span class="p">();</span>
<span class="w"> </span><span class="n">node_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">instance_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">archive</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">count</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">size</span><span class="w"> </span>
<span class="c1">--------------+-------------+--------------------------------------------------------------+-------+-------</span>
<span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">archive</span><span class="o">/</span><span class="n">pgscrf_archive_20231027145050896440</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">40960</span>
<span class="w"> </span><span class="n">dn_6007_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">pg_residualfiles</span><span class="o">/</span><span class="n">archive</span><span class="o">/</span><span class="n">pgscrf_archive_20231027145051018138</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">24576</span>
<span class="p">(</span><span class="mi">2</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
<div class="note" id="EN-US_TOPIC_0000001811515453__note14378101816171"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001811515453__ul53811545382"><li id="EN-US_TOPIC_0000001811515453__li13380545382">This function can archive only the residual files recorded in the current login database. During archiving, the residual files are verified. The verification results are as follows:<ul id="EN-US_TOPIC_0000001811515453__ul1742312319328"><li id="EN-US_TOPIC_0000001811515453__li64231313324">Verification passed: After the verification is passed, the residual files are archived and marked as handled.</li><li id="EN-US_TOPIC_0000001811515453__li34231334322">Verification failed: If the verification fails, the residual files are not archived and marked as handled.</li><li id="EN-US_TOPIC_0000001811515453__li1242312373219">Verification delayed: If the verification is delayed, it indicates that verification is not possible at the moment, and archiving is skipped. The verification delay is related to the transaction completion status and the standby node's redo progress.</li></ul>
</li><li id="EN-US_TOPIC_0000001811515453__li02083873918">The actual archive directory and the corresponding tablespace are in the same file system. Deleting the tablespace also deletes the archived residual files.</li><li id="EN-US_TOPIC_0000001811515453__li52080883915">This function cannot be used after DDL delay is enabled.</li><li id="EN-US_TOPIC_0000001811515453__li12084833917">This function is a heavy-load operation and cannot be used concurrently on a single node. You should avoid using this function when the service is overloaded or the resource is scarce.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0000001811515453__section1273153945319"><h4 class="sectiontitle">pg_rm_scan_residualfiles_archive()</h4><p id="EN-US_TOPIC_0000001811515453__p146768019557">Description: Deletes all archived residual file records on the current node. This function is an instance-level function and is irrelevant to the current database. It can run on any instance.</p>
<p id="EN-US_TOPIC_0000001811515453__p1467613015556">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p208723234557">The command output is as follows.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table16761209555" frame="border" border="1" rules="all"><caption><b>Table 7 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row1467620165517"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.10.5.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p0676120195519">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.10.5.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p96777065512">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.91%" id="mcps1.3.10.5.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p126777017557">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row136774019552"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.10.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p85482051245">count</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.10.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p75488512410">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.10.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p2054820511841">Number of residual files that have been deleted from the archive. For residual files in the local path, the number of deleted files is counted. For residual files in the OBS path, the number of deleted table directories is counted.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row176771800558"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.10.5.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p115493517415">size</p>
</td>
<td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.10.5.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p654918511642">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.91%" headers="mcps1.3.10.5.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p12549851049">Total size of residual files that have been deleted from the archive, in bytes. For residual files in the OBS path, the value of this parameter is <strong id="EN-US_TOPIC_0000001811515453__b1345899131919">0</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001811515453__p146781504556">Example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001811515453__screen11796153585616"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pg_rm_scan_residualfiles_archive</span><span class="p">();</span>
<span class="w"> </span><span class="k">count</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">size</span><span class="w"> </span>
<span class="c1">-------+-------</span>
<span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">81920</span>
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001811515453__section139751051155312"><h4 class="sectiontitle">pgxc_rm_scan_residualfiles_archive(query_flag)</h4><p id="EN-US_TOPIC_0000001811515453__p10249151584714">Description: Unified CN execution function of <strong id="EN-US_TOPIC_0000001811515453__b15556173314017">pg_rm_scan_residualfiles_archive()</strong> This function is a cluster-level function and is irrelevant to the current database. It runs on CNs.</p>
<p id="EN-US_TOPIC_0000001811515453__p1189251813189">The <strong id="EN-US_TOPIC_0000001811515453__b4345101511912">query_flag</strong> parameter is of the int type and indicates the execution range. <strong id="EN-US_TOPIC_0000001811515453__b3847617161915">1</strong> indicates the CN, <strong id="EN-US_TOPIC_0000001811515453__b6848191720198">2</strong> indicates the primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b28483177198">4</strong> indicates the standby DN. The query union set can be obtained through the OR operation. For example, <strong id="EN-US_TOPIC_0000001811515453__b1884861741914">1|2=3</strong> indicates the CN and primary DN, and <strong id="EN-US_TOPIC_0000001811515453__b284812173193">1|2|4=7</strong> indicates the CN, primary DN, and standby DN. The default value is <strong id="EN-US_TOPIC_0000001811515453__b1271271912197">7</strong>.</p>
<p id="EN-US_TOPIC_0000001811515453__p544612235513">Return type: record</p>
<p id="EN-US_TOPIC_0000001811515453__p138551026125514">The command output is as follows.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001811515453__table16446182135516" frame="border" border="1" rules="all"><caption><b>Table 8 </b>Return fields</caption><thead align="left"><tr id="EN-US_TOPIC_0000001811515453__row124463275514"><th align="left" class="cellrowborder" valign="top" width="19.09%" id="mcps1.3.11.6.2.4.1.1"><p id="EN-US_TOPIC_0000001811515453__p34466265518">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.97%" id="mcps1.3.11.6.2.4.1.2"><p id="EN-US_TOPIC_0000001811515453__p1744716235518">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59.940000000000005%" id="mcps1.3.11.6.2.4.1.3"><p id="EN-US_TOPIC_0000001811515453__p64471627554">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001811515453__row427314175010"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.11.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p145812293511">nodename</p>
</td>
<td class="cellrowborder" valign="top" width="20.97%" headers="mcps1.3.11.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p18407193085113">name</p>
</td>
<td class="cellrowborder" valign="top" width="59.940000000000005%" headers="mcps1.3.11.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p740793018518">Node name.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row136081620205111"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.11.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p1360842013515">instance_id</p>
</td>
<td class="cellrowborder" valign="top" width="20.97%" headers="mcps1.3.11.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p26080204513">text</p>
</td>
<td class="cellrowborder" valign="top" width="59.940000000000005%" headers="mcps1.3.11.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p1960872020513">Instance name.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row9447422552"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.11.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p122011754642">count</p>
</td>
<td class="cellrowborder" valign="top" width="20.97%" headers="mcps1.3.11.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p32011354146">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.940000000000005%" headers="mcps1.3.11.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p102021454941">Number of residual files that have been deleted from the archive. For residual files in the local path, the number of deleted files is counted. For residual files in the OBS path, the number of deleted table directories is counted.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001811515453__row2447172135512"><td class="cellrowborder" valign="top" width="19.09%" headers="mcps1.3.11.6.2.4.1.1 "><p id="EN-US_TOPIC_0000001811515453__p15202125410419">size</p>
</td>
<td class="cellrowborder" valign="top" width="20.97%" headers="mcps1.3.11.6.2.4.1.2 "><p id="EN-US_TOPIC_0000001811515453__p72024541341">bigint</p>
</td>
<td class="cellrowborder" valign="top" width="59.940000000000005%" headers="mcps1.3.11.6.2.4.1.3 "><p id="EN-US_TOPIC_0000001811515453__p92023541347">Total size of residual files that have been deleted from the archive, in bytes. For residual files in the OBS path, the value of this parameter is <strong id="EN-US_TOPIC_0000001811515453__b12534174981917">0</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001811515453__p1044852195513">Example:</p>
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001811515453__screen1467239115611"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span>
<span class="normal">3</span>
<span class="normal">4</span>
<span class="normal">5</span>
<span class="normal">6</span>
<span class="normal">7</span>
<span class="normal">8</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">pgxc_rm_scan_residualfiles_archive</span><span class="p">();</span>
<span class="w"> </span><span class="n">node_name</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">instance_id</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">count</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">size</span><span class="w"> </span>
<span class="c1">--------------+-------------+-------+-------</span>
<span class="w"> </span><span class="n">dn_6001_6002</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">4</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">81920</span>
<span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">cn_5001</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">40960</span>
<span class="w"> </span><span class="n">dn_6007_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">dn_6008</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">24576</span>
<span class="w"> </span><span class="n">coordinator1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">coordinator1</span><span class="o">|</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="mi">0</span><span class="w"> </span>
<span class="p">(</span><span class="mi">4</span><span class="w"> </span><span class="k">rows</span><span class="p">)</span>
</pre></div></td></tr></table></div>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0060.html">Residual File Management Functions</a></div>
</div>
</div>