diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/basebackup.c | 4 | ||||
-rw-r--r-- | src/backend/utils/cache/relcache.c | 5 | ||||
-rw-r--r-- | src/bin/pg_basebackup/t/010_pg_basebackup.pl | 10 | ||||
-rw-r--r-- | src/include/utils/relcache.h | 5 |
4 files changed, 17 insertions, 7 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 75029b0def9..1411c14e928 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -36,6 +36,7 @@ #include "utils/builtins.h" #include "utils/elog.h" #include "utils/ps_status.h" +#include "utils/relcache.h" #include "utils/timestamp.h" @@ -151,6 +152,9 @@ static const char *excludeFiles[] = /* Skip current log file temporary file */ LOG_METAINFO_DATAFILE_TMP, + /* Skip relation cache because it is rebuilt on startup */ + RELCACHE_INIT_FILENAME, + /* * If there's a backup_label or tablespace_map file, it belongs to a * backup started by the user with pg_start_backup(). It is *not* correct diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index b8e37809b05..5015719915b 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -87,11 +87,6 @@ #include "utils/tqual.h" -/* - * name of relcache init file(s), used to speed up backend startup - */ -#define RELCACHE_INIT_FILENAME "pg_internal.init" - #define RELCACHE_INIT_FILEMAGIC 0x573266 /* version ID value */ /* diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index 6a8be09f4cd..cdf4f5be37a 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -4,7 +4,7 @@ use Cwd; use Config; use PostgresNode; use TestLib; -use Test::More tests => 78; +use Test::More tests => 79; program_help_ok('pg_basebackup'); program_version_ok('pg_basebackup'); @@ -61,6 +61,11 @@ foreach my $filename ( close $file; } +# Connect to a database to create global/pg_internal.init. If this is removed +# the test to ensure global/pg_internal.init is not copied will return a false +# positive. +$node->safe_psql('postgres', 'SELECT 1;'); + $node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup", '-X', 'none' ], 'pg_basebackup runs'); ok(-f "$tempdir/backup/PG_VERSION", 'backup was created'); @@ -84,7 +89,8 @@ foreach my $dirname ( # These files should not be copied. foreach my $filename ( - qw(postgresql.auto.conf.tmp postmaster.opts postmaster.pid tablespace_map current_logfiles.tmp) + qw(postgresql.auto.conf.tmp postmaster.opts postmaster.pid tablespace_map current_logfiles.tmp + global/pg_internal.init) ) { ok(!-f "$tempdir/backup/$filename", "$filename not copied"); diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index 3c53cefe4b4..29c6d9bae37 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -18,6 +18,11 @@ #include "nodes/bitmapset.h" +/* + * Name of relcache init file(s), used to speed up backend startup + */ +#define RELCACHE_INIT_FILENAME "pg_internal.init" + typedef struct RelationData *Relation; /* ---------------- |