mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
need to provide the follow target node record for node follow internal
otherwise fails when using a dedicated replication user. WIP.
This commit is contained in:
@@ -3348,10 +3348,9 @@ do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_n
|
|||||||
update_node_record_slot_name(primary_conn, config_file_options.node_id, local_node_record.slot_name);
|
update_node_record_slot_name(primary_conn, config_file_options.node_id, local_node_record.slot_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (create_replication_slot(follow_target_conn,
|
if (create_replication_slot(follow_target_conn,
|
||||||
local_node_record.slot_name,
|
local_node_record.slot_name,
|
||||||
NULL,
|
follow_target_node_record,
|
||||||
output) == false)
|
output) == false)
|
||||||
{
|
{
|
||||||
log_error("%s", output->data);
|
log_error("%s", output->data);
|
||||||
|
|||||||
@@ -97,14 +97,15 @@ static t_user_type ReplicationSlotUser = USER_TYPE_UNKNOWN;
|
|||||||
static ItemList cli_errors = {NULL, NULL};
|
static ItemList cli_errors = {NULL, NULL};
|
||||||
static ItemList cli_warnings = {NULL, NULL};
|
static ItemList cli_warnings = {NULL, NULL};
|
||||||
|
|
||||||
static PGconn *_get_replication_slot_connection(PGconn *conn,
|
|
||||||
char *replication_user,
|
|
||||||
bool *use_replication_protocol);
|
|
||||||
|
|
||||||
static void _determine_replication_slot_user(PGconn *conn,
|
static void _determine_replication_slot_user(PGconn *conn,
|
||||||
t_node_info *upstream_node_record,
|
t_node_info *upstream_node_record,
|
||||||
char **replication_user);
|
char **replication_user);
|
||||||
|
|
||||||
|
static PGconn *_get_replication_slot_connection(PGconn *conn,
|
||||||
|
char *replication_user,
|
||||||
|
bool *use_replication_protocol);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -3755,7 +3756,7 @@ create_replication_slot(PGconn *conn, char *slot_name, t_node_info *upstream_nod
|
|||||||
case USER_TYPE_UNKNOWN:
|
case USER_TYPE_UNKNOWN:
|
||||||
log_error("unable to determine user for replication slot creation");
|
log_error("unable to determine user for replication slot creation");
|
||||||
return false;
|
return false;
|
||||||
case REPMGR_USER:
|
case REPMGR_USER:
|
||||||
log_info(_("replication slots will be created by user \"%s\""),
|
log_info(_("replication slots will be created by user \"%s\""),
|
||||||
PQuser(conn));
|
PQuser(conn));
|
||||||
return true;
|
return true;
|
||||||
@@ -3874,6 +3875,10 @@ drop_replication_slot_if_exists(PGconn *conn, int node_id, char *slot_name)
|
|||||||
bool use_replication_protocol = false;
|
bool use_replication_protocol = false;
|
||||||
PGconn *slot_conn = NULL;
|
PGconn *slot_conn = NULL;
|
||||||
|
|
||||||
|
slot_conn = _get_replication_slot_connection(conn,
|
||||||
|
replication_user,
|
||||||
|
&use_replication_protocol);
|
||||||
|
|
||||||
if (use_replication_protocol == true)
|
if (use_replication_protocol == true)
|
||||||
{
|
{
|
||||||
success = drop_replication_slot_replprot(conn, slot_name);
|
success = drop_replication_slot_replprot(conn, slot_name);
|
||||||
@@ -3955,6 +3960,15 @@ _determine_replication_slot_user(PGconn *conn, t_node_info *upstream_node_record
|
|||||||
ReplicationSlotUser = REPLICATION_USER_NODE;
|
ReplicationSlotUser = REPLICATION_USER_NODE;
|
||||||
*replication_user = upstream_node_record->repluser;
|
*replication_user = upstream_node_record->repluser;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* This should never happen */
|
||||||
|
log_error("unable to determine replication slot user");
|
||||||
|
if (upstream_node_record != NULL)
|
||||||
|
log_debug("%i %s %s", upstream_node_record->node_id, upstream_node_record->repluser, PQuser(conn));
|
||||||
|
else
|
||||||
|
log_debug("upstream_node_record not provided");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user