1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-12 11:45:24 +02:00

new flag '--temp-slot' allows user to use temporary slot for STREAM backups, if no slot name is specified via '--slot' option - default name 'pg_probackup_slot' is used

This commit is contained in:
Grigory Smolkin 2019-03-01 16:09:53 +03:00
parent 4097e10754
commit 98bc12d535
4 changed files with 17 additions and 6 deletions

View File

@ -2766,6 +2766,12 @@ StreamLog(void *arg)
stream_stop_timeout = 0;
stream_stop_begin = 0;
#if PG_VERSION_NUM >= 100000
/* if slot name was not provided for temp slot, use default slot name */
if (!replication_slot && temp_slot)
replication_slot = "pg_probackup_slot";
#endif
/*
* Start the replication
*/
@ -2786,6 +2792,7 @@ StreamLog(void *arg)
ctl.walmethod = CreateWalDirectoryMethod(stream_arg->basedir, 0, true);
ctl.replication_slot = replication_slot;
ctl.stop_socket = PGINVALID_SOCKET;
ctl.temp_slot = temp_slot;
#else
ctl.basedir = (char *) stream_arg->basedir;
#endif

View File

@ -97,9 +97,9 @@ help_pg_probackup(void)
printf(_(" [--format=format]\n"));
printf(_("\n %s backup -B backup-path -b backup-mode --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" [-C] [--stream [-S slot-name]] [--backup-pg-log]\n"));
printf(_(" [-j num-threads] [--archive-timeout=archive-timeout]\n"));
printf(_(" [--progress]\n"));
printf(_(" [-C] [--stream [-S slot-name] [--temp-slot]\n"));
printf(_(" [--backup-pg-log] [-j num-threads]\n"));
printf(_(" [--archive-timeout=archive-timeout] [--progress]\n"));
printf(_(" [--log-level-console=log-level-console]\n"));
printf(_(" [--log-level-file=log-level-file]\n"));
printf(_(" [--log-filename=log-filename]\n"));
@ -186,9 +186,9 @@ static void
help_backup(void)
{
printf(_("%s backup -B backup-path -b backup-mode --instance=instance_name\n"), PROGRAM_NAME);
printf(_(" [-C] [--stream [-S slot-name]] [--backup-pg-log]\n"));
printf(_(" [-j num-threads] [--archive-timeout=archive-timeout]\n"));
printf(_(" [--progress]\n"));
printf(_(" [-C] [--stream [-S slot-name] [--temp-slot]\n"));
printf(_(" [--backup-pg-log] [-j num-threads]\n"));
printf(_(" [--archive-timeout=archive-timeout] [--progress]\n"));
printf(_(" [--log-level-console=log-level-console]\n"));
printf(_(" [--log-level-file=log-level-file]\n"));
printf(_(" [--log-filename=log-filename]\n"));
@ -215,6 +215,7 @@ help_backup(void)
printf(_(" -C, --smooth-checkpoint do smooth checkpoint before backup\n"));
printf(_(" --stream stream the transaction log and include it in the backup\n"));
printf(_(" -S, --slot=SLOTNAME replication slot to use\n"));
printf(_(" --temp-slot use temporary replication slot\n"));
printf(_(" --backup-pg-log backup of '%s' directory\n"), PG_LOG_DIR);
printf(_(" -j, --threads=NUM number of parallel threads\n"));
printf(_(" --archive-timeout=timeout wait timeout for WAL segment archiving (default: 5min)\n"));

View File

@ -62,6 +62,7 @@ bool progress = false;
#if PG_VERSION_NUM >= 100000
char *replication_slot = NULL;
#endif
bool temp_slot = false;
/* backup options */
bool backup_logs = false;
@ -133,6 +134,7 @@ static ConfigOption cmd_options[] =
{ 'f', 'b', "backup-mode", opt_backup_mode, SOURCE_CMD_STRICT },
{ 'b', 'C', "smooth-checkpoint", &smooth_checkpoint, SOURCE_CMD_STRICT },
{ 's', 'S', "slot", &replication_slot, SOURCE_CMD_STRICT },
{ 'b', 234, "temp-slot", &temp_slot, SOURCE_CMD_STRICT },
{ 'b', 134, "delete-wal", &delete_wal, SOURCE_CMD_STRICT },
{ 'b', 135, "delete-expired", &delete_expired, SOURCE_CMD_STRICT },
/* TODO not completed feature. Make it unavailiable from user level

View File

@ -359,6 +359,7 @@ extern bool progress;
/* In pre-10 'replication_slot' is defined in receivelog.h */
extern char *replication_slot;
#endif
extern bool temp_slot;
/* backup options */
extern bool smooth_checkpoint;