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:
Ian Barwick
2019-10-23 13:41:47 +09:00
parent be494f0d5f
commit dc11330d58
4 changed files with 16 additions and 16 deletions

View File

@@ -4138,7 +4138,7 @@ create_slot_name(char *slot_name, int node_id)
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;
RecordStatus record_status = RECORD_NOT_FOUND;
@@ -4193,8 +4193,8 @@ create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_ms
slot_name);
}
log_debug(_("create_replication_slot(): creating slot \"%s\" on upstream"), slot_name);
log_verbose(LOG_DEBUG, "create_replication_slot():\n%s", query.data);
log_debug(_("create_replication_slot_sql(): creating slot \"%s\" on upstream"), slot_name);
log_verbose(LOG_DEBUG, "create_replication_slot_sql():\n%s", query.data);
res = PQexec(conn, query.data);
termPQExpBuffer(&query);
@@ -4215,7 +4215,7 @@ create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_ms
bool
drop_replication_slot(PGconn *conn, char *slot_name)
drop_replication_slot_sql(PGconn *conn, char *slot_name)
{
PQExpBufferData query;
PGresult *res = NULL;
@@ -4227,14 +4227,14 @@ drop_replication_slot(PGconn *conn, char *slot_name)
"SELECT pg_catalog.pg_drop_replication_slot('%s')",
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);
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
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);
success = false;

View File

@@ -560,8 +560,8 @@ PGresult *get_event_records(PGconn *conn, int node_id, const char *node_name,
/* replication slot functions */
void create_slot_name(char *slot_name, int node_id);
bool create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_msg);
bool drop_replication_slot(PGconn *conn, char *slot_name);
bool create_replication_slot_sql(PGconn *conn, char *slot_name, PQExpBufferData *error_msg);
bool drop_replication_slot_sql(PGconn *conn, char *slot_name);
RecordStatus get_slot_record(PGconn *conn, char *slot_name, t_replication_slot *record);
int get_free_replication_slot_count(PGconn *conn);
int get_inactive_replication_slots(PGconn *conn, KeyValueList *list);

View File

@@ -650,7 +650,7 @@ do_standby_clone(void)
/* If a replication slot was previously created, drop it */
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"));
@@ -1325,7 +1325,7 @@ _do_create_recovery_conf(void)
PQExpBufferData msg;
initPQExpBuffer(&msg);
if (create_replication_slot(upstream_conn,
if (create_replication_slot_sql(upstream_conn,
local_node_record.slot_name,
&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,
output) == false)
{
@@ -5828,7 +5828,7 @@ initialise_direct_clone(t_node_info *node_record)
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);
@@ -6114,7 +6114,7 @@ run_basebackup(t_node_info *node_record)
get_superuser_connection(&upstream_conn, &superuser_conn, &privileged_conn);
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);
@@ -6151,7 +6151,7 @@ run_basebackup(t_node_info *node_record)
{
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);
}
@@ -6696,7 +6696,7 @@ stop_backup:
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_detail("%s", errmsg.data);

View File

@@ -3622,7 +3622,7 @@ drop_replication_slot_if_exists(PGconn *conn, int node_id, char *slot_name)
{
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);
}