Skip to content

Commit 4b0f88e

Browse files
author
Michael Paquier
committed
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.
1 parent 308d00b commit 4b0f88e

File tree

4 files changed

+2
-49
lines changed

4 files changed

+2
-49
lines changed

backup.c

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ static void pg_stop_backup(pgBackup *backup);
5151
static void pg_switch_xlog(pgBackup *backup);
5252
static void get_lsn(PGresult *res, XLogRecPtr *lsn);
5353
static void get_xid(PGresult *res, uint32 *xid);
54-
static bool execute_restartpoint(pgBackupOption bkupopt);
5554

5655
static void delete_arclog_link(void);
5756
static void delete_online_wal_backup(void);
@@ -78,7 +77,6 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
7877
XLogRecPtr *lsn = NULL;
7978
char prev_file_txt[MAXPGPATH]; /* path of the previous backup list file */
8079
bool has_backup_label = true; /* flag if backup_label is there */
81-
bool has_recovery_conf = false; /* flag if recovery.conf is there */
8280

8381
/* repack the options */
8482
bool smooth_checkpoint = bkupopt.smooth_checkpoint;
@@ -131,30 +129,15 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
131129
snprintf(path, lengthof(path), "%s/recovery.conf", pgdata);
132130
make_native_path(path);
133131
if (fileExists(path)) {
134-
has_recovery_conf = true;
132+
current.is_from_standby = true;
135133
}
136-
if (!has_backup_label && !has_recovery_conf)
134+
if (!has_backup_label && !current.is_from_standby)
137135
{
138136
if (verbose)
139137
printf(_("backup_label does not exist, stop backup\n"));
140138
pg_stop_backup(NULL);
141139
elog(ERROR_SYSTEM, _("backup_label does not exist in PGDATA."));
142140
}
143-
else if (has_recovery_conf)
144-
{
145-
146-
if (!bkupopt.standby_host || !bkupopt.standby_port)
147-
{
148-
pg_stop_backup(NULL);
149-
elog(ERROR_SYSTEM, _("could not specified standby host or port."));
150-
}
151-
if (!execute_restartpoint(bkupopt))
152-
{
153-
pg_stop_backup(NULL);
154-
elog(ERROR_SYSTEM, _("could not execute restartpoint."));
155-
}
156-
current.is_from_standby = true;
157-
}
158141

159142
/*
160143
* list directories and symbolic links with the physical path to make
@@ -448,24 +431,6 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
448431
return files;
449432
}
450433

451-
static bool
452-
execute_restartpoint(pgBackupOption bkupopt)
453-
{
454-
PGconn *sby_conn = NULL;
455-
const char *tmp_host;
456-
const char *tmp_port;
457-
tmp_host = pgut_get_host();
458-
tmp_port = pgut_get_port();
459-
pgut_set_host(bkupopt.standby_host);
460-
pgut_set_port(bkupopt.standby_port);
461-
sby_conn = reconnect_elevel(ERROR_PG_CONNECT);
462-
if (!sby_conn)
463-
return false;
464-
command("CHECKPOINT", 0, NULL);
465-
pgut_set_host(tmp_host);
466-
pgut_set_port(tmp_port);
467-
return true;
468-
}
469434

470435
/*
471436
* backup archived WAL incrementally.

expected/option.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ Backup options:
2828
--keep-arclog-days=DAY keep archived WAL modified in DAY days
2929
--keep-srvlog-files=NUM keep NUM of serverlogs
3030
--keep-srvlog-days=DAY keep serverlog modified in DAY days
31-
--standby-host=HOSTNAME standby host when taking backup from standby
32-
--standby-port=PORT standby port when taking backup from standby
3331

3432
Restore options:
3533
--recovery-target-time time stamp up to which recovery will proceed

pg_rman.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ static int keep_srvlog_files = KEEP_INFINITE;
3939
static int keep_srvlog_days = KEEP_INFINITE;
4040
static int keep_data_generations = KEEP_INFINITE;
4141
static int keep_data_days = KEEP_INFINITE;
42-
static char *standby_host = NULL;
43-
static char *standby_port = NULL;
4442

4543
/* restore configuration */
4644
static char *target_time;
@@ -73,8 +71,6 @@ static pgut_option options[] =
7371
{ 'b', 's', "with-serverlog" , &current.with_serverlog , SOURCE_ENV },
7472
{ 'b', 'Z', "compress-data" , &current.compress_data , SOURCE_ENV },
7573
{ 'b', 'C', "smooth-checkpoint" , &smooth_checkpoint , SOURCE_ENV },
76-
{ 's', 12, "standby-host" , &standby_host , SOURCE_ENV },
77-
{ 's', 13, "standby-port" , &standby_port , SOURCE_ENV },
7874
/* delete options */
7975
{ 'b', 'f', "force" , &force , SOURCE_ENV },
8076
/* options with only long name (keep-xxx) */
@@ -194,8 +190,6 @@ main(int argc, char *argv[])
194190
bkupopt.keep_srvlog_days = keep_srvlog_days;
195191
bkupopt.keep_data_generations = keep_data_generations;
196192
bkupopt.keep_data_days = keep_data_days;
197-
bkupopt.standby_host = standby_host;
198-
bkupopt.standby_port = standby_port;
199193
return do_backup(bkupopt);
200194
}
201195
else if (pg_strcasecmp(cmd, "restore") == 0){
@@ -247,8 +241,6 @@ pgut_help(bool details)
247241
printf(_(" --keep-arclog-days=DAY keep archived WAL modified in DAY days\n"));
248242
printf(_(" --keep-srvlog-files=NUM keep NUM of serverlogs\n"));
249243
printf(_(" --keep-srvlog-days=DAY keep serverlog modified in DAY days\n"));
250-
printf(_(" --standby-host=HOSTNAME standby host when taking backup from standby\n"));
251-
printf(_(" --standby-port=PORT standby port when taking backup from standby\n"));
252244
printf(_("\nRestore options:\n"));
253245
printf(_(" --recovery-target-time time stamp up to which recovery will proceed\n"));
254246
printf(_(" --recovery-target-xid transaction ID up to which recovery will proceed\n"));

pg_rman.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ typedef struct pgBackupOption
169169
int keep_srvlog_days;
170170
int keep_data_generations;
171171
int keep_data_days;
172-
char *standby_host;
173-
char *standby_port;
174172
} pgBackupOption;
175173

176174

0 commit comments

Comments
 (0)