From 66b40ffc68a110a98d3a86eb15bc8f22a5b49e8e Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 29 Nov 2018 14:35:01 +0900 Subject: [PATCH] Simplify function create_replication_slot() Following the changes in 793d83b, it's no longer necessary to pass the server version number. --- dbutils.c | 2 +- dbutils.h | 2 +- repmgr-action-standby.c | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/dbutils.c b/dbutils.c index 21c42514..6d293e7a 100644 --- a/dbutils.c +++ b/dbutils.c @@ -3937,7 +3937,7 @@ 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) +create_replication_slot(PGconn *conn, char *slot_name, PQExpBufferData *error_msg) { PQExpBufferData query; RecordStatus record_status = RECORD_NOT_FOUND; diff --git a/dbutils.h b/dbutils.h index 483a25b6..0cfb2bb3 100644 --- a/dbutils.h +++ b/dbutils.h @@ -492,7 +492,7 @@ 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, 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); RecordStatus get_slot_record(PGconn *conn, char *slot_name, t_replication_slot *record); int get_free_replication_slot_count(PGconn *conn); diff --git a/repmgr-action-standby.c b/repmgr-action-standby.c index 49513d0a..0b12dcf9 100644 --- a/repmgr-action-standby.c +++ b/repmgr-action-standby.c @@ -1189,7 +1189,6 @@ _do_create_recovery_conf(void) if (create_replication_slot(upstream_conn, local_node_record.slot_name, - UNKNOWN_SERVER_VERSION_NUM, &msg) == false) { 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) { - int primary_server_version_num = PQserverVersion(primary_conn); - /* * Here we add a sanity check for the "slot_name" field - it's possible * 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, local_node_record.slot_name, - primary_server_version_num, output) == false) { 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); - 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); @@ -5500,7 +5496,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, 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); @@ -6062,7 +6058,7 @@ stop_backup: 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_detail("%s", errmsg.data);