1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-02-03 14:01:57 +02:00

Remove standby-site option

The documentation found on internet is rather unclear about the role
and the goal of this feature, which looks more like a kludge to cover
the fact that most of the system XLOG functions do not work on standby
nodes. Now that this restriction has been removed by using the control
file to look for the current timestamp, this feature is not needed.
This commit is contained in:
Michael Paquier 2013-12-13 04:14:29 +09:00
parent 308d00b80c
commit 4b0f88e4d5
4 changed files with 2 additions and 49 deletions

View File

@ -51,7 +51,6 @@ static void pg_stop_backup(pgBackup *backup);
static void pg_switch_xlog(pgBackup *backup);
static void get_lsn(PGresult *res, XLogRecPtr *lsn);
static void get_xid(PGresult *res, uint32 *xid);
static bool execute_restartpoint(pgBackupOption bkupopt);
static void delete_arclog_link(void);
static void delete_online_wal_backup(void);
@ -78,7 +77,6 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
XLogRecPtr *lsn = NULL;
char prev_file_txt[MAXPGPATH]; /* path of the previous backup list file */
bool has_backup_label = true; /* flag if backup_label is there */
bool has_recovery_conf = false; /* flag if recovery.conf is there */
/* repack the options */
bool smooth_checkpoint = bkupopt.smooth_checkpoint;
@ -131,30 +129,15 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
snprintf(path, lengthof(path), "%s/recovery.conf", pgdata);
make_native_path(path);
if (fileExists(path)) {
has_recovery_conf = true;
current.is_from_standby = true;
}
if (!has_backup_label && !has_recovery_conf)
if (!has_backup_label && !current.is_from_standby)
{
if (verbose)
printf(_("backup_label does not exist, stop backup\n"));
pg_stop_backup(NULL);
elog(ERROR_SYSTEM, _("backup_label does not exist in PGDATA."));
}
else if (has_recovery_conf)
{
if (!bkupopt.standby_host || !bkupopt.standby_port)
{
pg_stop_backup(NULL);
elog(ERROR_SYSTEM, _("could not specified standby host or port."));
}
if (!execute_restartpoint(bkupopt))
{
pg_stop_backup(NULL);
elog(ERROR_SYSTEM, _("could not execute restartpoint."));
}
current.is_from_standby = true;
}
/*
* list directories and symbolic links with the physical path to make
@ -448,24 +431,6 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
return files;
}
static bool
execute_restartpoint(pgBackupOption bkupopt)
{
PGconn *sby_conn = NULL;
const char *tmp_host;
const char *tmp_port;
tmp_host = pgut_get_host();
tmp_port = pgut_get_port();
pgut_set_host(bkupopt.standby_host);
pgut_set_port(bkupopt.standby_port);
sby_conn = reconnect_elevel(ERROR_PG_CONNECT);
if (!sby_conn)
return false;
command("CHECKPOINT", 0, NULL);
pgut_set_host(tmp_host);
pgut_set_port(tmp_port);
return true;
}
/*
* backup archived WAL incrementally.

View File

@ -28,8 +28,6 @@ Backup options:
--keep-arclog-days=DAY keep archived WAL modified in DAY days
--keep-srvlog-files=NUM keep NUM of serverlogs
--keep-srvlog-days=DAY keep serverlog modified in DAY days
--standby-host=HOSTNAME standby host when taking backup from standby
--standby-port=PORT standby port when taking backup from standby
Restore options:
--recovery-target-time time stamp up to which recovery will proceed

View File

@ -39,8 +39,6 @@ static int keep_srvlog_files = KEEP_INFINITE;
static int keep_srvlog_days = KEEP_INFINITE;
static int keep_data_generations = KEEP_INFINITE;
static int keep_data_days = KEEP_INFINITE;
static char *standby_host = NULL;
static char *standby_port = NULL;
/* restore configuration */
static char *target_time;
@ -73,8 +71,6 @@ static pgut_option options[] =
{ 'b', 's', "with-serverlog" , &current.with_serverlog , SOURCE_ENV },
{ 'b', 'Z', "compress-data" , &current.compress_data , SOURCE_ENV },
{ 'b', 'C', "smooth-checkpoint" , &smooth_checkpoint , SOURCE_ENV },
{ 's', 12, "standby-host" , &standby_host , SOURCE_ENV },
{ 's', 13, "standby-port" , &standby_port , SOURCE_ENV },
/* delete options */
{ 'b', 'f', "force" , &force , SOURCE_ENV },
/* options with only long name (keep-xxx) */
@ -194,8 +190,6 @@ main(int argc, char *argv[])
bkupopt.keep_srvlog_days = keep_srvlog_days;
bkupopt.keep_data_generations = keep_data_generations;
bkupopt.keep_data_days = keep_data_days;
bkupopt.standby_host = standby_host;
bkupopt.standby_port = standby_port;
return do_backup(bkupopt);
}
else if (pg_strcasecmp(cmd, "restore") == 0){
@ -247,8 +241,6 @@ pgut_help(bool details)
printf(_(" --keep-arclog-days=DAY keep archived WAL modified in DAY days\n"));
printf(_(" --keep-srvlog-files=NUM keep NUM of serverlogs\n"));
printf(_(" --keep-srvlog-days=DAY keep serverlog modified in DAY days\n"));
printf(_(" --standby-host=HOSTNAME standby host when taking backup from standby\n"));
printf(_(" --standby-port=PORT standby port when taking backup from standby\n"));
printf(_("\nRestore options:\n"));
printf(_(" --recovery-target-time time stamp up to which recovery will proceed\n"));
printf(_(" --recovery-target-xid transaction ID up to which recovery will proceed\n"));

View File

@ -169,8 +169,6 @@ typedef struct pgBackupOption
int keep_srvlog_days;
int keep_data_generations;
int keep_data_days;
char *standby_host;
char *standby_port;
} pgBackupOption;