Re: ALTER SYSTEM SET typos and fix for temporary file name management

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER SYSTEM SET typos and fix for temporary file name management
Date: 2014-01-21 12:47:31
Message-ID: CAB7nPqTxeENk+dz_16PBnEZOaDKKrAiR1Pb_WY4EtPYy--JjGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 20, 2014 at 2:12 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Sat, Jan 18, 2014 at 7:59 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> Hi all,
>>
>> After going through commit 65d6e4c (introducing ALTER SYSTEM SET), I
>> noticed a couple of typo mistakes as well as (I think) a weird way of
>> using the temporary auto-configuration name postgresql.auto.conf.temp
>> in two different places, resulting in the patch attached.
>
> .tmp suffix is used at couple other places in code as well.
> snapmgr.c
> XactExportFilePath(pathtmp, topXid, list_length(exportedSnapshots), ".tmp");
> receivelog.c
> snprintf(tmppath, MAXPGPATH, "%s.tmp", path);
>
> Although similar suffix is used at other places, but still I think it might be
> better to define for current case as here prefix (postgresql.auto.conf) is also
> fixed and chances of getting it changed are less. However even if we don't
> do, it might be okay as we are using such suffixes at other places as well.
In the case of snapmgr.c and receivelog.c, the operations are kept
local, so it does not matter much if this way of naming is done as all
the operations for a temporary file are kept within the same, isolated
function. However, the case of postgresql.auto.conf.temp is different:
this temporary file name is used as well for a check in basebackup.c,
so I imagine that it would be better to centralize this information in
a single place. Now this name is only used in two places, but who
knows if some additional checks here are there won't be needed for
this temp file...
postgresql.auto.conf.temp is also located at the root of PGDATA, so it
might be surprising for the user to find it even if there are few
chances that it can happen.

>> It might be an overkill to use a dedicated variable for the temporary
>> autoconfiguration file (here PG_AUTOCONF_FILENAME_TEMP), but I found
>> kind of weird the way things are currently done on master branch. IMO,
>> it would reduce bug possibilities to have everything managed with a
>> single variable.
>>
>> Typos at least should be fixed :)
>
> - appendStringInfoString(&buf, "# Do not edit this file manually! \n");
> - appendStringInfoString(&buf, "# It will be overwritten by ALTER
> SYSTEM command. \n");
> + appendStringInfoString(&buf, "# Do not edit this file manually!\n");
> + appendStringInfoString(&buf, "# It will be overwritten by ALTER
> SYSTEM command.\n");
>
> Same change in initdb.c is missing.
Thanks, I missed it.
--
Michael

Attachment Content-Type Size
20140121_alter_system_fix_v2.patch text/x-diff 5.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-01-21 13:12:25 Re: REINDEX CONCURRENTLY 2.0
Previous Message Alexander Korotkov 2014-01-21 12:28:48 Re: GIN improvements part 1: additional information