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
|
5.2.0 2020-10-22
|
||||||
general: add support for PostgreSQL 13 (Ian)
|
general: add support for PostgreSQL 13 (Ian)
|
||||||
general: remove support for PostgreSQL 9.3 (Ian)
|
general: remove support for PostgreSQL 9.3 (Ian)
|
||||||
|
|||||||
@@ -120,10 +120,10 @@ struct ConfigFileSetting config_file_settings[] =
|
|||||||
/* replication_type */
|
/* replication_type */
|
||||||
{
|
{
|
||||||
"replication_type",
|
"replication_type",
|
||||||
CONFIG_INT,
|
CONFIG_REPLICATION_TYPE,
|
||||||
{ .intptr = &config_file_options.replication_type },
|
{ .replicationtypeptr = &config_file_options.replication_type },
|
||||||
{ .intdefault = REPLICATION_TYPE_PHYSICAL },
|
{ .replicationtypedefault = DEFAULT_REPLICATION_TYPE },
|
||||||
{ .intminval = -1 },
|
{},
|
||||||
{},
|
{},
|
||||||
{}
|
{}
|
||||||
},
|
},
|
||||||
|
|||||||
36
configfile.c
36
configfile.c
@@ -313,6 +313,9 @@ _parse_config(ItemList *error_list, ItemList *warning_list)
|
|||||||
case CONFIG_CONNECTION_CHECK_TYPE:
|
case CONFIG_CONNECTION_CHECK_TYPE:
|
||||||
*setting->val.checktypeptr = setting->defval.checktypedefault;
|
*setting->val.checktypeptr = setting->defval.checktypedefault;
|
||||||
break;
|
break;
|
||||||
|
case CONFIG_REPLICATION_TYPE:
|
||||||
|
*setting->val.replicationtypeptr = setting->defval.replicationtypedefault;
|
||||||
|
break;
|
||||||
case CONFIG_EVENT_NOTIFICATION_LIST:
|
case CONFIG_EVENT_NOTIFICATION_LIST:
|
||||||
case CONFIG_TABLESPACE_MAPPING:
|
case CONFIG_TABLESPACE_MAPPING:
|
||||||
/* no default for these types; lists cleared above */
|
/* no default for these types; lists cleared above */
|
||||||
@@ -566,6 +569,20 @@ parse_configuration_item(ItemList *error_list, ItemList *warning_list, const cha
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
case CONFIG_EVENT_NOTIFICATION_LIST:
|
||||||
{
|
{
|
||||||
parse_event_notifications_list((EventNotificationList *)setting->val.notificationlistptr,
|
parse_event_notifications_list((EventNotificationList *)setting->val.notificationlistptr,
|
||||||
@@ -1394,6 +1411,11 @@ dump_config(void)
|
|||||||
case CONFIG_CONNECTION_CHECK_TYPE:
|
case CONFIG_CONNECTION_CHECK_TYPE:
|
||||||
printf("%s", print_connection_check_type(*setting->val.checktypeptr));
|
printf("%s", print_connection_check_type(*setting->val.checktypeptr));
|
||||||
break;
|
break;
|
||||||
|
case CONFIG_REPLICATION_TYPE:
|
||||||
|
{
|
||||||
|
printf("%s", print_replication_type(*setting->val.replicationtypeptr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CONFIG_EVENT_NOTIFICATION_LIST:
|
case CONFIG_EVENT_NOTIFICATION_LIST:
|
||||||
{
|
{
|
||||||
char *list = print_event_notification_list(setting->val.notificationlistptr);
|
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 *
|
const char *
|
||||||
print_connection_check_type(ConnectionCheckType type)
|
print_connection_check_type(ConnectionCheckType type)
|
||||||
{
|
{
|
||||||
|
|||||||
13
configfile.h
13
configfile.h
@@ -50,6 +50,11 @@ typedef enum
|
|||||||
CHECK_CONNECTION
|
CHECK_CONNECTION
|
||||||
} ConnectionCheckType;
|
} ConnectionCheckType;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
REPLICATION_TYPE_PHYSICAL
|
||||||
|
} ReplicationType;
|
||||||
|
|
||||||
typedef struct EventNotificationListCell
|
typedef struct EventNotificationListCell
|
||||||
{
|
{
|
||||||
struct EventNotificationListCell *next;
|
struct EventNotificationListCell *next;
|
||||||
@@ -86,7 +91,8 @@ typedef enum
|
|||||||
CONFIG_FAILOVER_MODE,
|
CONFIG_FAILOVER_MODE,
|
||||||
CONFIG_CONNECTION_CHECK_TYPE,
|
CONFIG_CONNECTION_CHECK_TYPE,
|
||||||
CONFIG_EVENT_NOTIFICATION_LIST,
|
CONFIG_EVENT_NOTIFICATION_LIST,
|
||||||
CONFIG_TABLESPACE_MAPPING
|
CONFIG_TABLESPACE_MAPPING,
|
||||||
|
CONFIG_REPLICATION_TYPE
|
||||||
} ConfigItemType;
|
} ConfigItemType;
|
||||||
|
|
||||||
|
|
||||||
@@ -103,6 +109,7 @@ typedef struct ConfigFileSetting
|
|||||||
ConnectionCheckType *checktypeptr;
|
ConnectionCheckType *checktypeptr;
|
||||||
EventNotificationList *notificationlistptr;
|
EventNotificationList *notificationlistptr;
|
||||||
TablespaceList *tablespacemappingptr;
|
TablespaceList *tablespacemappingptr;
|
||||||
|
ReplicationType *replicationtypeptr;
|
||||||
} val;
|
} val;
|
||||||
union {
|
union {
|
||||||
int intdefault;
|
int intdefault;
|
||||||
@@ -110,6 +117,7 @@ typedef struct ConfigFileSetting
|
|||||||
bool booldefault;
|
bool booldefault;
|
||||||
failover_mode_opt failovermodedefault;
|
failover_mode_opt failovermodedefault;
|
||||||
ConnectionCheckType checktypedefault;
|
ConnectionCheckType checktypedefault;
|
||||||
|
ReplicationType replicationtypedefault;
|
||||||
} defval;
|
} defval;
|
||||||
union {
|
union {
|
||||||
int intminval;
|
int intminval;
|
||||||
@@ -138,7 +146,7 @@ typedef struct
|
|||||||
char config_directory[MAXPGPATH];
|
char config_directory[MAXPGPATH];
|
||||||
char pg_bindir[MAXPGPATH];
|
char pg_bindir[MAXPGPATH];
|
||||||
char repmgr_bindir[MAXPGPATH];
|
char repmgr_bindir[MAXPGPATH];
|
||||||
int replication_type;
|
ReplicationType replication_type;
|
||||||
|
|
||||||
/* log settings */
|
/* log settings */
|
||||||
char log_level[MAXLEN];
|
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 exit_with_cli_errors(ItemList *error_list, const char *repmgr_command);
|
||||||
|
|
||||||
void print_item_list(ItemList *item_list);
|
void print_item_list(ItemList *item_list);
|
||||||
|
const char *print_replication_type(ReplicationType type);
|
||||||
const char *print_connection_check_type(ConnectionCheckType type);
|
const char *print_connection_check_type(ConnectionCheckType type);
|
||||||
char *print_event_notification_list(EventNotificationList *list);
|
char *print_event_notification_list(EventNotificationList *list);
|
||||||
char *print_tablespace_mapping(TablespaceList *tablespacemappingptr);
|
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 "9.4"
|
||||||
#define MIN_SUPPORTED_VERSION_NUM 90400
|
#define MIN_SUPPORTED_VERSION_NUM 90400
|
||||||
|
|
||||||
#define REPLICATION_TYPE_PHYSICAL 1
|
|
||||||
|
|
||||||
#define UNKNOWN_SERVER_VERSION_NUM -1
|
#define UNKNOWN_SERVER_VERSION_NUM -1
|
||||||
#define UNKNOWN_REPMGR_VERSION_NUM -1
|
#define UNKNOWN_REPMGR_VERSION_NUM -1
|
||||||
|
|
||||||
@@ -122,6 +120,7 @@
|
|||||||
#define DEFAULT_NODE_REJOIN_TIMEOUT 60 /* seconds */
|
#define DEFAULT_NODE_REJOIN_TIMEOUT 60 /* seconds */
|
||||||
#define DEFAULT_ARCHIVE_READY_WARNING 16 /* WAL files */
|
#define DEFAULT_ARCHIVE_READY_WARNING 16 /* WAL files */
|
||||||
#define DEFAULT_ARCHIVE_READY_CRITICAL 128 /* 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_WARNING 300 /* seconds */
|
||||||
#define DEFAULT_REPLICATION_LAG_CRITICAL 600 /* seconds */
|
#define DEFAULT_REPLICATION_LAG_CRITICAL 600 /* seconds */
|
||||||
#define DEFAULT_WITNESS_SYNC_INTERVAL 15 /* seconds */
|
#define DEFAULT_WITNESS_SYNC_INTERVAL 15 /* seconds */
|
||||||
|
|||||||
Reference in New Issue
Block a user