From 702cbe2280fb909daac732b76eb7ea34909d8a89 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Tue, 12 Oct 2021 06:29:08 +0000
Subject: [PATCH v2] Reword docs of GUCs restart_after_crash  and
 remove_temp_files_after_crash

Let us be specific about the type of different postgres processes
that make GUCs restart_after_crash and remove_temp_files_after_crash
effective. Currently, these GUCs specify that only after a backend
crashes these GUCs will kick-in, but it is not only after a backend
crash, but also after an auxiliary process(except startup, sys logger
and stats collector) or a background worker crash too. With the recent
definitions added in the glossary by the commit d3014fff for auxiliary
processes, be more descriptive and clear about the GUCs docs.
---
 doc/src/sgml/config.sgml     | 28 ++++++++++++++++++++--------
 src/backend/utils/misc/guc.c |  6 ++++--
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 0a8e35c59f..2751b5f71b 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -9924,9 +9924,14 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       <listitem>
        <para>
         When set to on, which is the default, <productname>PostgreSQL</productname>
-        will automatically reinitialize after a backend crash.  Leaving this
-        value set to on is normally the best way to maximize the availability
-        of the database.  However, in some circumstances, such as when
+        will automatically reinitialize after a <glossterm linkend="glossary-backend">backend</glossterm>
+        or an <glossterm linkend="glossary-auxiliary-proc">auxiliary process</glossterm>
+        (except the <glossterm linkend="glossary-startup-process">startup process</glossterm>,
+        <glossterm linkend="glossary-logger">logger</glossterm> and the
+        <glossterm linkend="glossary-stats-collector">statistics collector</glossterm>)
+        or a <glossterm linkend="glossary-background-worker">background worker</glossterm>
+        crash.  Leaving this value set to on is normally the best way to maximize the
+        availability of the database.  However, in some circumstances, such as when
         <productname>PostgreSQL</productname> is being invoked by clusterware, it may be
         useful to disable the restart so that the clusterware can gain
         control and take any actions it deems appropriate.
@@ -11012,11 +11017,18 @@ LOG:  CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
        <para>
         When set to <literal>on</literal>, which is the default,
         <productname>PostgreSQL</productname> will automatically remove
-        temporary files after a backend crash. If disabled, the files will be
-        retained and may be used for debugging, for example. Repeated crashes
-        may however result in accumulation of useless files. This parameter
-        can only be set in the <filename>postgresql.conf</filename> file or on
-        the server command line.
+        temporary files after a <glossterm linkend="glossary-backend">backend</glossterm>
+        or an <glossterm linkend="glossary-auxiliary-proc">auxiliary process</glossterm>
+        (except the <glossterm linkend="glossary-startup-process">startup process</glossterm>,
+        <glossterm linkend="glossary-logger">logger</glossterm> and
+        the <glossterm linkend="glossary-stats-collector">statistics collector</glossterm>)
+        or a <glossterm linkend="glossary-background-worker">background worker</glossterm>
+        crash. If disabled, the files will be retained and may be used for
+        debugging, for example. Repeated crashes may however result in
+        accumulation of useless files. This parameter can only be set in the
+        <filename>postgresql.conf</filename> file or on the server command line
+        and it will be effective only when <xref linkend="guc-restart-after-crash"/>
+        is set to <literal>on</literal>.
        </para>
       </listitem>
      </varlistentry>
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index d2ce4a8450..887b7b5379 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1404,7 +1404,8 @@ static struct config_bool ConfigureNamesBool[] =
 	},
 	{
 		{"restart_after_crash", PGC_SIGHUP, ERROR_HANDLING_OPTIONS,
-			gettext_noop("Reinitialize server after backend crash."),
+			gettext_noop("Reinitialize server after backend or auxiliary process (except "
+						 "startup, syslogger and stats collector) or background worker crash."),
 			NULL
 		},
 		&restart_after_crash,
@@ -1413,7 +1414,8 @@ static struct config_bool ConfigureNamesBool[] =
 	},
 	{
 		{"remove_temp_files_after_crash", PGC_SIGHUP, DEVELOPER_OPTIONS,
-			gettext_noop("Remove temporary files after backend crash."),
+			gettext_noop("Remove temporary files after backend or auxiliary process (except "
+						 "startup, syslogger and stats collector) or background worker crash."),
 			NULL,
 			GUC_NOT_IN_SAMPLE
 		},
-- 
2.25.1

