mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
I failed to add the schema "repmgr_%s" in all places where the repl_*
tables are used.
This commit is contained in:
4
repmgr.c
4
repmgr.c
@@ -310,7 +310,7 @@ do_master_register(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PQgetisnull(res, 0, 0)) /* schema exists */
|
if (!PQntuples(res) > 0) /* schema exists */
|
||||||
{
|
{
|
||||||
if (!force) /* and we are not forcing so error */
|
if (!force) /* and we are not forcing so error */
|
||||||
{
|
{
|
||||||
@@ -476,7 +476,7 @@ do_standby_register(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PQgetisnull(res, 0, 0)) /* schema doesn't exists */
|
if (PQntuples(res) == 0) /* schema doesn't exists */
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Schema repmgr_%s doesn't exists.", myClusterName);
|
fprintf(stderr, "Schema repmgr_%s doesn't exists.", myClusterName);
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|||||||
18
repmgrd.c
18
repmgrd.c
@@ -234,10 +234,10 @@ MonitorExecute(void)
|
|||||||
* Build the SQL to execute on primary
|
* Build the SQL to execute on primary
|
||||||
*/
|
*/
|
||||||
sprintf(sqlquery,
|
sprintf(sqlquery,
|
||||||
"INSERT INTO repl_monitor "
|
"INSERT INTO repmgr_%s.repl_monitor "
|
||||||
"VALUES(%d, %d, '%s'::timestamp with time zone, "
|
"VALUES(%d, %d, '%s'::timestamp with time zone, "
|
||||||
" '%s', '%s', "
|
" '%s', '%s', "
|
||||||
" %lld, %lld)",
|
" %lld, %lld)", myClusterName,
|
||||||
primaryId, myLocalId, monitor_standby_timestamp,
|
primaryId, myLocalId, monitor_standby_timestamp,
|
||||||
last_wal_primary_location,
|
last_wal_primary_location,
|
||||||
last_wal_standby_received,
|
last_wal_standby_received,
|
||||||
@@ -259,8 +259,10 @@ checkClusterConfiguration(void)
|
|||||||
{
|
{
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
|
|
||||||
res = PQexec(myLocalConn, "SELECT oid FROM pg_class "
|
sprintf(sqlquery, "SELECT oid FROM pg_class "
|
||||||
" WHERE relname = 'repl_nodes'");
|
" WHERE oid = 'repmgr_%s.repl_nodes'::regclass",
|
||||||
|
myClusterName);
|
||||||
|
res = PQexec(myLocalConn, sqlquery);
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "PQexec failed: %s\n", PQerrorMessage(myLocalConn));
|
fprintf(stderr, "PQexec failed: %s\n", PQerrorMessage(myLocalConn));
|
||||||
@@ -295,9 +297,9 @@ checkNodeConfiguration(char *conninfo)
|
|||||||
/*
|
/*
|
||||||
* Check if we have my node information in repl_nodes
|
* Check if we have my node information in repl_nodes
|
||||||
*/
|
*/
|
||||||
sprintf(sqlquery, "SELECT * FROM repl_nodes "
|
sprintf(sqlquery, "SELECT * FROM repmgr_%s.repl_nodes "
|
||||||
" WHERE id = %d AND cluster = '%s' ",
|
" WHERE id = %d AND cluster = '%s' ",
|
||||||
myLocalId, myClusterName);
|
myClusterName, myLocalId, myClusterName);
|
||||||
|
|
||||||
res = PQexec(myLocalConn, sqlquery);
|
res = PQexec(myLocalConn, sqlquery);
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
@@ -317,9 +319,9 @@ checkNodeConfiguration(char *conninfo)
|
|||||||
{
|
{
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
/* Adding the node */
|
/* Adding the node */
|
||||||
sprintf(sqlquery, "INSERT INTO repl_nodes "
|
sprintf(sqlquery, "INSERT INTO repmgr_%s.repl_nodes "
|
||||||
"VALUES (%d, '%s', '%s')",
|
"VALUES (%d, '%s', '%s')",
|
||||||
myLocalId, myClusterName, conninfo);
|
myClusterName, myLocalId, myClusterName, conninfo);
|
||||||
|
|
||||||
if (!PQexec(primaryConn, sqlquery))
|
if (!PQexec(primaryConn, sqlquery))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user