mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-28 01:16:29 +00:00
astyle cleanup run after recent merges
This commit is contained in:
3
config.c
3
config.c
@@ -28,7 +28,8 @@ parse_config(const char* config_file, t_configuration_options* options)
|
||||
|
||||
FILE *fp = fopen (config_file, "r");
|
||||
|
||||
if (fp == NULL) {
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, _("Could not find configuration file '%s'\n"), config_file);
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
3
config.h
3
config.h
@@ -22,7 +22,8 @@
|
||||
|
||||
#include "repmgr.h"
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
char cluster_name[MAXLEN];
|
||||
int node;
|
||||
char conninfo[MAXLEN];
|
||||
|
||||
30
log.c
30
log.c
@@ -57,11 +57,13 @@ bool logger_init(const char* ident, const char* level, const char* facility)
|
||||
printf("Logger initialisation (Level: %s, Facility: %s)\n", level, facility);
|
||||
#endif
|
||||
|
||||
if (!ident) {
|
||||
if (!ident)
|
||||
{
|
||||
ident = DEFAULT_IDENT;
|
||||
}
|
||||
|
||||
if (level && *level) {
|
||||
if (level && *level)
|
||||
{
|
||||
l = detect_log_level(level);
|
||||
#ifdef REPMGR_DEBUG
|
||||
printf("Assigned level for logger: %d\n", l);
|
||||
@@ -73,24 +75,28 @@ bool logger_init(const char* ident, const char* level, const char* facility)
|
||||
stderr_log_warning(_("Cannot detect log level %s (use any of DEBUG, INFO, NOTICE, WARNING, ERR, ALERT, CRIT or EMERG)\n"), level);
|
||||
}
|
||||
|
||||
if (facility && *facility) {
|
||||
if (facility && *facility)
|
||||
{
|
||||
|
||||
f = detect_log_facility(facility);
|
||||
#ifdef REPMGR_DEBUG
|
||||
printf("Assigned facility for logger: %d\n", f);
|
||||
#endif
|
||||
|
||||
if (f == 0) {
|
||||
if (f == 0)
|
||||
{
|
||||
/* No syslog requested, just stderr */
|
||||
#ifdef REPMGR_DEBUG
|
||||
printf(_("Use stderr for logging\n"));
|
||||
#endif
|
||||
}
|
||||
else if (f == -1) {
|
||||
else if (f == -1)
|
||||
{
|
||||
stderr_log_warning(_("Cannot detect log facility %s (use any of LOCAL0, LOCAL1, ..., LOCAL7, USER or STDERR)\n"), facility);
|
||||
}
|
||||
#ifdef HAVE_SYSLOG
|
||||
else {
|
||||
else
|
||||
{
|
||||
syslog_facility = f;
|
||||
log_type = REPMGR_SYSLOG;
|
||||
}
|
||||
@@ -149,11 +155,13 @@ int detect_log_level(const char* level)
|
||||
int detect_log_facility(const char* facility)
|
||||
{
|
||||
int local = 0;
|
||||
if (!strncmp(facility, "LOCAL", 5) && strlen(facility) == 6) {
|
||||
if (!strncmp(facility, "LOCAL", 5) && strlen(facility) == 6)
|
||||
{
|
||||
|
||||
local = atoi (&facility[5]);
|
||||
|
||||
switch(local) {
|
||||
switch (local)
|
||||
{
|
||||
case 0:
|
||||
return LOG_LOCAL0;
|
||||
break;
|
||||
@@ -181,10 +189,12 @@ int detect_log_facility(const char* facility)
|
||||
}
|
||||
|
||||
}
|
||||
else if (!strcmp(facility, "USER")) {
|
||||
else if (!strcmp(facility, "USER"))
|
||||
{
|
||||
return LOG_USER;
|
||||
}
|
||||
else if (!strcmp(facility, "STDERR")) {
|
||||
else if (!strcmp(facility, "STDERR"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
24
repmgr.c
24
repmgr.c
@@ -270,7 +270,8 @@ main(int argc, char **argv)
|
||||
|
||||
parse_config(runtime_options.config_file, &options);
|
||||
|
||||
if (need_a_node) {
|
||||
if (need_a_node)
|
||||
{
|
||||
|
||||
if (options.node == -1)
|
||||
{
|
||||
@@ -539,7 +540,8 @@ do_standby_register(void)
|
||||
|
||||
/* check if there is a master in this cluster */
|
||||
master_conn = getMasterConnection(conn, options.node, options.cluster_name, &master_id);
|
||||
if (!master_conn) {
|
||||
if (!master_conn)
|
||||
{
|
||||
log_err(_("A master must be defined before configuring a slave\n"));
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
@@ -886,14 +888,16 @@ do_standby_clone(void)
|
||||
|
||||
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);
|
||||
if (r != 0) {
|
||||
if (r != 0)
|
||||
{
|
||||
log_warning("standby clone: failed copying master control file '%s'\n", master_control_file);
|
||||
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);
|
||||
if (r != 0) {
|
||||
if (r != 0)
|
||||
{
|
||||
log_warning("standby clone: failed copying master data directory '%s'\n", master_data_directory);
|
||||
goto stop_backup;
|
||||
}
|
||||
@@ -916,7 +920,8 @@ do_standby_clone(void)
|
||||
strncpy(tblspc_dir, PQgetvalue(res, i, 0), MAXFILENAME);
|
||||
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) {
|
||||
if (r != 0)
|
||||
{
|
||||
log_warning("standby clone: failed copying tablespace directory '%s'\n", tblspc_dir);
|
||||
goto stop_backup;
|
||||
}
|
||||
@@ -924,21 +929,24 @@ do_standby_clone(void)
|
||||
|
||||
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) {
|
||||
if (r != 0)
|
||||
{
|
||||
log_warning("standby clone: failed copying master config file '%s'\n", master_config_file);
|
||||
goto stop_backup;
|
||||
}
|
||||
|
||||
log_info("standby clone: master hba file '%s'\n", master_hba_file);
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
if (r != 0) {
|
||||
if (r != 0)
|
||||
{
|
||||
log_warning("standby clone: failed copying master ident file '%s'\n", master_ident_file);
|
||||
goto stop_backup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user