mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Rename 'test_mode' to 'target_directory_provided'
Which describes its meaning more accurately. Also update some comments.
This commit is contained in:
41
repmgr.c
41
repmgr.c
@@ -867,7 +867,7 @@ do_standby_clone(void)
|
|||||||
retval = SUCCESS;
|
retval = SUCCESS;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
bool test_mode = false;
|
bool target_directory_provided = false;
|
||||||
bool config_file_copy_required = false;
|
bool config_file_copy_required = false;
|
||||||
|
|
||||||
char master_data_directory[MAXFILENAME];
|
char master_data_directory[MAXFILENAME];
|
||||||
@@ -883,18 +883,16 @@ do_standby_clone(void)
|
|||||||
char local_ident_file[MAXFILENAME] = "";
|
char local_ident_file[MAXFILENAME] = "";
|
||||||
|
|
||||||
TablespaceListCell *cell;
|
TablespaceListCell *cell;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if dest_dir has been provided, we copy everything in the same path if
|
* If dest_dir (-D/--pgdata) was provided, this will become the new data
|
||||||
* dest_dir is set and the master have tablespace, repmgr will stop
|
* directory (otherwise repmgr will default to the same directory as on the
|
||||||
* because it is more complex to remap the path for the tablespaces and it
|
* source host)
|
||||||
* does not look useful at the moment
|
|
||||||
*
|
|
||||||
* XXX test_mode a bit of a misnomer
|
|
||||||
*/
|
*/
|
||||||
if (runtime_options.dest_dir[0])
|
if (runtime_options.dest_dir[0])
|
||||||
{
|
{
|
||||||
test_mode = true;
|
target_directory_provided = true;
|
||||||
log_notice(_("%s Destination directory %s provided, try to clone everything in it.\n"),
|
log_notice(_("%s Destination directory '%s' provided\n"),
|
||||||
progname, runtime_options.dest_dir);
|
progname, runtime_options.dest_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -904,12 +902,12 @@ do_standby_clone(void)
|
|||||||
keywords[1] = "port";
|
keywords[1] = "port";
|
||||||
values[1] = runtime_options.masterport;
|
values[1] = runtime_options.masterport;
|
||||||
|
|
||||||
/* We need to connect to check configuration and start a backup */
|
/* Connect to check configuration */
|
||||||
log_info(_("%s connecting to master database\n"), progname);
|
log_info(_("%s connecting to upstream node\n"), progname);
|
||||||
primary_conn = establish_db_connection_by_params(keywords, values, true);
|
primary_conn = establish_db_connection_by_params(keywords, values, true);
|
||||||
|
|
||||||
/* Verify that master is a supported server version */
|
/* Verify that upstream node is a supported server version */
|
||||||
log_info(_("%s connected to master, checking its state\n"), progname);
|
log_info(_("%s connected to upstream node, checking its state\n"), progname);
|
||||||
server_version_num = check_server_version(primary_conn, "master", true, NULL);
|
server_version_num = check_server_version(primary_conn, "master", true, NULL);
|
||||||
|
|
||||||
check_upstream_config(primary_conn, server_version_num, true);
|
check_upstream_config(primary_conn, server_version_num, true);
|
||||||
@@ -922,7 +920,7 @@ do_standby_clone(void)
|
|||||||
* We'll do that here as a value-added service.
|
* We'll do that here as a value-added service.
|
||||||
*
|
*
|
||||||
* XXX -T/--tablespace-mapping not available for PostgreSQL 9.3 -
|
* XXX -T/--tablespace-mapping not available for PostgreSQL 9.3 -
|
||||||
* emit warning or fail
|
* currently we can't handle that and will fail with an error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(options.tablespace_dirs.head != NULL)
|
if(options.tablespace_dirs.head != NULL)
|
||||||
@@ -964,7 +962,7 @@ do_standby_clone(void)
|
|||||||
if(get_cluster_size(primary_conn, cluster_size) == false)
|
if(get_cluster_size(primary_conn, cluster_size) == false)
|
||||||
exit(ERR_DB_QUERY);
|
exit(ERR_DB_QUERY);
|
||||||
|
|
||||||
log_info(_("Successfully primary_connected to master. Current installation size is %s\n"),
|
log_info(_("Successfully connected to upstream node. Current installation size is %s\n"),
|
||||||
cluster_size);
|
cluster_size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -987,8 +985,8 @@ do_standby_clone(void)
|
|||||||
" ps.setting ~ ('^' || dd.setting) AS in_data_dir "
|
" ps.setting ~ ('^' || dd.setting) AS in_data_dir "
|
||||||
" FROM dd, pg_settings ps "
|
" FROM dd, pg_settings ps "
|
||||||
" WHERE ps.name IN ('data_directory', 'config_file', 'hba_file', 'ident_file') "
|
" WHERE ps.name IN ('data_directory', 'config_file', 'hba_file', 'ident_file') "
|
||||||
" ORDER BY 1 "
|
" ORDER BY 1 ");
|
||||||
);
|
|
||||||
log_debug(_("standby clone: %s\n"), sqlquery);
|
log_debug(_("standby clone: %s\n"), sqlquery);
|
||||||
res = PQexec(primary_conn, sqlquery);
|
res = PQexec(primary_conn, sqlquery);
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
@@ -1045,7 +1043,12 @@ do_standby_clone(void)
|
|||||||
}
|
}
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|
||||||
if (test_mode)
|
/*
|
||||||
|
* target directory (-D/--pgdata) provided - use that as new data directory
|
||||||
|
* (useful when executing backup on local machine only or creating the backup
|
||||||
|
* in a different local directory when backup source is a remote host)
|
||||||
|
*/
|
||||||
|
if (target_directory_provided)
|
||||||
{
|
{
|
||||||
strncpy(local_data_directory, runtime_options.dest_dir, MAXFILENAME);
|
strncpy(local_data_directory, runtime_options.dest_dir, MAXFILENAME);
|
||||||
strncpy(local_config_file, runtime_options.dest_dir, MAXFILENAME);
|
strncpy(local_config_file, runtime_options.dest_dir, MAXFILENAME);
|
||||||
@@ -1185,7 +1188,7 @@ stop_backup:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
log_notice("HINT: You can now start your postgresql server\n");
|
log_notice("HINT: You can now start your postgresql server\n");
|
||||||
if (test_mode)
|
if (target_directory_provided)
|
||||||
{
|
{
|
||||||
log_notice(_("for example : pg_ctl -D %s start\n"),
|
log_notice(_("for example : pg_ctl -D %s start\n"),
|
||||||
local_data_directory);
|
local_data_directory);
|
||||||
|
|||||||
Reference in New Issue
Block a user