From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor more code logic to update the control file
Date: Mon, 18 Mar 2019 04:01:55 +0000
Message-ID: <E1h5jTH-0003SV-1o@gemulon.postgresql.org> (raw)
Refactor more code logic to update the control file
ce6afc6 has begun the refactoring work by plugging pg_rewind into a
central routine to update the control file, and left around two extra
copies, with one in xlog.c for the backend and one in pg_resetwal.c. By
adding an extra option to the central routine in controldata_utils.c to
control if a flush of the control file needs to be done, it is proving
to be straight-forward to make xlog.c and pg_resetwal.c use the central
code path at the condition of moving the wait event tracking there.
Hence, this allows to have only one central code path to update the
control file, shaving the code from the duplicates.
This refactoring actually fixes a problem in pg_resetwal. Previously,
the control file was first removed before being recreated. So if a
crash happened between the moment the file was removed and the moment
the file was created, then it would have been possible to not have a
control file anymore in the database folder.
Author: Fabien Coelho
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/alpine.DEB.2.21.1903170935210.2506@lancre
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8b938d36f7446e76436ca4a8ddcebbebaeaab480
Modified Files
--------------
src/backend/access/transam/xlog.c | 48 ++++---------------------
src/bin/pg_resetwal/pg_resetwal.c | 64 ++--------------------------------
src/bin/pg_rewind/pg_rewind.c | 2 +-
src/common/controldata_utils.c | 51 ++++++++++++++++++++++-----
src/include/common/controldata_utils.h | 6 ++--
5 files changed, 55 insertions(+), 116 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz
Subject: Re: pgsql: Refactor more code logic to update the control file
In-Reply-To: <E1h5jTH-0003SV-1o@gemulon.postgresql.org>
References: <E1h5jTH-0003SV-1o@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox