forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
41 lines
7.4 KiB
HTML
41 lines
7.4 KiB
HTML
<a name="EN-US_TOPIC_0000001188110580"></a><a name="EN-US_TOPIC_0000001188110580"></a>
|
|
|
|
<h1 class="topictitle1">Snapshot Synchronization Functions</h1>
|
|
<div id="body1553151203303"><p id="EN-US_TOPIC_0000001188110580__a7d75eb8f7d5848c2824158d8ce44a1cd">Snapshot synchronization functions save the current snapshot and return its identifier.</p>
|
|
<div class="section" id="EN-US_TOPIC_0000001188110580__section49431291203"><h4 class="sectiontitle">create_wdr_snapshot()</h4><p id="EN-US_TOPIC_0000001188110580__p985713391710">Description: Creates a performance data snapshot.</p>
|
|
<p id="EN-US_TOPIC_0000001188110580__p148585391215">Return type: text</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110580__note28587393119"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188110580__ul2858193915114"><li id="EN-US_TOPIC_0000001188110580__li14858183917112">Only the database administrator <strong id="EN-US_TOPIC_0000001188110580__b216241208112540">SYSADMIN</strong> can execute this function.</li><li id="EN-US_TOPIC_0000001188110580__li12859103918112">This function can be executed only on CNs. If it is executed on DNs, the following message will be returned: "WDR snapshot can only be created on coordinator."</li><li id="EN-US_TOPIC_0000001188110580__li286083914111">Before executing this function, ensure that the value of <strong id="EN-US_TOPIC_0000001188110580__b2083640158112540">enable_wdr_snapshot</strong> is <strong id="EN-US_TOPIC_0000001188110580__b1597822805112540">on</strong>. If its value is <strong id="EN-US_TOPIC_0000001188110580__b1969720615112540">off</strong>, the following message will be returned for this function: "WDR snapshot request can't be executed, because GUC parameter 'enable_wdr_snapshot' is off."</li><li id="EN-US_TOPIC_0000001188110580__li1886093919115">If the snapshot thread is not started for some reason, for example, the node is restarted, the following message will be returned for this function: "WDR snapshot request can not be accepted, please retry later."</li><li id="EN-US_TOPIC_0000001188110580__li9860839717">If this function fails to be executed, the following message will be returned: "Cannot respond to WDR snapshot request."</li><li id="EN-US_TOPIC_0000001188110580__li168601339911">If this function is successfully executed, the following message will be returned: "WDR snapshot request has been submitted." This message indicates that the snapshot creation request has been sent to the background snapshot thread, but does not mean that the snapshot has been successfully created.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188110580__section195661234182017"><h4 class="sectiontitle">kill_snapshot(scope cstring)</h4><p id="EN-US_TOPIC_0000001188110580__p6861539813">Description: Kills the background snapshot thread. This function sends a command to the background snapshot thread and waits for the thread to stop.</p>
|
|
<p id="EN-US_TOPIC_0000001188110580__p386118391018">The input parameter <strong id="EN-US_TOPIC_0000001188110580__b45919327112540">scope</strong> indicates the operation scope. Its value can be <strong id="EN-US_TOPIC_0000001188110580__b1569043925112540">local</strong> or <strong id="EN-US_TOPIC_0000001188110580__b1057182325112540">global</strong>.</p>
|
|
<ul id="EN-US_TOPIC_0000001188110580__ul1786213391519"><li id="EN-US_TOPIC_0000001188110580__li58629391816">Value <strong id="EN-US_TOPIC_0000001188110580__b2004173112540">local</strong> indicates killing the snapshot thread on the current CN.</li><li id="EN-US_TOPIC_0000001188110580__li78628391914">Value <strong id="EN-US_TOPIC_0000001188110580__b1001896043112540">global</strong> indicates killing the snapshot thread on the current CN as well as those on all the other CNs in the cluster.</li><li id="EN-US_TOPIC_0000001188110580__li19863639511">If any other value is passed, error message "Scope is invalid, use "local" or "global"." is displayed.</li><li id="EN-US_TOPIC_0000001188110580__li286383911110">The input parameter can be left empty, in which case the default value <strong id="EN-US_TOPIC_0000001188110580__b715198630112540">local</strong> will be used.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001188110580__p148636390111">Return type: none</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001188110580__note14863163919112"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001188110580__ul7864163916110"><li id="EN-US_TOPIC_0000001188110580__li88658391018">Only the database administrator <strong id="EN-US_TOPIC_0000001188110580__b718052525112540">SYSADMIN</strong> can execute this function.</li><li id="EN-US_TOPIC_0000001188110580__li1886510391311">This function can be executed only on CNs. If it is executed on DNs, the following message will be returned: "kill_snapshot can only be executed on coordinator."</li><li id="EN-US_TOPIC_0000001188110580__li5865439413">Executing this function sends a kill signal to the background snapshot thread and waits for it to finish. If the snapshot thread is not killed within 100s, the error message "Kill snapshot thread failed" is displayed.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001188110580__section168519493375"><h4 class="sectiontitle">pg_export_snapshot()</h4><p id="EN-US_TOPIC_0000001188110580__p822982617454">Description: Saves the current snapshot and returns its identifier.</p>
|
|
<p id="EN-US_TOPIC_0000001188110580__p19229182614457">Return type: text</p>
|
|
<p id="EN-US_TOPIC_0000001188110580__p92291926174511">Note: <strong id="EN-US_TOPIC_0000001188110580__en-us_topic_0058965547_b84235270610534">pg_export_snapshot</strong> saves the current snapshot and returns a text string identifying the snapshot. This string must be passed to clients that want to import the snapshot. A snapshot can be imported when the <strong id="EN-US_TOPIC_0000001188110580__b842352706161427">set transaction snapshot snapshot_id;</strong> command is executed. Doing so is possible only when the transaction is set to the <strong id="EN-US_TOPIC_0000001188110580__b19360124865215">REPEATABLE READ</strong> isolation level. The output of the function cannot be used as the input of <strong id="EN-US_TOPIC_0000001188110580__b155293701293911">set transaction snapshot</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001188110580__p174710446554">Example:</p>
|
|
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001188110580__screen29851159105515"><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="n">pg_export_snapshot</span><span class="p">();</span>
|
|
<span class="w"> </span><span class="n">pg_export_snapshot</span>
|
|
<span class="c1">--------------------</span>
|
|
<span class="w"> </span><span class="mi">00000000000</span><span class="n">A7128</span><span class="o">-</span><span class="mi">1</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>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0052.html">System Administration Functions</a></div>
|
|
</div>
|
|
</div>
|
|
|