mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-28 01:16:29 +00:00
We shouldn't terminate with an error if no event record could be created
Event records are advisory and non-critical; there may be paths where we're not able to connect to a valid master and hence unable to write a record. (If an 'event_notification_command' is defined, this should serve as a backup notification of the event).
This commit is contained in:
36
repmgr.c
36
repmgr.c
@@ -775,21 +775,14 @@ do_master_register(void)
|
||||
exit(ERR_DB_QUERY);
|
||||
}
|
||||
|
||||
|
||||
/* Log the event */
|
||||
record_created = create_event_record(conn,
|
||||
create_event_record(conn,
|
||||
&options,
|
||||
options.node,
|
||||
"master_register",
|
||||
true,
|
||||
NULL);
|
||||
|
||||
if(record_created == false)
|
||||
{
|
||||
PQfinish(conn);
|
||||
exit(ERR_DB_QUERY);
|
||||
}
|
||||
|
||||
PQfinish(conn);
|
||||
|
||||
log_notice(_("master node correctly registered for cluster %s with id %d (conninfo: %s)\n"),
|
||||
@@ -889,20 +882,13 @@ do_standby_register(void)
|
||||
}
|
||||
|
||||
/* Log the event */
|
||||
record_created = create_event_record(master_conn,
|
||||
create_event_record(master_conn,
|
||||
&options,
|
||||
options.node,
|
||||
"standby_register",
|
||||
true,
|
||||
NULL);
|
||||
|
||||
if(record_created == false)
|
||||
{
|
||||
PQfinish(master_conn);
|
||||
PQfinish(conn);
|
||||
exit(ERR_DB_QUERY);
|
||||
}
|
||||
|
||||
PQfinish(master_conn);
|
||||
PQfinish(conn);
|
||||
|
||||
@@ -1547,7 +1533,6 @@ do_standby_promote(void)
|
||||
promote_check_interval = 2;
|
||||
bool promote_sucess = false;
|
||||
bool success;
|
||||
bool record_created;
|
||||
|
||||
/* We need to connect to check configuration */
|
||||
log_info(_("connecting to standby database\n"));
|
||||
@@ -1635,7 +1620,7 @@ do_standby_promote(void)
|
||||
"Node %i could not be promoted to master",
|
||||
options.node);
|
||||
|
||||
record_created = create_event_record(old_master_conn,
|
||||
create_event_record(old_master_conn,
|
||||
&options,
|
||||
options.node,
|
||||
"standby_promote",
|
||||
@@ -1656,7 +1641,7 @@ do_standby_promote(void)
|
||||
|
||||
log_notice(_("STANDBY PROMOTE successful. You should REINDEX any hash indexes you have.\n"));
|
||||
/* Log the event */
|
||||
record_created = create_event_record(conn,
|
||||
create_event_record(conn,
|
||||
&options,
|
||||
options.node,
|
||||
"standby_promote",
|
||||
@@ -1667,11 +1652,6 @@ do_standby_promote(void)
|
||||
PQfinish(old_master_conn);
|
||||
PQfinish(conn);
|
||||
|
||||
if(record_created == false)
|
||||
{
|
||||
exit(ERR_DB_QUERY);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2188,19 +2168,13 @@ do_witness_create(void)
|
||||
}
|
||||
|
||||
/* Log the event */
|
||||
record_created = create_event_record(masterconn,
|
||||
create_event_record(masterconn,
|
||||
&options,
|
||||
options.node,
|
||||
"witness_create",
|
||||
true,
|
||||
NULL);
|
||||
|
||||
if(record_created == false)
|
||||
{
|
||||
PQfinish(masterconn);
|
||||
exit(ERR_DB_QUERY);
|
||||
}
|
||||
|
||||
PQfinish(masterconn);
|
||||
PQfinish(witnessconn);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user