mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Fix witness server initialisation
This commit is contained in:
11
dbutils.c
11
dbutils.c
@@ -1227,7 +1227,8 @@ witness_copy_node_records(PGconn *masterconn, PGconn *witnessconn, char *cluster
|
|||||||
|
|
||||||
/* Get current records from primary */
|
/* Get current records from primary */
|
||||||
sqlquery_snprintf(sqlquery,
|
sqlquery_snprintf(sqlquery,
|
||||||
"SELECT id, type, upstream_node_id, name, conninfo, priority, slot_name, active FROM %s.repl_nodes",
|
"SELECT id, type, upstream_node_id, name, conninfo, priority, slot_name, active "
|
||||||
|
" FROM %s.repl_nodes",
|
||||||
get_repmgr_schema_quoted(masterconn));
|
get_repmgr_schema_quoted(masterconn));
|
||||||
|
|
||||||
log_verbose(LOG_DEBUG, "witness_copy_node_records():\n%s\n", sqlquery);
|
log_verbose(LOG_DEBUG, "witness_copy_node_records():\n%s\n", sqlquery);
|
||||||
@@ -1263,11 +1264,11 @@ witness_copy_node_records(PGconn *masterconn, PGconn *witnessconn, char *cluster
|
|||||||
cluster_name,
|
cluster_name,
|
||||||
PQgetvalue(res, i, 3),
|
PQgetvalue(res, i, 3),
|
||||||
PQgetvalue(res, i, 4),
|
PQgetvalue(res, i, 4),
|
||||||
atoi(PQgetvalue(res, i, 6)),
|
atoi(PQgetvalue(res, i, 5)),
|
||||||
strlen(PQgetvalue(res, i, 7))
|
strlen(PQgetvalue(res, i, 6))
|
||||||
? PQgetvalue(res, i, 7)
|
? PQgetvalue(res, i, 6)
|
||||||
: NULL,
|
: NULL,
|
||||||
(strcmp(PQgetvalue(res, i, 8), "t") == 0)
|
(strcmp(PQgetvalue(res, i, 7), "t") == 0)
|
||||||
? true
|
? true
|
||||||
: false
|
: false
|
||||||
);
|
);
|
||||||
|
|||||||
16
repmgr.c
16
repmgr.c
@@ -5875,7 +5875,7 @@ do_witness_create(void)
|
|||||||
options.pg_ctl_options, runtime_options.dest_dir);
|
options.pg_ctl_options, runtime_options.dest_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info(_("reloading witness server configuration: %s"), script);
|
log_info(_("reloading witness server configuration: %s\n"), script);
|
||||||
r = system(script);
|
r = system(script);
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
@@ -6939,7 +6939,7 @@ create_schema(PGconn *conn)
|
|||||||
|
|
||||||
/* create schema */
|
/* create schema */
|
||||||
sqlquery_snprintf(sqlquery, "CREATE SCHEMA %s", get_repmgr_schema_quoted(conn));
|
sqlquery_snprintf(sqlquery, "CREATE SCHEMA %s", get_repmgr_schema_quoted(conn));
|
||||||
log_debug(_("master register: %s\n"), sqlquery);
|
log_debug(_("create_schema: %s\n"), sqlquery);
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
{
|
{
|
||||||
@@ -7019,7 +7019,7 @@ create_schema(PGconn *conn)
|
|||||||
get_repmgr_schema_quoted(conn),
|
get_repmgr_schema_quoted(conn),
|
||||||
get_repmgr_schema_quoted(conn));
|
get_repmgr_schema_quoted(conn));
|
||||||
|
|
||||||
log_debug(_("master register: %s\n"), sqlquery);
|
log_debug(_("create_schema: %s\n"), sqlquery);
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
{
|
{
|
||||||
@@ -7046,7 +7046,7 @@ create_schema(PGconn *conn)
|
|||||||
" replication_lag BIGINT NOT NULL, "
|
" replication_lag BIGINT NOT NULL, "
|
||||||
" apply_lag BIGINT NOT NULL) ",
|
" apply_lag BIGINT NOT NULL) ",
|
||||||
get_repmgr_schema_quoted(conn));
|
get_repmgr_schema_quoted(conn));
|
||||||
log_debug(_("master register: %s\n"), sqlquery);
|
log_debug(_("create_schema: %s\n"), sqlquery);
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
{
|
{
|
||||||
@@ -7072,7 +7072,7 @@ create_schema(PGconn *conn)
|
|||||||
" ) ",
|
" ) ",
|
||||||
get_repmgr_schema_quoted(conn));
|
get_repmgr_schema_quoted(conn));
|
||||||
|
|
||||||
log_debug(_("master register: %s\n"), sqlquery);
|
log_debug(_("create_schema: %s\n"), sqlquery);
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
{
|
{
|
||||||
@@ -7108,7 +7108,7 @@ create_schema(PGconn *conn)
|
|||||||
get_repmgr_schema_quoted(conn),
|
get_repmgr_schema_quoted(conn),
|
||||||
get_repmgr_schema_quoted(conn),
|
get_repmgr_schema_quoted(conn),
|
||||||
get_repmgr_schema_quoted(conn));
|
get_repmgr_schema_quoted(conn));
|
||||||
log_debug(_("master register: %s\n"), sqlquery);
|
log_debug(_("create_schema: %s\n"), sqlquery);
|
||||||
|
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
@@ -7130,7 +7130,7 @@ create_schema(PGconn *conn)
|
|||||||
" ON %s.repl_monitor (last_monitor_time, standby_node) ",
|
" ON %s.repl_monitor (last_monitor_time, standby_node) ",
|
||||||
get_repmgr_schema_quoted(conn));
|
get_repmgr_schema_quoted(conn));
|
||||||
|
|
||||||
log_debug(_("master register: %s\n"), sqlquery);
|
log_debug(_("create_schema: %s\n"), sqlquery);
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
{
|
{
|
||||||
@@ -7158,7 +7158,7 @@ create_schema(PGconn *conn)
|
|||||||
get_repmgr_schema_quoted(conn),
|
get_repmgr_schema_quoted(conn),
|
||||||
get_repmgr_schema_quoted(conn));
|
get_repmgr_schema_quoted(conn));
|
||||||
|
|
||||||
log_debug(_("master register: %s\n"), sqlquery);
|
log_debug(_("create_schema: %s\n"), sqlquery);
|
||||||
|
|
||||||
res = PQexec(conn, sqlquery);
|
res = PQexec(conn, sqlquery);
|
||||||
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
|
|||||||
Reference in New Issue
Block a user