diff --git a/configfile.c b/configfile.c index b7eb5631..e8014c4d 100644 --- a/configfile.c +++ b/configfile.c @@ -221,7 +221,10 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * /* Initialize configuration options with sensible defaults */ - /* node information */ + /*----------------- + * node information + *----------------- + */ options->node_id = UNKNOWN_NODE_ID; memset(options->node_name, 0, sizeof(options->node_name)); memset(options->conninfo, 0, sizeof(options->conninfo)); @@ -229,18 +232,21 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * memset(options->pg_bindir, 0, sizeof(options->pg_bindir)); options->replication_type = REPLICATION_TYPE_PHYSICAL; - /* + /*------------- * log settings * * note: the default for "log_level" is set in log.c and does not need * to be initialised here + *------------- */ memset(options->log_facility, 0, sizeof(options->log_facility)); memset(options->log_file, 0, sizeof(options->log_file)); options->log_status_interval = DEFAULT_LOG_STATUS_INTERVAL; - /* standby action settings - * ----------------------- */ + /*----------------------- + * standby action settings + *------------------------ + */ options->use_replication_slots = false; memset(options->rsync_options, 0, sizeof(options->rsync_options)); memset(options->ssh_options, 0, sizeof(options->ssh_options)); @@ -253,8 +259,10 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * memset(options->recovery_min_apply_delay, 0, sizeof(options->recovery_min_apply_delay)); options->use_primary_conninfo_password = false; - /* repmgrd settings - * ---------------- */ + /*----------------- + * repmgrd settings + *----------------- + */ options->failover = FAILOVER_MANUAL; options->priority = DEFAULT_PRIORITY; memset(options->location, 0, sizeof(options->location)); @@ -271,13 +279,17 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * options->primary_notification_timeout = DEFAULT_PRIMARY_NOTIFICATION_TIMEOUT; options->primary_follow_timeout = DEFAULT_PRIMARY_FOLLOW_TIMEOUT; - /* BDR settings - * ------------ */ + /*------------- + * BDR settings + *------------- + */ options->bdr_local_monitoring_only = false; options->bdr_recovery_timeout = DEFAULT_BDR_RECOVERY_TIMEOUT; - /* service settings - * ---------------- */ + /*----------------- + * service settings + *----------------- + */ memset(options->pg_ctl_options, 0, sizeof(options->pg_ctl_options)); memset(options->service_stop_command, 0, sizeof(options->service_stop_command)); memset(options->service_start_command, 0, sizeof(options->service_start_command)); @@ -285,19 +297,25 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * memset(options->service_reload_command, 0, sizeof(options->service_reload_command)); memset(options->service_promote_command, 0, sizeof(options->service_promote_command)); - /* event notification settings - * --------------------------- */ + /*---------------------------- + * event notification settings + *---------------------------- + */ memset(options->event_notification_command, 0, sizeof(options->event_notification_command)); options->event_notifications.head = NULL; options->event_notifications.tail = NULL; - /* barman settings */ - /* --------------- */ + /*---------------- + * barman settings + * --------------- + */ memset(options->barman_server, 0, sizeof(options->barman_server)); memset(options->barman_config, 0, sizeof(options->barman_config)); - /* undocumented test settings */ - /* -------------------------- */ + /*--------------------------- + * undocumented test settings + *--------------------------- + */ options->promote_delay = 0; /* diff --git a/repmgr-client.c b/repmgr-client.c index 6f671290..45407e5e 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -209,8 +209,10 @@ main(int argc, char **argv) printf("%s %s\n", progname(), REPMGR_VERSION); exit(SUCCESS); - /* general configuration options - * ----------------------------- */ + /*------------------------------ + * general configuration options + *------------------------------ + */ /* -b/--pg_bindir */ case 'b': @@ -242,8 +244,10 @@ main(int argc, char **argv) runtime_options.wait = true; break; - /* database connection options */ - /* --------------------------- */ + /*---------------------------- + * database connection options + *---------------------------- + */ /* * These are the standard database connection options; with the @@ -283,8 +287,10 @@ main(int argc, char **argv) runtime_options.connection_param_provided = true; break; - /* other connection options */ - /* ------------------------ */ + /*------------------------- + * other connection options + *------------------------- + */ /* -R/--remote_user */ case 'R': @@ -296,8 +302,10 @@ main(int argc, char **argv) strncpy(runtime_options.superuser, optarg, MAXLEN); break; - /* node options * - * ------------ */ + /*------------- + * node options + *------------- + */ /* -D/--pgdata/--data-dir */ case 'D': @@ -322,8 +330,10 @@ main(int argc, char **argv) runtime_options.upstream_node_id = repmgr_atoi(optarg, "--upstream-node-id", &cli_errors, false); break; - /* "standby clone" options * - * ----------------------- */ + /*------------------------ + * "standby clone" options + *------------------------ + */ /* -c/--fast-checkpoint */ case 'c': @@ -366,8 +376,10 @@ main(int argc, char **argv) runtime_options.without_barman = true; break; - /* "standby register" options * - * -------------------------- */ + /*--------------------------- + * "standby register" options + *--------------------------- + */ case OPT_REGISTER_WAIT: runtime_options.wait_register_sync = true; @@ -377,8 +389,10 @@ main(int argc, char **argv) } break; - /* "standby switchover" options * - * ---------------------------- */ + /*----------------------------- + * "standby switchover" options + *----------------------------- + */ case OPT_ALWAYS_PROMOTE: runtime_options.always_promote = true; @@ -392,15 +406,19 @@ main(int argc, char **argv) runtime_options.siblings_follow = true; break; - /* "node status" options * - * --------------------- */ + /*---------------------- + * "node status" options + *---------------------- + */ case OPT_IS_SHUTDOWN_CLEANLY: runtime_options.is_shutdown_cleanly = true; break; - /* "node check" options * - * --------------------- */ + /*--------------------- + * "node check" options + *-------------------- + */ case OPT_ARCHIVE_READY: runtime_options.archive_ready = true; break; @@ -421,14 +439,24 @@ main(int argc, char **argv) runtime_options.slots = true; break; - /* "node join" options * - * ------------------- */ + /*-------------------- + * "node rejoin" options + *-------------------- + */ case OPT_CONFIG_FILES: strncpy(runtime_options.config_files, optarg, MAXLEN); break; - /* "node service" options * - * ---------------------- */ + /* internal options */ + case OPT_CONFIG_ARCHIVE_DIR: + /* TODO: check this is an absolute path */ + strncpy(runtime_options.config_archive_dir, optarg, MAXPGPATH); + break; + + /*----------------------- + * "node service" options + *----------------------- + */ /* --action (repmgr node service --action) */ case OPT_ACTION: @@ -447,8 +475,10 @@ main(int argc, char **argv) runtime_options.checkpoint = true; break; - /* "cluster event" options * - * ----------------------- */ + /*------------------------ + * "cluster event" options + *------------------------ + */ case OPT_EVENT: strncpy(runtime_options.event, optarg, MAXLEN); @@ -463,10 +493,10 @@ main(int argc, char **argv) runtime_options.all = true; break; - - - /* logging options * - * --------------- */ + /*---------------- + * logging options + *---------------- + */ /* -L/--log-level */ case 'L': @@ -504,8 +534,10 @@ main(int argc, char **argv) break; - /* output options */ - /* -------------- */ + /*-------------- + * output options + *--------------- + */ case OPT_CSV: runtime_options.csv = true; break; @@ -518,14 +550,10 @@ main(int argc, char **argv) runtime_options.optformat = true; break; - /* internal options */ - case OPT_CONFIG_ARCHIVE_DIR: - /* TODO: check this is an absolute path */ - strncpy(runtime_options.config_archive_dir, optarg, MAXPGPATH); - break; - - /* options deprecated since 3.3 * - * ---------------------------- */ + /*----------------------------- + * options deprecated since 3.3 + *----------------------------- + */ case OPT_DATA_DIR: item_list_append(&cli_warnings, _("--data-dir is deprecated; use -D/--pgdata instead"));