Re: define PG_REPLSLOT_DIR - Mailing list pgsql-hackers

From Yugo Nagata
Subject Re: define PG_REPLSLOT_DIR
Date
Msg-id 20240820213048.207aade6a75e0dc1fe4d1067@sraoss.co.jp
Whole thread Raw
In response to define PG_REPLSLOT_DIR  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: define PG_REPLSLOT_DIR
List pgsql-hackers
On Tue, 20 Aug 2024 17:47:57 +0900
Michael Paquier <michael@paquier.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@sraoss.co.jp>



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: CREATE SUBSCRIPTION - add missing test case
Next
From: Bertrand Drouvot
Date:
Subject: Re: Restart pg_usleep when interrupted