codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>20.14. Error Handling</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="runtime-config-compatible.html" title="20.13. Version and Platform Compatibility" /><link rel="next" href="runtime-config-preset.html" title="20.15. Preset Options" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">20.14. Error Handling</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="runtime-config-compatible.html" title="20.13. Version and Platform Compatibility">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="runtime-config.html" title="Chapter 20. Server Configuration">Up</a></td><th width="60%" align="center">Chapter 20. Server Configuration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="runtime-config-preset.html" title="20.15. Preset Options">Next</a></td></tr></table><hr /></div><div class="sect1" id="RUNTIME-CONFIG-ERROR-HANDLING"><div class="titlepage"><div><div><h2 class="title" style="clear: both">20.14. Error Handling <a href="#RUNTIME-CONFIG-ERROR-HANDLING" class="id_link">#</a></h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt id="GUC-EXIT-ON-ERROR"><span class="term"><code class="varname">exit_on_error</code> (<code class="type">boolean</code>)3 <a id="id-1.6.7.17.2.1.1.3" class="indexterm"></a>4 </span> <a href="#GUC-EXIT-ON-ERROR" class="id_link">#</a></dt><dd><p>5 If on, any error will terminate the current session. By default,6 this is set to off, so that only FATAL errors will terminate the7 session.8 </p></dd><dt id="GUC-RESTART-AFTER-CRASH"><span class="term"><code class="varname">restart_after_crash</code> (<code class="type">boolean</code>)9 <a id="id-1.6.7.17.2.2.1.3" class="indexterm"></a>10 </span> <a href="#GUC-RESTART-AFTER-CRASH" class="id_link">#</a></dt><dd><p>11 When set to on, which is the default, <span class="productname">PostgreSQL</span>12 will automatically reinitialize after a backend crash. Leaving this13 value set to on is normally the best way to maximize the availability14 of the database. However, in some circumstances, such as when15 <span class="productname">PostgreSQL</span> is being invoked by clusterware, it may be16 useful to disable the restart so that the clusterware can gain17 control and take any actions it deems appropriate.18 </p><p>19 This parameter can only be set in the <code class="filename">postgresql.conf</code>20 file or on the server command line.21 </p></dd><dt id="GUC-DATA-SYNC-RETRY"><span class="term"><code class="varname">data_sync_retry</code> (<code class="type">boolean</code>)22 <a id="id-1.6.7.17.2.3.1.3" class="indexterm"></a>23 </span> <a href="#GUC-DATA-SYNC-RETRY" class="id_link">#</a></dt><dd><p>24 When set to off, which is the default, <span class="productname">PostgreSQL</span>25 will raise a PANIC-level error on failure to flush modified data files26 to the file system. This causes the database server to crash. This27 parameter can only be set at server start.28 </p><p>29 On some operating systems, the status of data in the kernel's page30 cache is unknown after a write-back failure. In some cases it might31 have been entirely forgotten, making it unsafe to retry; the second32 attempt may be reported as successful, when in fact the data has been33 lost. In these circumstances, the only way to avoid data loss is to34 recover from the WAL after any failure is reported, preferably35 after investigating the root cause of the failure and replacing any36 faulty hardware.37 </p><p>38 If set to on, <span class="productname">PostgreSQL</span> will instead39 report an error but continue to run so that the data flushing40 operation can be retried in a later checkpoint. Only set it to on41 after investigating the operating system's treatment of buffered data42 in case of write-back failure.43 </p></dd><dt id="GUC-RECOVERY-INIT-SYNC-METHOD"><span class="term"><code class="varname">recovery_init_sync_method</code> (<code class="type">enum</code>)44 <a id="id-1.6.7.17.2.4.1.3" class="indexterm"></a>45 </span> <a href="#GUC-RECOVERY-INIT-SYNC-METHOD" class="id_link">#</a></dt><dd><p>46 When set to <code class="literal">fsync</code>, which is the default,47 <span class="productname">PostgreSQL</span> will recursively open and48 synchronize all files in the data directory before crash recovery49 begins. The search for files will follow symbolic links for the WAL50 directory and each configured tablespace (but not any other symbolic51 links). This is intended to make sure that all WAL and data files are52 durably stored on disk before replaying changes. This applies whenever53 starting a database cluster that did not shut down cleanly, including54 copies created with <span class="application">pg_basebackup</span>.55 </p><p>56 On Linux, <code class="literal">syncfs</code> may be used instead, to ask the57 operating system to synchronize the whole file systems that contain the58 data directory, the WAL files and each tablespace (but not any other59 file systems that may be reachable through symbolic links). This may60 be a lot faster than the <code class="literal">fsync</code> setting, because it61 doesn't need to open each file one by one. On the other hand, it may62 be slower if a file system is shared by other applications that63 modify a lot of files, since those files will also be written to disk.64 Furthermore, on versions of Linux before 5.8, I/O errors encountered65 while writing data to disk may not be reported to66 <span class="productname">PostgreSQL</span>, and relevant error messages may67 appear only in kernel logs.68 </p><p>69 This parameter can only be set in the70 <code class="filename">postgresql.conf</code> file or on the server command line.71 </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="runtime-config-compatible.html" title="20.13. Version and Platform Compatibility">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="runtime-config.html" title="Chapter 20. Server Configuration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="runtime-config-preset.html" title="20.15. Preset Options">Next</a></td></tr><tr><td width="40%" align="left" valign="top">20.13. Version and Platform Compatibility </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 20.15. Preset Options</td></tr></table></div></body></html>