Re: [Proposal] Adding Log File Capability to pg_createsubscriber

From: Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Smith <smithpb2250(at)gmail(dot)com>
Subject: Re: [Proposal] Adding Log File Capability to pg_createsubscriber
Date: 2026-01-20 00:58:31
Message-ID: CAEqnbaUa27R9OcVDHkNuwsZ1uCpy8sTXpH78N1ug0kj60mnchw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you for all your input. I have attached the latest version of the
patch that includes the changes proposed by Vignesh and Amit. Please let me
know if you have any questions or suggestions.

Thank you,
Gyan Sreejith

On Mon, Jan 12, 2026 at 11:11 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:

> On Mon, 29 Dec 2025 at 16:40, vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > On Wed, 24 Dec 2025 at 04:52, Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com>
> wrote:
> > >
> > > Thank you for the feedback everybody. As I read through this email
> chain, I found differing opinions on how logging should be implemented.
> This ambiguity leaves me unsure as to which solution(s) to pursue. As of
> right now, I have attached the git-format patch like Hayato Kuroda
> recommended (but it does not have any new changes). I am willing to
> implement whatever solution when we reach a consensus.
> >
> > Few comments:
> > 1) The file permissions are 664 for pg_createsubscriber_internal.log,
> > pg_createsubscriber_resetwal.log but 600 for
> > pg_createsubscriber_server.log. The permissions should be the same for
> > all the files.
> > ...
> > if (opt->log_dir != NULL)
> > out_file = psprintf("%s/pg_createsubscriber_resetwal.log", opt->log_dir);
> > else
> > out_file = DEVNULL;
> >
> > cmd_str = psprintf("\"%s\" -D \"%s\" > \"%s\"", pg_resetwal_path,
> > subscriber_dir, out_file);
> >
> > pg_log_debug("pg_resetwal command is: %s", cmd_str);
> > ...
> >
> > ...
> > if (opt->log_dir != NULL)
> > {
> > appendPQExpBuffer(pg_ctl_cmd, " -l %s/pg_createsubscriber_server.log",
> > opt->log_dir);
> > }
> >
> > pg_log_debug("pg_ctl command is: %s", pg_ctl_cmd->data);
> > rc = system(pg_ctl_cmd->data);
> > ...
>
> For this, you can align the file handling and umask behavior with the
> logic used in syslogger.c (logfile_open). Doing so will ensure that
> the resulting log files are created with consistent permissions across
> all cases. Additionally you can include "The umask is set to 077, so
> access to the log file is disallowed to other users by default" in the
> documentation of the pg_createsubscriber log option similar to how it
> is mentioned in [1].
> [1] - https://www.postgresql.org/docs/current/app-pg-ctl.html
>
> Regards,
> Vignesh
>

Attachment Content-Type Size
v2-0001-Add-a-new-argument-l-logdir_prefix-to-pg_createsu.patch application/x-patch 32.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-01-20 01:28:31 Re: Implement waiting for wal lsn replay: reloaded
Previous Message Henson Choi 2026-01-20 00:47:25 Re: Row pattern recognition