Re: should frontend tools use syncfs() ?

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Brown <michael(dot)brown(at)discourse(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: should frontend tools use syncfs() ?
Date: 2023-08-22 01:44:07
Message-ID: 20230822014407.GA449131@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 22, 2023 at 08:56:26AM +0900, Michael Paquier wrote:
> --- a/src/include/storage/fd.h
> +++ b/src/include/storage/fd.h
> @@ -43,15 +43,11 @@
> #ifndef FD_H
> #define FD_H
>
> +#ifndef FRONTEND
> +
> #include <dirent.h>
> #include <fcntl.h>
>
> Ugh. So you need this part because pg_rewind's filemap.c includes
> fd.h, and pg_rewind also needs file_utils.h. This is not the fault of
> your patch, but this does not make the situation better, either.. It
> looks like we need to think harder about this layer. An improvement
> would be to split file_utils.c so as its frontend-only code is moved
> to OBJS_FRONTEND in a new file with a new header? It should be OK to
> keep DataDirSyncMethod in file_utils.h as long as the split is clean.

I'm hoping there's a simpler path forward here. pg_rewind only needs the
following lines from fd.h:

/* Filename components */
#define PG_TEMP_FILES_DIR "pgsql_tmp"
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"

Maybe we could move these to file_utils.h instead. WDYT?

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-08-22 01:49:09 Re: [PoC] pg_upgrade: allow to upgrade publisher node
Previous Message Peter Smith 2023-08-22 00:31:25 Re: [PoC] pg_upgrade: allow to upgrade publisher node