mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Disallow witness on primary cluster
This commit is contained in:
@@ -173,11 +173,24 @@ do_witness_register(void)
|
|||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Sanity check witness node is not part of main cluster. */
|
||||||
* TODO: sanity check witness node is not part of main cluster; we could
|
if (PQserverVersion(primary_conn) >= 90600 &&
|
||||||
* add a random application_name to the respective connections,
|
PQserverVersion(witness_conn) >= 90600)
|
||||||
* and do a simple check of pg_stat_activity
|
{
|
||||||
*/
|
uint64 primary_system_identifier = system_identifier(primary_conn);
|
||||||
|
uint64 witness_system_identifier = system_identifier(witness_conn);
|
||||||
|
|
||||||
|
if (primary_system_identifier == witness_system_identifier &&
|
||||||
|
primary_system_identifier != UNKNOWN_SYSTEM_IDENTIFIER)
|
||||||
|
{
|
||||||
|
log_error(_("witness node cannot be in the same cluster as the primary node"));
|
||||||
|
log_detail(_("primary id: %lu\n witness id: %lu"), primary_system_identifier, witness_system_identifier);
|
||||||
|
PQfinish(witness_conn);
|
||||||
|
PQfinish(primary_conn);
|
||||||
|
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* check that primary node is not a BDR node */
|
/* check that primary node is not a BDR node */
|
||||||
if (is_bdr_db_quiet(primary_conn) == true)
|
if (is_bdr_db_quiet(primary_conn) == true)
|
||||||
|
|||||||
Reference in New Issue
Block a user