Re: define PG_REPLSLOT_DIR

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: define PG_REPLSLOT_DIR
Date: 2024-08-20 12:30:48
Message-ID: 20240820213048.207aade6a75e0dc1fe4d1067@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 20 Aug 2024 17:47:57 +0900
Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Mon, Aug 19, 2024 at 02:11:55PM +0000, Bertrand Drouvot wrote:
> > I made the changes for pg_tblspc in pg_combinebackup.c as the number of occurences
> > are greater that the "pg_wal" ones and we were to define PG_TBLSPC_DIR in any
> > case.
> >
> > Please find attached the related patches.
>
> No real objection about the replslot and pg_logical bits.
>
> - * $PGDATA/pg_tblspc/spcoid/PG_MAJORVER_CATVER/dboid/relfilenumber
> + * $PGDATA/PG_TBLSPC_DIR/spcoid/PG_MAJORVER_CATVER/dboid/relfilenumber
>
> For the tablespace parts, I am not sure that I would update the
> comments to reflect the variables, TBH. Somebody reading the comments
> would need to refer back to pg_tblspc/ in the header.

I also think that it is not necessary to change the comments even for pg_replslot.

- * Each replication slot gets its own directory inside the $PGDATA/pg_replslot
+ * Each replication slot gets its own directory inside the $PGDATA/PG_REPLSLOT_DIR

For example, I found that comments in xlog.c use "pg_wal" even though XLOGDIR is used
in the codes as below, and I don't feel any problem for this.

> static void
> ValidateXLOGDirectoryStructure(void)
> {
> char path[MAXPGPATH];
> struct stat stat_buf;
>
> /* Check for pg_wal; if it doesn't exist, error out */
> if (stat(XLOGDIR, &stat_buf) != 0 ||
> !S_ISDIR(stat_buf.st_mode))

Should be the follwing also rewritten using sizeof(PG_REPLSLOT_DIR)?

struct stat statbuf;
char path[MAXPGPATH * 2 + 12];

Regards,
Yugo Nagata

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2024-08-20 12:48:29 Re: Track the amount of time waiting due to cost_delay
Previous Message Masahiko Sawada 2024-08-20 12:24:24 Re: Fix memory counter update in reorderbuffer