Thread: pgsql: Move the server's backup manifest code to a separate file.

pgsql: Move the server's backup manifest code to a separate file.

From
Robert Haas
Date:
Move the server's backup manifest code to a separate file.

basebackup.c is already a pretty big and complicated file, so it
makes more sense to keep the backup manifest support routines
in a separate file, for clarity and ease of maintenance.

Discussion: http://postgr.es/m/CA+TgmoavRak5OdP76P8eJExDYhPEKWjMb0sxW7dF01dWFgE=uA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/079ac29d4dafe581748ceca523aa90c8ce8b035b

Modified Files
--------------
src/backend/replication/Makefile          |   1 +
src/backend/replication/backup_manifest.c | 375 ++++++++++++++++++++++++++++
src/backend/replication/basebackup.c      | 391 +-----------------------------
src/include/replication/backup_manifest.h |  51 ++++
4 files changed, 429 insertions(+), 389 deletions(-)


Re: pgsql: Move the server's backup manifest code to a separate file.

From
Tom Lane
Date:
Robert Haas <rhaas@postgresql.org> writes:
> Move the server's backup manifest code to a separate file.

This broke the build for me (with gcc 4.4.7):

In file included from basebackup.c:34:
../../../src/include/replication/backup_manifest.h:36: error: redefinition of typedef 'manifest_info'
../../../src/include/replication/basebackup.h:34: note: previous declaration of 'manifest_info' was here
make[3]: *** [basebackup.o] Error 1

Not really sure why the buildfarm isn't showing the same.
But this in basebackup.h sure looks like an antipattern:

struct manifest_info;
typedef struct manifest_info manifest_info;

The usual thing, if you don't want to actually include the typedef,
is more like

struct manifest_info;
...
extern int64 sendTablespace(char *path, char *oid, bool sizeonly,
                            struct manifest_info *manifest);

Also a comment along the lines of "avoid including foo.h"
is standard practice.

            regards, tom lane