mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
handle tablespace mapping
This commit is contained in:
46
configfile.c
46
configfile.c
@@ -77,6 +77,15 @@ struct ConfigFileOption config_file_options2[] =
|
|||||||
-1,
|
-1,
|
||||||
-1
|
-1
|
||||||
},
|
},
|
||||||
|
/* tablespace_mapping */
|
||||||
|
{
|
||||||
|
"tablespace_mapping",
|
||||||
|
CONFIG_TABLESPACE_MAPPING,
|
||||||
|
{ .tablespacemappingptr = &config_file_options.tablespace_mapping },
|
||||||
|
{},
|
||||||
|
-1,
|
||||||
|
-1
|
||||||
|
},
|
||||||
/* ================
|
/* ================
|
||||||
* repmgrd settings
|
* repmgrd settings
|
||||||
* ================
|
* ================
|
||||||
@@ -107,7 +116,7 @@ struct ConfigFileOption config_file_options2[] =
|
|||||||
"event_notifications",
|
"event_notifications",
|
||||||
CONFIG_EVENT_NOTIFICATION_LIST,
|
CONFIG_EVENT_NOTIFICATION_LIST,
|
||||||
{ .notificationlistptr = &config_file_options.event_notifications },
|
{ .notificationlistptr = &config_file_options.event_notifications },
|
||||||
{ .notificationlistdefault = NULL },
|
{},
|
||||||
-1,
|
-1,
|
||||||
-1
|
-1
|
||||||
},
|
},
|
||||||
@@ -132,7 +141,7 @@ static void parse_time_unit_parameter(const char *name, const char *value, char
|
|||||||
|
|
||||||
static void copy_config_file_options(t_configuration_options *original, t_configuration_options *copy);
|
static void copy_config_file_options(t_configuration_options *original, t_configuration_options *copy);
|
||||||
|
|
||||||
static void tablespace_list_append(t_configuration_options *options, const char *arg);
|
static void tablespace_list_append(TablespaceList *tablespace_mapping, const char *arg);
|
||||||
static void tablespace_list_copy(t_configuration_options *original, t_configuration_options *copy);
|
static void tablespace_list_copy(t_configuration_options *original, t_configuration_options *copy);
|
||||||
static void tablespace_list_free(t_configuration_options *options);
|
static void tablespace_list_free(t_configuration_options *options);
|
||||||
|
|
||||||
@@ -651,6 +660,18 @@ _parse_config2(ItemList *error_list, ItemList *warning_list)
|
|||||||
pfree(list_str);
|
pfree(list_str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CONFIG_TABLESPACE_MAPPING:
|
||||||
|
{
|
||||||
|
TablespaceListCell *cell;
|
||||||
|
for (cell = option->val.tablespacemappingptr->head; cell; cell = cell->next)
|
||||||
|
{
|
||||||
|
printf(" %s: %s=%s\n",
|
||||||
|
option->name,
|
||||||
|
cell->old_dir,
|
||||||
|
cell->new_dir);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
option = &config_file_options2[i];
|
option = &config_file_options2[i];
|
||||||
@@ -723,7 +744,14 @@ parse_configuration_item2(ItemList *error_list, ItemList *warning_list, const ch
|
|||||||
}
|
}
|
||||||
case CONFIG_EVENT_NOTIFICATION_LIST:
|
case CONFIG_EVENT_NOTIFICATION_LIST:
|
||||||
{
|
{
|
||||||
parse_event_notifications_list((EventNotificationList *)&option->val.notificationlistptr, value);
|
parse_event_notifications_list((EventNotificationList *)&option->val.notificationlistptr,
|
||||||
|
value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CONFIG_TABLESPACE_MAPPING:
|
||||||
|
{
|
||||||
|
tablespace_list_append((TablespaceList *)option->val.tablespacemappingptr, value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
log_error("encountered unknown configuration type %i when processing \"%s\"",
|
log_error("encountered unknown configuration type %i when processing \"%s\"",
|
||||||
@@ -1177,7 +1205,7 @@ parse_configuration_item(t_configuration_options *options, ItemList *error_list,
|
|||||||
else if (strcmp(name, "pg_basebackup_options") == 0)
|
else if (strcmp(name, "pg_basebackup_options") == 0)
|
||||||
strncpy(options->pg_basebackup_options, value, MAXLEN);
|
strncpy(options->pg_basebackup_options, value, MAXLEN);
|
||||||
else if (strcmp(name, "tablespace_mapping") == 0)
|
else if (strcmp(name, "tablespace_mapping") == 0)
|
||||||
tablespace_list_append(options, value);
|
tablespace_list_append(&options->tablespace_mapping, value);
|
||||||
else if (strcmp(name, "restore_command") == 0)
|
else if (strcmp(name, "restore_command") == 0)
|
||||||
strncpy(options->restore_command, value, MAXLEN);
|
strncpy(options->restore_command, value, MAXLEN);
|
||||||
else if (strcmp(name, "recovery_min_apply_delay") == 0)
|
else if (strcmp(name, "recovery_min_apply_delay") == 0)
|
||||||
@@ -2356,7 +2384,7 @@ copy_config_file_options(t_configuration_options *original, t_configuration_opti
|
|||||||
* Adapted from pg_basebackup.c
|
* Adapted from pg_basebackup.c
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
tablespace_list_append(t_configuration_options *options, const char *arg)
|
tablespace_list_append(TablespaceList *tablespace_mapping, const char *arg)
|
||||||
{
|
{
|
||||||
TablespaceListCell *cell = NULL;
|
TablespaceListCell *cell = NULL;
|
||||||
char *dst = NULL;
|
char *dst = NULL;
|
||||||
@@ -2407,12 +2435,12 @@ tablespace_list_append(t_configuration_options *options, const char *arg)
|
|||||||
canonicalize_path(cell->old_dir);
|
canonicalize_path(cell->old_dir);
|
||||||
canonicalize_path(cell->new_dir);
|
canonicalize_path(cell->new_dir);
|
||||||
|
|
||||||
if (options->tablespace_mapping.tail)
|
if (tablespace_mapping->tail)
|
||||||
options->tablespace_mapping.tail->next = cell;
|
tablespace_mapping->tail->next = cell;
|
||||||
else
|
else
|
||||||
options->tablespace_mapping.head = cell;
|
tablespace_mapping->head = cell;
|
||||||
|
|
||||||
options->tablespace_mapping.tail = cell;
|
tablespace_mapping->tail = cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ typedef enum
|
|||||||
CONFIG_STRING,
|
CONFIG_STRING,
|
||||||
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
|
||||||
} ConfigItemType;
|
} ConfigItemType;
|
||||||
|
|
||||||
|
|
||||||
@@ -101,6 +102,7 @@ typedef struct ConfigFileOption
|
|||||||
failover_mode_opt *failovermodeptr;
|
failover_mode_opt *failovermodeptr;
|
||||||
ConnectionCheckType *checktypeptr;
|
ConnectionCheckType *checktypeptr;
|
||||||
EventNotificationList *notificationlistptr;
|
EventNotificationList *notificationlistptr;
|
||||||
|
TablespaceList *tablespacemappingptr;
|
||||||
} val;
|
} val;
|
||||||
union {
|
union {
|
||||||
int intdefault;
|
int intdefault;
|
||||||
@@ -108,7 +110,6 @@ typedef struct ConfigFileOption
|
|||||||
bool booldefault;
|
bool booldefault;
|
||||||
failover_mode_opt failovermodedefault;
|
failover_mode_opt failovermodedefault;
|
||||||
ConnectionCheckType *checktypedefault;
|
ConnectionCheckType *checktypedefault;
|
||||||
EventNotificationList *notificationlistdefault;
|
|
||||||
} defval;
|
} defval;
|
||||||
int minval;
|
int minval;
|
||||||
int strmaxlen;
|
int strmaxlen;
|
||||||
|
|||||||
Reference in New Issue
Block a user