Skip to content

Commit d11e339

Browse files
committed
[Issue #238] in PG>=12 use postgresql.auto.conf for recovery parameters
1 parent 91bcb9b commit d11e339

File tree

5 files changed

+520
-227
lines changed

5 files changed

+520
-227
lines changed

src/pg_probackup.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static pgRecoveryTarget *recovery_target_options = NULL;
9999
static pgRestoreParams *restore_params = NULL;
100100

101101
time_t current_time = 0;
102-
bool restore_as_replica = false;
102+
static bool restore_as_replica = false;
103103
bool no_validate = false;
104104
IncrRestoreMode incremental_mode = INCR_NONE;
105105

@@ -705,15 +705,14 @@ main(int argc, char *argv[])
705705
if (force)
706706
no_validate = true;
707707

708-
if (replication_slot != NULL)
709-
restore_as_replica = true;
710-
711708
/* keep all params in one structure */
712709
restore_params = pgut_new(pgRestoreParams);
713710
restore_params->is_restore = (backup_subcmd == RESTORE_CMD);
714711
restore_params->force = force;
715712
restore_params->no_validate = no_validate;
716713
restore_params->restore_as_replica = restore_as_replica;
714+
restore_params->recovery_settings_mode = DEFAULT;
715+
717716
restore_params->primary_slot_name = replication_slot;
718717
restore_params->skip_block_validation = skip_block_validation;
719718
restore_params->skip_external_dirs = skip_external_dirs;

src/pg_probackup.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ typedef enum PartialRestoreType
146146
EXCLUDE,
147147
} PartialRestoreType;
148148

149+
typedef enum RecoverySettingsMode
150+
{
151+
DEFAULT, /* not set */
152+
DONTWRITE, /* explicitly forbid to update recovery settings */
153+
//TODO Should we always clean/preserve old recovery settings,
154+
// or make it configurable?
155+
PITR_REQUESTED, /* can be set based on other parameters
156+
* if not explicitly forbidden */
157+
} RecoverySettingsMode;
158+
149159
typedef enum CompressAlg
150160
{
151161
NOT_DEFINED_COMPRESS = 0,
@@ -490,6 +500,8 @@ typedef struct pgRestoreParams
490500
bool is_restore;
491501
bool no_validate;
492502
bool restore_as_replica;
503+
//TODO maybe somehow add restore_as_replica as one of RecoverySettingsModes
504+
RecoverySettingsMode recovery_settings_mode;
493505
bool skip_external_dirs;
494506
bool skip_block_validation; //Start using it
495507
const char *restore_command;

0 commit comments

Comments
 (0)