mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
Simplify function create_replication_slot()
Following the changes in 793d83b, it's no longer necessary to
pass the server version number.
This commit is contained in:
@@ -3937,7 +3937,7 @@ create_slot_name(char *slot_name, int node_id)
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
create_replication_slot(PGconn *conn, char *slot_name, int server_version_num, PQExpBufferData *error_msg)
|
create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_msg)
|
||||||
{
|
{
|
||||||
PQExpBufferData query;
|
PQExpBufferData query;
|
||||||
RecordStatus record_status = RECORD_NOT_FOUND;
|
RecordStatus record_status = RECORD_NOT_FOUND;
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ 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, int server_version_num, PQExpBufferData *error_msg);
|
bool create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_msg);
|
||||||
bool drop_replication_slot(PGconn *conn, char *slot_name);
|
bool drop_replication_slot(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);
|
||||||
|
|||||||
@@ -1189,7 +1189,6 @@ _do_create_recovery_conf(void)
|
|||||||
|
|
||||||
if (create_replication_slot(upstream_conn,
|
if (create_replication_slot(upstream_conn,
|
||||||
local_node_record.slot_name,
|
local_node_record.slot_name,
|
||||||
UNKNOWN_SERVER_VERSION_NUM,
|
|
||||||
&msg) == false)
|
&msg) == false)
|
||||||
{
|
{
|
||||||
log_error("%s", msg.data);
|
log_error("%s", msg.data);
|
||||||
@@ -2574,8 +2573,6 @@ do_standby_follow_internal(PGconn *primary_conn, t_node_info *primary_node_recor
|
|||||||
|
|
||||||
if (config_file_options.use_replication_slots)
|
if (config_file_options.use_replication_slots)
|
||||||
{
|
{
|
||||||
int primary_server_version_num = PQserverVersion(primary_conn);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Here we add a sanity check for the "slot_name" field - it's possible
|
* Here we add a sanity check for the "slot_name" field - it's possible
|
||||||
* the node was initially registered with "use_replication_slots=false"
|
* the node was initially registered with "use_replication_slots=false"
|
||||||
@@ -2598,7 +2595,6 @@ do_standby_follow_internal(PGconn *primary_conn, t_node_info *primary_node_recor
|
|||||||
|
|
||||||
if (create_replication_slot(primary_conn,
|
if (create_replication_slot(primary_conn,
|
||||||
local_node_record.slot_name,
|
local_node_record.slot_name,
|
||||||
primary_server_version_num,
|
|
||||||
output) == false)
|
output) == false)
|
||||||
{
|
{
|
||||||
log_error("%s", output->data);
|
log_error("%s", output->data);
|
||||||
@@ -5220,7 +5216,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, source_server_version_num, &event_details) == false)
|
if (create_replication_slot(privileged_conn, node_record->slot_name, &event_details) == false)
|
||||||
{
|
{
|
||||||
log_error("%s", event_details.data);
|
log_error("%s", event_details.data);
|
||||||
|
|
||||||
@@ -5500,7 +5496,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, source_server_version_num, &event_details) == false)
|
if (create_replication_slot(privileged_conn, node_record->slot_name, &event_details) == false)
|
||||||
{
|
{
|
||||||
log_error("%s", event_details.data);
|
log_error("%s", event_details.data);
|
||||||
|
|
||||||
@@ -6062,7 +6058,7 @@ stop_backup:
|
|||||||
|
|
||||||
initPQExpBuffer(&errmsg);
|
initPQExpBuffer(&errmsg);
|
||||||
|
|
||||||
if (create_replication_slot(upstream_conn, node_record->slot_name, source_server_version_num, &errmsg) == false)
|
if (create_replication_slot(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);
|
||||||
|
|||||||
Reference in New Issue
Block a user