repmgrd: log startup on primary

This commit is contained in:
Ian Barwick
2017-06-24 08:44:19 +09:00
parent 27ad7b4f79
commit b64581c582
2 changed files with 23 additions and 6 deletions

View File

@@ -685,8 +685,8 @@ do_standby_register(void)
RecordStatus upstream_record_status; RecordStatus upstream_record_status;
upstream_record_status = get_node_record(primary_conn, upstream_record_status = get_node_record(primary_conn,
config_file_options.upstream_node_id, config_file_options.upstream_node_id,
&node_record); &node_record);
if (upstream_record_status != RECORD_FOUND) if (upstream_record_status != RECORD_FOUND)
{ {

View File

@@ -29,6 +29,8 @@ static PGconn *primary_conn = NULL;
/* Collate command line errors here for friendlier reporting */ /* Collate command line errors here for friendlier reporting */
static ItemList cli_errors = { NULL, NULL }; static ItemList cli_errors = { NULL, NULL };
static bool startup_event_logged = false;
/* /*
* Record receipt SIGHUP; will cause configuration file to be reread at the * Record receipt SIGHUP; will cause configuration file to be reread at the
* appropriate point in the main loop. * appropriate point in the main loop.
@@ -363,8 +365,6 @@ main(int argc, char **argv)
setup_event_handlers(); setup_event_handlers();
#endif #endif
start_monitoring(); start_monitoring();
logger_shutdown(); logger_shutdown();
@@ -377,7 +377,7 @@ static void
start_monitoring(void) start_monitoring(void)
{ {
log_notice(_("starting monitoring of node %s (ID: %i"), log_notice(_("starting monitoring of node %s (ID: %i)"),
local_node_info.node_name, local_node_info.node_name,
local_node_info.node_id); local_node_info.node_id);
@@ -405,8 +405,25 @@ start_monitoring(void)
static void static void
monitor_streaming_primary(void) monitor_streaming_primary(void)
{ {
/* Log startup event */
if (startup_event_logged == false)
{
create_event_record(local_conn,
&config_file_options,
config_file_options.node_id,
"repmgrd_start",
true,
NULL);
startup_event_logged = true;
// XXX add more detail
log_notice(_("monitoring cluster master"));
}
while (true) while (true)
{ {
sleep(1); sleep(1);
} }
} }
@@ -478,7 +495,7 @@ daemonize_process(void)
*path = '/'; *path = '/';
} }
log_info("dir now %s", path); log_debug("dir now %s", path);
ret = chdir(path); ret = chdir(path);
if (ret != 0) if (ret != 0)
{ {