postgresql/src/include/backup/basebackup.h
Robert Haas 5b36e8f078 Change struct tablespaceinfo's oid member from 'char *' to 'Oid'
This shouldn't change behavior except in the unusual case where
there are file in the tablespace directory that have entirely
numeric names but are nevertheless not possible names for a
tablespace directory, either because their names have leading zeroes
that shouldn't be there, or the value is actually zero, or because
the value is too large to represent as an OID.

In those cases, the directory would previously have made it into
the list of tablespaceinfo objects and no longer will. Thus, base
backups will now ignore such directories, instead of treating them
as legitimate tablespace directories. Similarly, if entries for
such tablespaces occur in a tablespace_map file, they will now
be rejected as erroneous, instead of being honored.

This is infrastructure for future work that wants to be able to
know the tablespace of each relation that is part of a backup
*as an OID*. By strengthening the up-front validation, we don't
have to worry about weird cases later, and can more easily avoid
repeated string->integer conversions.

Patch by me, reviewed by David Steele.

Discussion: http://postgr.es/m/CA+TgmoZNVeBzoqDL8xvr-nkaepq815jtDR4nJzPew7=3iEuM1g@mail.gmail.com
2023-10-23 15:17:26 -04:00

39 lines
1 KiB
C

/*-------------------------------------------------------------------------
*
* basebackup.h
* Exports from replication/basebackup.c.
*
* Portions Copyright (c) 2010-2023, PostgreSQL Global Development Group
*
* src/include/backup/basebackup.h
*
*-------------------------------------------------------------------------
*/
#ifndef _BASEBACKUP_H
#define _BASEBACKUP_H
#include "nodes/replnodes.h"
/*
* Minimum and maximum values of MAX_RATE option in BASE_BACKUP command.
*/
#define MAX_RATE_LOWER 32
#define MAX_RATE_UPPER 1048576
/*
* Information about a tablespace
*
* In some usages, "path" can be NULL to denote the PGDATA directory itself.
*/
typedef struct
{
Oid oid; /* tablespace's OID */
char *path; /* full path to tablespace's directory */
char *rpath; /* relative path if it's within PGDATA, else
* NULL */
int64 size; /* total size as sent; -1 if not known */
} tablespaceinfo;
extern void SendBaseBackup(BaseBackupCmd *cmd);
#endif /* _BASEBACKUP_H */