Skip to content

Commit

Permalink
Explicitly enable "hot_standby" during restore
Browse files Browse the repository at this point in the history
This parameter has been enabled by default since Postgres 10 and is
unlikely to change, but we want the behavior, so we should set it.
  • Loading branch information
cbandy committed Nov 27, 2024
1 parent 99a0953 commit 16ee0b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/pgbackrest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func MakePGBackrestLogDir(template *corev1.PodTemplateSpec,
func RestoreCommand(pgdata, hugePagesSetting, fetchKeyCommand string, tablespaceVolumes []*corev1.PersistentVolumeClaim, args ...string) []string {

// After pgBackRest restores files, PostgreSQL starts in recovery to finish
// replaying WAL files. "hot_standby" is "on" (by default) so we can detect
// replaying WAL files. "hot_standby" is "on" so we can detect
// when recovery has finished. In that mode, some parameters cannot be
// smaller than they were when PostgreSQL was backed up. Configure them to
// match the values reported by "pg_controldata". Those parameters are also
Expand Down Expand Up @@ -233,6 +233,7 @@ cat > /tmp/postgres.restore.conf <<EOF
archive_command = 'false'
archive_mode = 'on'
hba_file = '/tmp/pg_hba.restore.conf'
hot_standby = 'on'
max_connections = '${max_conn}'
max_locks_per_transaction = '${max_lock}'
max_prepared_transactions = '${max_ptxn}'
Expand Down

0 comments on commit 16ee0b2

Please sign in to comment.