EnterpriseDB / barman

Barman - Backup and Recovery Manager for PostgreSQL
https://www.pgbarman.org/
GNU General Public License v3.0
2.07k stars 191 forks source link

Support custom values for recovery options when running `barman recover` #956

Open barthisrael opened 3 months ago

barthisrael commented 3 months ago

Context

This issue has been created based on inputs provided through #881 .

With the current implementation, Barman generates recovery configuration for the user through postgresql.auto.conf.

While the parameters inferred by Barman might fit well in most scenarios, there are cases where the user might want to override the values provided by Barman, e.g. override the default restore_command generated by Barman.

Objective

The objective of this ticket is to provide means for the user to override recovery options when executing barman recover command. That way, if the users want to override any of the values provided by Barman to postgresql.auto.conf they would be able to do that on their own risk.

One idea for implementing that would be:

  1. Expose a new --pg-recovery-option command-line argument for barman recover It could be specified multiple times, following the pattern GUC=value
  2. For every GUC specified through --pg-recovery-option, replace the value that wold be set by Barman with the custom value
JP95Git commented 3 months ago

Thanks for the issue.

Another idea: In repmgr you can define custom commands e.g. for starting PostgreSQL. Search for "service_start_command" in the documentation: https://www.repmgr.org/docs/current/configuration-file-service-commands.html

Perhaps we could add a new setting in barman like custom_restore_command = '/path/to/barman/bin/barman --config /path/to/config/barman.conf get-wal -P localhost %f > %p' If this setting exists barman would use the given command, if the setting is missing barman would use the existing strategy to create the restore_command.