pgsql: walmethods.c/h: Make WalWriteMethod more object-oriented. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: walmethods.c/h: Make WalWriteMethod more object-oriented.
Date
Msg-id E1oaK7W-0014Qm-NJ@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Future-proof the recursion inside ExecShutdownNode().
Next
From: Robert Haas
Date:
Subject: pgsql: Make ALTER DEFAULT PRIVILEGES require privileges, not membership