Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 98267ee

Browse files
Exclude pg_internal.init from BASE_BACKUP
Add docs to explain this for other backup mechanisms Author: David Steele <david@pgmasters.net> Reviewed-by: Petr Jelinek <petr.jelinek@2ndQuadrant.com> et al
1 parent d0c80c1 commit 98267ee

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

doc/src/sgml/backup.sgml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,12 @@ SELECT pg_stop_backup();
11291129
the directories will be recreated as needed.
11301130
</para>
11311131

1132+
<para>
1133+
<filename>pg_internal.init</filename> files can be omitted from the
1134+
backup whenever a file of that name is found. These files contain
1135+
relation cache data that is always rebuilt when recovering.
1136+
</para>
1137+
11321138
<para>
11331139
The backup label
11341140
file includes the label string you gave to <function>pg_start_backup</function>,

doc/src/sgml/protocol.sgml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,6 +2499,11 @@ The commands accepted in walsender mode are:
24992499
<filename>postmaster.opts</filename>
25002500
</para>
25012501
</listitem>
2502+
<listitem>
2503+
<para>
2504+
<filename>pg_internal.init (found in multiple directories)</>
2505+
</para>
2506+
</listitem>
25022507
<listitem>
25032508
<para>
25042509
Various temporary files and directories created during the operation

src/backend/replication/basebackup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "utils/builtins.h"
3737
#include "utils/elog.h"
3838
#include "utils/ps_status.h"
39+
#include "utils/relcache.h"
3940
#include "utils/timestamp.h"
4041

4142

@@ -151,6 +152,9 @@ static const char *excludeFiles[] =
151152
/* Skip current log file temporary file */
152153
LOG_METAINFO_DATAFILE_TMP,
153154

155+
/* Skip relation cache because it is rebuilt on startup */
156+
RELCACHE_INIT_FILENAME,
157+
154158
/*
155159
* If there's a backup_label or tablespace_map file, it belongs to a
156160
* backup started by the user with pg_start_backup(). It is *not* correct

src/backend/utils/cache/relcache.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@
8787
#include "utils/tqual.h"
8888

8989

90-
/*
91-
* name of relcache init file(s), used to speed up backend startup
92-
*/
93-
#define RELCACHE_INIT_FILENAME "pg_internal.init"
94-
9590
#define RELCACHE_INIT_FILEMAGIC 0x573266 /* version ID value */
9691

9792
/*

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use Config;
55
use PostgresNode;
66
use TestLib;
7-
use Test::More tests => 78;
7+
use Test::More tests => 79;
88

99
program_help_ok('pg_basebackup');
1010
program_version_ok('pg_basebackup');
@@ -61,6 +61,11 @@
6161
close $file;
6262
}
6363

64+
# Connect to a database to create global/pg_internal.init. If this is removed
65+
# the test to ensure global/pg_internal.init is not copied will return a false
66+
# positive.
67+
$node->safe_psql('postgres', 'SELECT 1;');
68+
6469
$node->command_ok([ 'pg_basebackup', '-D', "$tempdir/backup", '-X', 'none' ],
6570
'pg_basebackup runs');
6671
ok(-f "$tempdir/backup/PG_VERSION", 'backup was created');
@@ -84,7 +89,8 @@
8489

8590
# These files should not be copied.
8691
foreach my $filename (
87-
qw(postgresql.auto.conf.tmp postmaster.opts postmaster.pid tablespace_map current_logfiles.tmp)
92+
qw(postgresql.auto.conf.tmp postmaster.opts postmaster.pid tablespace_map current_logfiles.tmp
93+
global/pg_internal.init)
8894
)
8995
{
9096
ok(!-f "$tempdir/backup/$filename", "$filename not copied");

src/include/utils/relcache.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#include "nodes/bitmapset.h"
1919

2020

21+
/*
22+
* Name of relcache init file(s), used to speed up backend startup
23+
*/
24+
#define RELCACHE_INIT_FILENAME "pg_internal.init"
25+
2126
typedef struct RelationData *Relation;
2227

2328
/* ----------------

0 commit comments

Comments
 (0)