Re: should frontend tools use syncfs() ? - Mailing list pgsql-hackers

From Maxim Orlov
Subject Re: should frontend tools use syncfs() ?
Date
Msg-id CACG=ezbL1gwE7_K7sr9uqaCGkWhmvRTcTEnm3+X1xsRNwbXULQ@mail.gmail.com
Whole thread Raw
In response to Re: should frontend tools use syncfs() ?  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: should frontend tools use syncfs() ?
List pgsql-hackers
On Thu, 7 Sept 2023 at 03:34, Nathan Bossart <nathandbossart@gmail.com> wrote:
Committed.

Hi! Great job!

But here is one problem I've encountered during working on some unrelated stuff.
How we have two different things call the same name – sync_method. One in xlog:
int            sync_method = DEFAULT_SYNC_METHOD;
...and another one in "bins":
static DataDirSyncMethod sync_method = DATA_DIR_SYNC_METHOD_FSYNC;

In current include order, this is not a problem, but imagine you add a couple of new includes,
for example:
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -18,6 +18,8 @@
 #include "storage/block.h"
 #include "storage/item.h"
 #include "storage/off.h"
+#include "postgres.h"
+#include "utils/rel.h"

And build will be broken, because we how have two different things called "sync_method" with
different types:
In file included from .../src/bin/pg_rewind/pg_rewind.c:33:
In file included from .../src/include/storage/bufpage.h:22:
In file included from .../src/include/utils/rel.h:18:
.../src/include/access/xlog.h:27:24: error: redeclaration of 'sync_method' with a different type: 'int' vs 'DataDirSyncMethod' (aka 'enum DataDirSyncMethod')
extern PGDLLIMPORT int sync_method;
...

As a solution, I suggest renaming sync_method in xlog module to wal_sync_method. In fact,
appropriate GUC for this variable, called "wal_sync_method" and I see no reason not to use
the exact same name for a variable in xlog module.

--
Best regards,
Maxim Orlov.
Attachment

pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Infinite Interval
Next
From: Dean Rasheed
Date:
Subject: Re: Infinite Interval