mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Rename replication slot create/drop functions
Append "_sql" to the respective function names, as we'll later be creating equivalent functions which use the replication protocol so need a way to distinguish between them.
This commit is contained in:
12
dbutils.c
12
dbutils.c
@@ -4138,7 +4138,7 @@ create_slot_name(char *slot_name, int node_id)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_msg)
|
create_replication_slot_sql(PGconn *conn, char *slot_name, PQExpBufferData *error_msg)
|
||||||
{
|
{
|
||||||
PQExpBufferData query;
|
PQExpBufferData query;
|
||||||
RecordStatus record_status = RECORD_NOT_FOUND;
|
RecordStatus record_status = RECORD_NOT_FOUND;
|
||||||
@@ -4193,8 +4193,8 @@ create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_ms
|
|||||||
slot_name);
|
slot_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug(_("create_replication_slot(): creating slot \"%s\" on upstream"), slot_name);
|
log_debug(_("create_replication_slot_sql(): creating slot \"%s\" on upstream"), slot_name);
|
||||||
log_verbose(LOG_DEBUG, "create_replication_slot():\n%s", query.data);
|
log_verbose(LOG_DEBUG, "create_replication_slot_sql():\n%s", query.data);
|
||||||
|
|
||||||
res = PQexec(conn, query.data);
|
res = PQexec(conn, query.data);
|
||||||
termPQExpBuffer(&query);
|
termPQExpBuffer(&query);
|
||||||
@@ -4215,7 +4215,7 @@ create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_ms
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
drop_replication_slot(PGconn *conn, char *slot_name)
|
drop_replication_slot_sql(PGconn *conn, char *slot_name)
|
||||||
{
|
{
|
||||||
PQExpBufferData query;
|
PQExpBufferData query;
|
||||||
PGresult *res = NULL;
|
PGresult *res = NULL;
|
||||||
@@ -4227,14 +4227,14 @@ drop_replication_slot(PGconn *conn, char *slot_name)
|
|||||||
"SELECT pg_catalog.pg_drop_replication_slot('%s')",
|
"SELECT pg_catalog.pg_drop_replication_slot('%s')",
|
||||||
slot_name);
|
slot_name);
|
||||||
|
|
||||||
log_verbose(LOG_DEBUG, "drop_replication_slot():\n %s", query.data);
|
log_verbose(LOG_DEBUG, "drop_replication_slot_sql():\n %s", query.data);
|
||||||
|
|
||||||
res = PQexec(conn, query.data);
|
res = PQexec(conn, query.data);
|
||||||
|
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
{
|
{
|
||||||
log_db_error(conn, query.data,
|
log_db_error(conn, query.data,
|
||||||
_("drop_replication_slot(): unable to drop replication slot \"%s\""),
|
_("drop_replication_slot_sql(): unable to drop replication slot \"%s\""),
|
||||||
slot_name);
|
slot_name);
|
||||||
|
|
||||||
success = false;
|
success = false;
|
||||||
|
|||||||
@@ -560,8 +560,8 @@ PGresult *get_event_records(PGconn *conn, int node_id, const char *node_name,
|
|||||||
|
|
||||||
/* replication slot functions */
|
/* replication slot functions */
|
||||||
void create_slot_name(char *slot_name, int node_id);
|
void create_slot_name(char *slot_name, int node_id);
|
||||||
bool create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_msg);
|
bool create_replication_slot_sql(PGconn *conn, char *slot_name, PQExpBufferData *error_msg);
|
||||||
bool drop_replication_slot(PGconn *conn, char *slot_name);
|
bool drop_replication_slot_sql(PGconn *conn, char *slot_name);
|
||||||
RecordStatus get_slot_record(PGconn *conn, char *slot_name, t_replication_slot *record);
|
RecordStatus get_slot_record(PGconn *conn, char *slot_name, t_replication_slot *record);
|
||||||
int get_free_replication_slot_count(PGconn *conn);
|
int get_free_replication_slot_count(PGconn *conn);
|
||||||
int get_inactive_replication_slots(PGconn *conn, KeyValueList *list);
|
int get_inactive_replication_slots(PGconn *conn, KeyValueList *list);
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ do_standby_clone(void)
|
|||||||
/* If a replication slot was previously created, drop it */
|
/* If a replication slot was previously created, drop it */
|
||||||
if (config_file_options.use_replication_slots == true)
|
if (config_file_options.use_replication_slots == true)
|
||||||
{
|
{
|
||||||
drop_replication_slot(source_conn, local_node_record.slot_name);
|
drop_replication_slot_sql(source_conn, local_node_record.slot_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_error(_("unable to take a base backup of the primary server"));
|
log_error(_("unable to take a base backup of the primary server"));
|
||||||
@@ -1325,7 +1325,7 @@ _do_create_recovery_conf(void)
|
|||||||
PQExpBufferData msg;
|
PQExpBufferData msg;
|
||||||
initPQExpBuffer(&msg);
|
initPQExpBuffer(&msg);
|
||||||
|
|
||||||
if (create_replication_slot(upstream_conn,
|
if (create_replication_slot_sql(upstream_conn,
|
||||||
local_node_record.slot_name,
|
local_node_record.slot_name,
|
||||||
&msg) == false)
|
&msg) == false)
|
||||||
{
|
{
|
||||||
@@ -3070,7 +3070,7 @@ do_standby_follow_internal(PGconn *primary_conn, PGconn *follow_target_conn, t_n
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (create_replication_slot(follow_target_conn,
|
if (create_replication_slot_sql(follow_target_conn,
|
||||||
local_node_record.slot_name,
|
local_node_record.slot_name,
|
||||||
output) == false)
|
output) == false)
|
||||||
{
|
{
|
||||||
@@ -5828,7 +5828,7 @@ initialise_direct_clone(t_node_info *node_record)
|
|||||||
|
|
||||||
get_superuser_connection(&source_conn, &superuser_conn, &privileged_conn);
|
get_superuser_connection(&source_conn, &superuser_conn, &privileged_conn);
|
||||||
|
|
||||||
if (create_replication_slot(privileged_conn, node_record->slot_name, &event_details) == false)
|
if (create_replication_slot_sql(privileged_conn, node_record->slot_name, &event_details) == false)
|
||||||
{
|
{
|
||||||
log_error("%s", event_details.data);
|
log_error("%s", event_details.data);
|
||||||
|
|
||||||
@@ -6114,7 +6114,7 @@ run_basebackup(t_node_info *node_record)
|
|||||||
get_superuser_connection(&upstream_conn, &superuser_conn, &privileged_conn);
|
get_superuser_connection(&upstream_conn, &superuser_conn, &privileged_conn);
|
||||||
|
|
||||||
initPQExpBuffer(&event_details);
|
initPQExpBuffer(&event_details);
|
||||||
if (create_replication_slot(privileged_conn, node_record->slot_name, &event_details) == false)
|
if (create_replication_slot_sql(privileged_conn, node_record->slot_name, &event_details) == false)
|
||||||
{
|
{
|
||||||
log_error("%s", event_details.data);
|
log_error("%s", event_details.data);
|
||||||
|
|
||||||
@@ -6151,7 +6151,7 @@ run_basebackup(t_node_info *node_record)
|
|||||||
{
|
{
|
||||||
if (slot_exists_on_upstream == false)
|
if (slot_exists_on_upstream == false)
|
||||||
{
|
{
|
||||||
if (drop_replication_slot(privileged_conn, node_record->slot_name) == true)
|
if (drop_replication_slot_sql(privileged_conn, node_record->slot_name) == true)
|
||||||
{
|
{
|
||||||
log_notice(_("replication slot \"%s\" deleted on source node"), node_record->slot_name);
|
log_notice(_("replication slot \"%s\" deleted on source node"), node_record->slot_name);
|
||||||
}
|
}
|
||||||
@@ -6696,7 +6696,7 @@ stop_backup:
|
|||||||
|
|
||||||
initPQExpBuffer(&errmsg);
|
initPQExpBuffer(&errmsg);
|
||||||
|
|
||||||
if (create_replication_slot(upstream_conn, node_record->slot_name, &errmsg) == false)
|
if (create_replication_slot_sql(upstream_conn, node_record->slot_name, &errmsg) == false)
|
||||||
{
|
{
|
||||||
log_error(_("unable to create replication slot on upstream node %i"), upstream_node_id);
|
log_error(_("unable to create replication slot on upstream node %i"), upstream_node_id);
|
||||||
log_detail("%s", errmsg.data);
|
log_detail("%s", errmsg.data);
|
||||||
|
|||||||
@@ -3622,7 +3622,7 @@ drop_replication_slot_if_exists(PGconn *conn, int node_id, char *slot_name)
|
|||||||
{
|
{
|
||||||
if (slot_info.active == false)
|
if (slot_info.active == false)
|
||||||
{
|
{
|
||||||
if (drop_replication_slot(conn, slot_name) == true)
|
if (drop_replication_slot_sql(conn, slot_name) == true)
|
||||||
{
|
{
|
||||||
log_notice(_("replication slot \"%s\" deleted on node %i"), slot_name, node_id);
|
log_notice(_("replication slot \"%s\" deleted on node %i"), slot_name, node_id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user