mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
config: fix parsing of "replication_type"
This is a legacy parameter which can currently only contain one value, "physical" (the default). It can be safely omitted. Addresses GitHub #672.
This commit is contained in:
3
HISTORY
3
HISTORY
@@ -1,3 +1,6 @@
|
||||
5.2.1 2020-??-??
|
||||
config: fix parsing of "replication_type"
|
||||
|
||||
5.2.0 2020-10-22
|
||||
general: add support for PostgreSQL 13 (Ian)
|
||||
general: remove support for PostgreSQL 9.3 (Ian)
|
||||
|
||||
@@ -120,10 +120,10 @@ struct ConfigFileSetting config_file_settings[] =
|
||||
/* replication_type */
|
||||
{
|
||||
"replication_type",
|
||||
CONFIG_INT,
|
||||
{ .intptr = &config_file_options.replication_type },
|
||||
{ .intdefault = REPLICATION_TYPE_PHYSICAL },
|
||||
{ .intminval = -1 },
|
||||
CONFIG_REPLICATION_TYPE,
|
||||
{ .replicationtypeptr = &config_file_options.replication_type },
|
||||
{ .replicationtypedefault = DEFAULT_REPLICATION_TYPE },
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
},
|
||||
|
||||
36
configfile.c
36
configfile.c
@@ -313,6 +313,9 @@ _parse_config(ItemList *error_list, ItemList *warning_list)
|
||||
case CONFIG_CONNECTION_CHECK_TYPE:
|
||||
*setting->val.checktypeptr = setting->defval.checktypedefault;
|
||||
break;
|
||||
case CONFIG_REPLICATION_TYPE:
|
||||
*setting->val.replicationtypeptr = setting->defval.replicationtypedefault;
|
||||
break;
|
||||
case CONFIG_EVENT_NOTIFICATION_LIST:
|
||||
case CONFIG_TABLESPACE_MAPPING:
|
||||
/* no default for these types; lists cleared above */
|
||||
@@ -566,6 +569,20 @@ parse_configuration_item(ItemList *error_list, ItemList *warning_list, const cha
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CONFIG_REPLICATION_TYPE:
|
||||
{
|
||||
if (strcasecmp(value, "physical") == 0)
|
||||
{
|
||||
*(ReplicationType *)setting->val.replicationtypeptr = REPLICATION_TYPE_PHYSICAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
item_list_append_format(error_list,
|
||||
_("value for \"%s\" must be \"physical\"\n"),
|
||||
name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CONFIG_EVENT_NOTIFICATION_LIST:
|
||||
{
|
||||
parse_event_notifications_list((EventNotificationList *)setting->val.notificationlistptr,
|
||||
@@ -1394,6 +1411,11 @@ dump_config(void)
|
||||
case CONFIG_CONNECTION_CHECK_TYPE:
|
||||
printf("%s", print_connection_check_type(*setting->val.checktypeptr));
|
||||
break;
|
||||
case CONFIG_REPLICATION_TYPE:
|
||||
{
|
||||
printf("%s", print_replication_type(*setting->val.replicationtypeptr));
|
||||
break;
|
||||
}
|
||||
case CONFIG_EVENT_NOTIFICATION_LIST:
|
||||
{
|
||||
char *list = print_event_notification_list(setting->val.notificationlistptr);
|
||||
@@ -2167,6 +2189,20 @@ parse_pg_basebackup_options(const char *pg_basebackup_options, t_basebackup_opti
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
print_replication_type(ReplicationType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case REPLICATION_TYPE_PHYSICAL:
|
||||
return "physical";
|
||||
}
|
||||
|
||||
/* should never reach here */
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
print_connection_check_type(ConnectionCheckType type)
|
||||
{
|
||||
|
||||
13
configfile.h
13
configfile.h
@@ -50,6 +50,11 @@ typedef enum
|
||||
CHECK_CONNECTION
|
||||
} ConnectionCheckType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REPLICATION_TYPE_PHYSICAL
|
||||
} ReplicationType;
|
||||
|
||||
typedef struct EventNotificationListCell
|
||||
{
|
||||
struct EventNotificationListCell *next;
|
||||
@@ -86,7 +91,8 @@ typedef enum
|
||||
CONFIG_FAILOVER_MODE,
|
||||
CONFIG_CONNECTION_CHECK_TYPE,
|
||||
CONFIG_EVENT_NOTIFICATION_LIST,
|
||||
CONFIG_TABLESPACE_MAPPING
|
||||
CONFIG_TABLESPACE_MAPPING,
|
||||
CONFIG_REPLICATION_TYPE
|
||||
} ConfigItemType;
|
||||
|
||||
|
||||
@@ -103,6 +109,7 @@ typedef struct ConfigFileSetting
|
||||
ConnectionCheckType *checktypeptr;
|
||||
EventNotificationList *notificationlistptr;
|
||||
TablespaceList *tablespacemappingptr;
|
||||
ReplicationType *replicationtypeptr;
|
||||
} val;
|
||||
union {
|
||||
int intdefault;
|
||||
@@ -110,6 +117,7 @@ typedef struct ConfigFileSetting
|
||||
bool booldefault;
|
||||
failover_mode_opt failovermodedefault;
|
||||
ConnectionCheckType checktypedefault;
|
||||
ReplicationType replicationtypedefault;
|
||||
} defval;
|
||||
union {
|
||||
int intminval;
|
||||
@@ -138,7 +146,7 @@ typedef struct
|
||||
char config_directory[MAXPGPATH];
|
||||
char pg_bindir[MAXPGPATH];
|
||||
char repmgr_bindir[MAXPGPATH];
|
||||
int replication_type;
|
||||
ReplicationType replication_type;
|
||||
|
||||
/* log settings */
|
||||
char log_level[MAXLEN];
|
||||
@@ -356,6 +364,7 @@ const char *format_failover_mode(failover_mode_opt failover);
|
||||
void exit_with_cli_errors(ItemList *error_list, const char *repmgr_command);
|
||||
|
||||
void print_item_list(ItemList *item_list);
|
||||
const char *print_replication_type(ReplicationType type);
|
||||
const char *print_connection_check_type(ConnectionCheckType type);
|
||||
char *print_event_notification_list(EventNotificationList *list);
|
||||
char *print_tablespace_mapping(TablespaceList *tablespacemappingptr);
|
||||
|
||||
3
repmgr.h
3
repmgr.h
@@ -77,8 +77,6 @@
|
||||
#define MIN_SUPPORTED_VERSION "9.4"
|
||||
#define MIN_SUPPORTED_VERSION_NUM 90400
|
||||
|
||||
#define REPLICATION_TYPE_PHYSICAL 1
|
||||
|
||||
#define UNKNOWN_SERVER_VERSION_NUM -1
|
||||
#define UNKNOWN_REPMGR_VERSION_NUM -1
|
||||
|
||||
@@ -122,6 +120,7 @@
|
||||
#define DEFAULT_NODE_REJOIN_TIMEOUT 60 /* seconds */
|
||||
#define DEFAULT_ARCHIVE_READY_WARNING 16 /* WAL files */
|
||||
#define DEFAULT_ARCHIVE_READY_CRITICAL 128 /* WAL files */
|
||||
#define DEFAULT_REPLICATION_TYPE REPLICATION_TYPE_PHYSICAL
|
||||
#define DEFAULT_REPLICATION_LAG_WARNING 300 /* seconds */
|
||||
#define DEFAULT_REPLICATION_LAG_CRITICAL 600 /* seconds */
|
||||
#define DEFAULT_WITNESS_SYNC_INTERVAL 15 /* seconds */
|
||||
|
||||
Reference in New Issue
Block a user