From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: walmethods.c/h: Make WalWriteMethod more object-oriented.
Date: Mon, 19 Sep 2022 16:59:47 +0000
Message-ID: <E1oaK7W-0014Qm-NJ@gemulon.postgresql.org> (raw)
walmethods.c/h: Make WalWriteMethod more object-oriented.
Normally when we use object-oriented programming techniques, we
provide a pointer to an object and then some way of looking up the
associated table of callbacks, but walmethods.c/h took the alternative
approach of providing only a pointer to the table of callbacks and
thus imposed the artificial restriction that there could only ever be
one object of each type, so that the callbacks could find it via a
global variable. That doesn't seem like the right idea, so revise the
approach.
Each callback which does not already have an argument of type
Walfile * now takes a pointer to the relevant WalWriteMethod *
so that these callbacks need not rely on there being only one
object of each type.
Freeing a WalWriteMethod is now performed via a callback provided
for that purpose rather than requiring the caller to know which
WAL method they want to free.
Discussion: http://postgr.es/m/CA+TgmoZS0Kw98fOoAcGz8B9iDhdqB4Be4e=vDZaJZ5A-xMYBqA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/ebfb814f7ce0d5ab6f47f0b86db51a1b8f3342f4
Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 8 +-
src/bin/pg_basebackup/pg_receivewal.c | 6 +-
src/bin/pg_basebackup/receivelog.c | 89 +++---
src/bin/pg_basebackup/walmethods.c | 510 ++++++++++++++++++----------------
src/bin/pg_basebackup/walmethods.h | 60 ++--
5 files changed, 357 insertions(+), 316 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: rhaas@postgresql.org
Subject: Re: pgsql: walmethods.c/h: Make WalWriteMethod more object-oriented.
In-Reply-To: <E1oaK7W-0014Qm-NJ@gemulon.postgresql.org>
References: <E1oaK7W-0014Qm-NJ@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