mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
standby clone: move check for --waldir pg_basebackup option
When cloning from Barman, and --no-upstream-connection was supplied, the server version number will not be available at this point in the code. It will however later be extracted from the Barman metadata, so move the check for the --waldir pg_basebackup option to after this point. Also add an explicit check that a server version number has been obtained (and fall back to extracting it from the cloned data directory), as subsequent operations depend on knowing this to be performed correctly.
This commit is contained in:
@@ -6944,16 +6944,6 @@ run_file_backup(t_node_info *local_node_record)
|
||||
{
|
||||
t_basebackup_options backup_options = T_BASEBACKUP_OPTIONS_INITIALIZER;
|
||||
|
||||
Assert(source_server_version_num != UNKNOWN_SERVER_VERSION_NUM);
|
||||
|
||||
/*
|
||||
* Parse the pg_basebackup_options provided in repmgr.conf - we need to
|
||||
* check if --waldir/--xlogdir was provided.
|
||||
*/
|
||||
parse_pg_basebackup_options(config_file_options.pg_basebackup_options,
|
||||
&backup_options,
|
||||
source_server_version_num,
|
||||
NULL);
|
||||
/*
|
||||
* Locate Barman's base backups directory
|
||||
*/
|
||||
@@ -7161,6 +7151,37 @@ run_file_backup(t_node_info *local_node_record)
|
||||
|
||||
unlink(datadir_list_filename);
|
||||
|
||||
/*
|
||||
* At this point we should have the source server version number.
|
||||
* If not, try and extract it from the data directory.
|
||||
*/
|
||||
if (source_server_version_num == UNKNOWN_SERVER_VERSION_NUM)
|
||||
{
|
||||
log_warning(_("server version number is unknown"));
|
||||
source_server_version_num = get_pg_version(local_data_directory, NULL);
|
||||
|
||||
/*
|
||||
* In the unlikely we are still unable to obtain the server
|
||||
* version number, there's not a lot which can be done.
|
||||
*/
|
||||
if (source_server_version_num == UNKNOWN_SERVER_VERSION_NUM)
|
||||
{
|
||||
log_error(_("unable to extract server version number from the data directory, aborting"));
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
log_notice(_("server version number is: %i"), source_server_version_num);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the pg_basebackup_options provided in repmgr.conf - we need to
|
||||
* check if --waldir/--xlogdir was provided.
|
||||
*/
|
||||
parse_pg_basebackup_options(config_file_options.pg_basebackup_options,
|
||||
&backup_options,
|
||||
source_server_version_num,
|
||||
NULL);
|
||||
|
||||
|
||||
/*
|
||||
* We must create some PGDATA subdirectories because they are not
|
||||
* included in the Barman backup.
|
||||
|
||||
Reference in New Issue
Block a user