On Fri, Jun 11, 2021, at 9:43 PM, Justin Pryzby wrote: > On Sat, Oct 31, 2020 at 09:01:15PM -0300, Euler Taveira wrote: > > > > The current behavior is only useful for debugging purposes. > > On Wed, 28 Oct 2020 at 15:42, Tomas Vondra <tomas.von...@2ndquadrant.com> > wrote: > > > One thing I'm not sure about is whether we should have the GUC as > > > proposed, or have a negative "keep_temp_files_after_restart" defaulting > > > to false. But I don't have a very good justification for the alternative > > > other than vague personal preference. > > On Sat, Oct 31, 2020 at 09:01:15PM -0300, Euler Taveira wrote: > > I thought about not providing a GUC at all or provide it in the developer > > section. I've never heard someone saying that they use those temporary > > files to investigate an issue. Regarding a crash, all information is already > > available and temporary files don't provide extra details. This new GUC is > > just to keep the > > previous behavior. I'm fine without the GUC, though. > > Should this GUC be classified as a developer option, and removed from > postgresql.sample.conf ? It probably should.
> That was discussed initially in October but not since. Was it? I seem to have missed this suggestion. I'm attaching a patch to fix it. -- Euler Taveira EDB https://www.enterprisedb.com/
From fbfd63fcb0d75045b56576cb220e7caea6af9e92 Mon Sep 17 00:00:00 2001 From: Euler Taveira <euler.tave...@enterprisedb.com> Date: Tue, 22 Jun 2021 14:39:56 -0300 Subject: [PATCH v1] Move new GUC remove_temp_files_after_crash to another section The appropriate section for GUC remove_temp_files_after_crash is probably Developer Options since the main goal of the feature is to allow inspecting temporary files for debugging purposes. It was an oversight in commit cd91de0d. Per report from Justin Pryzby. --- doc/src/sgml/config.sgml | 41 +++++++++---------- src/backend/utils/misc/guc.c | 2 +- src/backend/utils/misc/postgresql.conf.sample | 2 - 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index eeba2caa43..f5a753e589 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -9863,28 +9863,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' </listitem> </varlistentry> - <varlistentry id="guc-remove-temp-files-after-crash" xreflabel="remove_temp_files_after_crash"> - <term><varname>remove_temp_files_after_crash</varname> (<type>boolean</type>) - <indexterm> - <primary><varname>remove_temp_files_after_crash</varname> configuration parameter</primary> - </indexterm> - </term> - <listitem> - <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. - </para> - - <para> - This parameter can only be set in the <filename>postgresql.conf</filename> - file or on the server command line. - </para> - </listitem> - </varlistentry> - <varlistentry id="guc-data-sync-retry" xreflabel="data_sync_retry"> <term><varname>data_sync_retry</varname> (<type>boolean</type>) <indexterm> @@ -10912,6 +10890,25 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1) </listitem> </varlistentry> + <varlistentry id="guc-remove-temp-files-after-crash" xreflabel="remove_temp_files_after_crash"> + <term><varname>remove_temp_files_after_crash</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>remove_temp_files_after_crash</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <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. + </para> + </listitem> + </varlistentry> + </variablelist> </sect1> <sect1 id="runtime-config-short"> diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 68b62d523d..d8b8f4a572 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -1404,7 +1404,7 @@ static struct config_bool ConfigureNamesBool[] = NULL, NULL, NULL }, { - {"remove_temp_files_after_crash", PGC_SIGHUP, ERROR_HANDLING_OPTIONS, + {"remove_temp_files_after_crash", PGC_SIGHUP, DEVELOPER_OPTIONS, gettext_noop("Remove temporary files after backend crash."), NULL }, diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index ddbb6dc2be..a5a7174b0e 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -768,8 +768,6 @@ #exit_on_error = off # terminate session on any error? #restart_after_crash = on # reinitialize after backend crash? -#remove_temp_files_after_crash = on # remove temporary files after - # backend crash? #data_sync_retry = off # retry or panic on failure to fsync # data? # (change requires restart) -- 2.20.1