mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Remove exclusive backup mode
Exclusive-mode backups have been deprecated since 9.6 (when non-exclusive backups were introduced) due to the issues they can cause should the system crash while one is running and generally because non-exclusive provides a much better interface. Further, exclusive backup mode wasn't really being tested (nor was most of the related code- like being able to log in just to stop an exclusive backup and the bits of the state machine related to that) and having to possibly deal with an exclusive backup and the backup_label file existing during pg_basebackup, pg_rewind, etc, added other complexities that we are better off without. This patch removes the exclusive backup mode, the various special cases for dealing with it, and greatly simplifies the online backup code and documentation. Authors: David Steele, Nathan Bossart Reviewed-by: Chapman Flack Discussion: https://postgr.es/m/ac7339ca-3718-3c93-929f-99e725d1172c@pgmasters.net https://postgr.es/m/CAHg+QDfiM+WU61tF6=nPZocMZvHDzCK47Kneyb0ZRULYzV5sKQ@mail.gmail.com
This commit is contained in:
@ -638,25 +638,6 @@ sub backup
|
||||
return;
|
||||
}
|
||||
|
||||
=item $node->backup_fs_hot(backup_name)
|
||||
|
||||
Create a backup with a filesystem level copy in subdirectory B<backup_name> of
|
||||
B<< $node->backup_dir >>, including WAL.
|
||||
|
||||
Archiving must be enabled, as B<pg_start_backup()> and B<pg_stop_backup()> are
|
||||
used. This is not checked or enforced.
|
||||
|
||||
The backup name is passed as the backup label to B<pg_start_backup()>.
|
||||
|
||||
=cut
|
||||
|
||||
sub backup_fs_hot
|
||||
{
|
||||
my ($self, $backup_name) = @_;
|
||||
$self->_backup_fs($backup_name, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
=item $node->backup_fs_cold(backup_name)
|
||||
|
||||
Create a backup with a filesystem level copy in subdirectory B<backup_name> of
|
||||
@ -670,53 +651,18 @@ Use B<backup> or B<backup_fs_hot> if you want to back up a running server.
|
||||
sub backup_fs_cold
|
||||
{
|
||||
my ($self, $backup_name) = @_;
|
||||
$self->_backup_fs($backup_name, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Common sub of backup_fs_hot and backup_fs_cold
|
||||
sub _backup_fs
|
||||
{
|
||||
my ($self, $backup_name, $hot) = @_;
|
||||
my $backup_path = $self->backup_dir . '/' . $backup_name;
|
||||
my $port = $self->port;
|
||||
my $name = $self->name;
|
||||
|
||||
print "# Taking filesystem backup $backup_name from node \"$name\"\n";
|
||||
|
||||
if ($hot)
|
||||
{
|
||||
my $stdout = $self->safe_psql('postgres',
|
||||
"SELECT * FROM pg_start_backup('$backup_name');");
|
||||
print "# pg_start_backup: $stdout\n";
|
||||
}
|
||||
|
||||
PostgreSQL::Test::RecursiveCopy::copypath(
|
||||
$self->data_dir,
|
||||
$backup_path,
|
||||
$self->backup_dir . '/' . $backup_name,
|
||||
filterfn => sub {
|
||||
my $src = shift;
|
||||
return ($src ne 'log' and $src ne 'postmaster.pid');
|
||||
});
|
||||
|
||||
if ($hot)
|
||||
{
|
||||
|
||||
# We ignore pg_stop_backup's return value. We also assume archiving
|
||||
# is enabled; otherwise the caller will have to copy the remaining
|
||||
# segments.
|
||||
my $stdout =
|
||||
$self->safe_psql('postgres', 'SELECT * FROM pg_stop_backup();');
|
||||
print "# pg_stop_backup: $stdout\n";
|
||||
}
|
||||
|
||||
print "# Backup finished\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
=pod
|
||||
|
||||
=item $node->init_from_backup(root_node, backup_name)
|
||||
|
Reference in New Issue
Block a user