Re: [Proposal] Adding Log File Capability to pg_createsubscriber

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Proposal] Adding Log File Capability to pg_createsubscriber
Date: 2026-04-01 04:56:53
Message-ID: CAA4eK1+f3d=mkbCKrJPP8dH_Rs5COvKZZg5DaSh-1XS_Nzwv3Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 31, 2026 at 5:36 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 25.03.26 09:25, Amit Kapila wrote:
> > On Wed, Mar 25, 2026 at 5:43 AM Gyan Sreejith <gyan(dot)sreejith(at)gmail(dot)com> wrote:
> >>
> >> Thank you, Kuroda-san and Chao for the suggestions and the patch. I have merged it with v18-0001, and I have fixed everything that Peter suggested.
> >>
> >
> > Pushed after minor changes.
>
> Instead of creating a new logging API in pg_createsubscriber locally,
> why not extend logging.c to support a log file.
>

Few things we may want to consider if we want to use extended
logging.c: (a) what if we want information to be written in multiple
files (say pub/sub specific info into separate files), something like
what pg_upgrade does, (b) what if we want to write some info to only
one of terminal or log_file, we can probably extend generic API for
this.

> This is much simpler,
> doesn't require caller changes, and could be reused elsewhere. See
> attached patches. (The 0003 and 0004 are just some additional code
> simplifications.)
>

In 0004,
-static char logdir[MAXPGPATH]; /* Subdirectory of the user specified logdir
+static char *logdir = NULL; /* Subdirectory of the user specified logdir

At other places like pg_upgrade, we use MAXPGPATH for a similar case
probably to have standard length on all platforms, see
make_outputdirs() in pg_upgrade.c.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2026-04-01 04:59:54 DOC: pg_publication_rel.prrelid says sequences are possible
Previous Message Suraj Kharage 2026-04-01 04:28:20 Re: [PATCH] Add support for INSERT ... SET syntax