added some messages to the clone command

This commit is contained in:
Gabriele Bartolini
2010-12-30 15:15:45 +01:00
committed by Greg Smith
parent cb36aaddff
commit 83eee2ed96
2 changed files with 31 additions and 9 deletions

2
log.c
View File

@@ -35,6 +35,8 @@
#define DEFAULT_SYSLOG_FACILITY LOG_LOCAL0 #define DEFAULT_SYSLOG_FACILITY LOG_LOCAL0
#endif #endif
/* #define REPMGR_DEBUG */
static int detect_log_level(const char* level); static int detect_log_level(const char* level);
static int detect_log_facility(const char* facility); static int detect_log_facility(const char* facility);

View File

@@ -626,6 +626,8 @@ do_standby_clone(void)
char master_version[MAXVERSIONSTR]; char master_version[MAXVERSIONSTR];
/* TODO: clone does not read config file - we need to enable logging or syslog */
/* if dest_dir hasn't been provided, initialize to current directory */ /* if dest_dir hasn't been provided, initialize to current directory */
if (!runtime_options.dest_dir[0]) if (!runtime_options.dest_dir[0])
{ {
@@ -882,13 +884,19 @@ do_standby_clone(void)
goto stop_backup; goto stop_backup;
} }
log_info("standby clone: master control file '%s'\n", master_control_file);
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_control_file, local_control_file, false); r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_control_file, local_control_file, false);
if (r != 0) if (r != 0) {
log_warning("standby clone: failed copying master control file '%s'\n", master_control_file);
goto stop_backup; goto stop_backup;
}
log_info("standby clone: master data directory '%s'\n", master_data_directory);
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_data_directory, runtime_options.dest_dir, true); r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_data_directory, runtime_options.dest_dir, true);
if (r != 0) if (r != 0) {
log_warning("standby clone: failed copying master data directory '%s'\n", master_data_directory);
goto stop_backup; goto stop_backup;
}
/* /*
* Copy tablespace locations, i'm doing this separately because i couldn't find and appropiate * Copy tablespace locations, i'm doing this separately because i couldn't find and appropiate
@@ -905,22 +913,35 @@ do_standby_clone(void)
} }
for (i = 0; i < PQntuples(res); i++) for (i = 0; i < PQntuples(res); i++)
{ {
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, PQgetvalue(res, i, 0), PQgetvalue(res, i, 0), true); strncpy(tblspc_dir, PQgetvalue(res, i, 0), MAXFILENAME);
if (r != 0) log_info("standby clone: master tablespace '%s'\n", tblspc_dir);
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, tblspc_dir, tblspc_dir, true);
if (r != 0) {
log_warning("standby clone: failed copying tablespace directory '%s'\n", tblspc_dir);
goto stop_backup;
}
}
log_info("standby clone: master config file '%s'\n", master_config_file);
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_config_file, runtime_options.dest_dir, false);
if (r != 0) {
log_warning("standby clone: failed copying master config file '%s'\n", master_config_file);
goto stop_backup; goto stop_backup;
} }
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_config_file, runtime_options.dest_dir, false); log_info("standby clone: master hba file '%s'\n", master_hba_file);
if (r != 0)
goto stop_backup;
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_hba_file, runtime_options.dest_dir, false); r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_hba_file, runtime_options.dest_dir, false);
if (r != 0) if (r != 0) {
log_warning("standby clone: failed copying master hba file '%s'\n", master_hba_file);
goto stop_backup; goto stop_backup;
}
log_info("standby clone: master ident file '%s'\n", master_ident_file);
r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_ident_file, runtime_options.dest_dir, false); r = copy_remote_files(runtime_options.host, runtime_options.remote_user, master_ident_file, runtime_options.dest_dir, false);
if (r != 0) if (r != 0) {
log_warning("standby clone: failed copying master ident file '%s'\n", master_ident_file);
goto stop_backup; goto stop_backup;
}
stop_backup: stop_backup:
/* inform the master that we have finished the backup */ /* inform the master that we have finished the backup */
@@ -1305,8 +1326,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path, char *local_
options, host_string, remote_path, local_path); options, host_string, remote_path, local_path);
} }
if (runtime_options.verbose) log_info("rsync command line: '%s'\n", script);
printf("rsync command line: '%s'\n",script);
r = system(script); r = system(script);