mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
Only attempt to log an event if the rempgr schema has been set
In some circumstances (primarily when executing `repmgr standby clone`) the `repmgr.conf` file is not mandated. However this means the repmgr schema is not known, and any attempt to create an event record will result in a log warning, which may cause confusion as to the success of the operation. It might be better to mandate providing `repmgr.conf` in all circumstances. Per report in https://github.com/2ndQuadrant/repmgr/issues/53 .
This commit is contained in:
@@ -71,7 +71,10 @@ Standby setup
|
|||||||
[2015-03-03 18:18:23] [NOTICE] HINT: You can now start your postgresql server
|
[2015-03-03 18:18:23] [NOTICE] HINT: You can now start your postgresql server
|
||||||
[2015-03-03 18:18:23] [NOTICE] for example : pg_ctl -D /path/to/standby/data start
|
[2015-03-03 18:18:23] [NOTICE] for example : pg_ctl -D /path/to/standby/data start
|
||||||
|
|
||||||
Note that at this point it does not matter if the `repmgr.conf` file is not found.
|
Note that the `repmgr.conf` file is not required when cloning a standby.
|
||||||
|
However we recommend providing a valid `repmgr.conf` if you wish to use
|
||||||
|
replication slots, or want `repmgr` to log the clone event to the
|
||||||
|
`repl_events` table.
|
||||||
|
|
||||||
This will clone the PostgreSQL database files from the master, including its
|
This will clone the PostgreSQL database files from the master, including its
|
||||||
`postgresql.conf` and `pg_hba.conf` files, and additionally automatically create
|
`postgresql.conf` and `pg_hba.conf` files, and additionally automatically create
|
||||||
|
|||||||
@@ -1051,7 +1051,12 @@ create_event_record(PGconn *conn, t_configuration_options *options, int node_id,
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
struct tm ts;
|
struct tm ts;
|
||||||
|
|
||||||
if(conn != NULL)
|
/* Only attempt to write a record if a connection handle was provided/
|
||||||
|
Also check that the repmgr schema has been properly intialised - if
|
||||||
|
not it means no configuration file was provided, which can happen with
|
||||||
|
e.g. `repmgr standby clone`, and we won't know which schema to write to.
|
||||||
|
*/
|
||||||
|
if(conn != NULL && strcmp(repmgr_schema, DEFAULT_REPMGR_SCHEMA_PREFIX) != 0)
|
||||||
{
|
{
|
||||||
int n_node_id = htonl(node_id);
|
int n_node_id = htonl(node_id);
|
||||||
char *t_successful = successful ? "TRUE" : "FALSE";
|
char *t_successful = successful ? "TRUE" : "FALSE";
|
||||||
|
|||||||
Reference in New Issue
Block a user