Remove Start* macros from postmaster.c to ease understanding of code

From: reid(dot)thompson(at)crunchydata(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: Remove Start* macros from postmaster.c to ease understanding of code
Date: 2024-02-06 16:58:50
Message-ID: e88934c02a5c66f5e8caab2025f85da6b9026d0b.camel@crunchydata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Attached is a small patch implemented as I agree with Andres' comment
below noted while reviewing the thread
https://www.postgresql.org/message-id/flat/20240122210740.7vq5fd4woixpwx3f%40awork3.anarazel.de#6eb7595873392621d60e6b5a723941bc

I agree that its easier to not have to refer back to the macros only to
see that they're all invoking StartChildProcess(X). All invocations are
within postmaster.c.

> @@ -561,13 +561,13 @@ static void ShmemBackendArrayAdd(Backend *bn);
> static void ShmemBackendArrayRemove(Backend *bn);
> #endif /* EXEC_BACKEND */
>
> -#define StartupDataBase() StartChildProcess(StartupProcess)
> -#define StartArchiver() StartChildProcess(ArchiverProcess)
> -#define StartBackgroundWriter() StartChildProcess(BgWriterProcess)
> -#define StartCheckpointer() StartChildProcess(CheckpointerProcess)
> -#define StartWalWriter() StartChildProcess(WalWriterProcess)
> -#define StartWalReceiver() StartChildProcess(WalReceiverProcess)
> -#define StartWalSummarizer() StartChildProcess(WalSummarizerProcess)
> +#define StartupDataBase() StartChildProcess(B_STARTUP)
> +#define StartArchiver() StartChildProcess(B_ARCHIVER)
> +#define StartBackgroundWriter() StartChildProcess(B_BG_WRITER)
> +#define StartCheckpointer() StartChildProcess(B_CHECKPOINTER)
> +#define StartWalWriter() StartChildProcess(B_WAL_WRITER)
> +#define StartWalReceiver() StartChildProcess(B_WAL_RECEIVER)
> +#define StartWalSummarizer() StartChildProcess(B_WAL_SUMMARIZER)

Not for this commit, but we ought to rip out these macros - all they do is to make it harder to understand the code.

Attachment Content-Type Size
0001-Remove-Start-macros-in-postmaster.c-to-ease-understa.patch text/x-patch 6.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-02-06 17:10:18 Re: Remove Start* macros from postmaster.c to ease understanding of code
Previous Message Nathan Bossart 2024-02-06 16:55:57 Re: Reducing connection overhead in pg_upgrade compat check phase