MDEV-12179: Per-engine mysql.gtid_slave_pos table
Intermediate commit. Ignore unknown engines in --gtid-pos-auto-engines command-line options (but not SET GLOBAL). This seems useful, to allow a default that auto-creates the gtid pos table for engines like TokuDB and MyRocks (which greatly benefit from such), but does not prevent server startup when those engines are not available.
This commit is contained in:
parent
4eebf431b0
commit
3cc89b3e85
@ -4923,11 +4923,19 @@ init_gtid_pos_auto_engines(void)
|
||||
{
|
||||
plugin_ref *plugins;
|
||||
|
||||
/*
|
||||
For the command-line option --gtid_pos_auto_engines, we allow (and ignore)
|
||||
engines that are unknown. This is convenient, since it allows to set
|
||||
default auto-create engines that might not be used by particular users.
|
||||
The option sets a list of storage engines that will have gtid position
|
||||
table auto-created for them if needed. And if the engine is not available,
|
||||
then it will certainly not be needed.
|
||||
*/
|
||||
if (gtid_pos_auto_engines)
|
||||
plugins= resolve_engine_list(gtid_pos_auto_engines,
|
||||
strlen(gtid_pos_auto_engines));
|
||||
strlen(gtid_pos_auto_engines), false);
|
||||
else
|
||||
plugins= resolve_engine_list("", 0);
|
||||
plugins= resolve_engine_list("", 0, false);
|
||||
if (!plugins)
|
||||
return 1;
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
|
@ -1302,7 +1302,8 @@ engine_list_next_item(const char **pos, const char *end_pos,
|
||||
|
||||
static bool
|
||||
resolve_engine_list_item(plugin_ref *list, uint32 *idx,
|
||||
const char *pos, const char *pos_end)
|
||||
const char *pos, const char *pos_end,
|
||||
bool error_on_unknown_engine)
|
||||
{
|
||||
LEX_STRING item_str;
|
||||
plugin_ref ref;
|
||||
@ -1313,9 +1314,13 @@ resolve_engine_list_item(plugin_ref *list, uint32 *idx,
|
||||
ref= ha_resolve_by_name(NULL, &item_str, false);
|
||||
if (!ref)
|
||||
{
|
||||
ErrConvString err(pos, pos_end-pos, system_charset_info);
|
||||
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), err.ptr());
|
||||
return true;
|
||||
if (error_on_unknown_engine)
|
||||
{
|
||||
ErrConvString err(pos, pos_end-pos, system_charset_info);
|
||||
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), err.ptr());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/* Ignore duplicates, like --plugin-load does. */
|
||||
for (i= 0; i < *idx; ++i)
|
||||
@ -1338,7 +1343,8 @@ resolve_engine_list_item(plugin_ref *list, uint32 *idx,
|
||||
array of plugin_ref.
|
||||
*/
|
||||
plugin_ref *
|
||||
resolve_engine_list(const char *str_arg, size_t str_arg_len)
|
||||
resolve_engine_list(const char *str_arg, size_t str_arg_len,
|
||||
bool error_on_unknown_engine)
|
||||
{
|
||||
uint32 count, idx;
|
||||
const char *pos, *item_start, *item_end;
|
||||
@ -1370,7 +1376,8 @@ resolve_engine_list(const char *str_arg, size_t str_arg_len)
|
||||
DBUG_ASSERT(idx < count);
|
||||
if (idx >= count)
|
||||
break;
|
||||
if (resolve_engine_list_item(res, &idx, item_start, item_end))
|
||||
if (resolve_engine_list_item(res, &idx, item_start, item_end,
|
||||
error_on_unknown_engine))
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,8 @@ int sys_var_init();
|
||||
uint sys_var_elements();
|
||||
int sys_var_add_options(DYNAMIC_ARRAY *long_options, int parse_flags);
|
||||
void sys_var_end(void);
|
||||
plugin_ref *resolve_engine_list(const char *str_arg, size_t str_arg_len);
|
||||
plugin_ref *resolve_engine_list(const char *str_arg, size_t str_arg_len,
|
||||
bool error_on_unknown_engine);
|
||||
void free_engine_list(plugin_ref *list);
|
||||
plugin_ref *copy_engine_list(plugin_ref *list);
|
||||
char *pretty_print_engine_list(THD *thd, plugin_ref *list);
|
||||
|
@ -1575,9 +1575,9 @@ public:
|
||||
plugin_ref *plugins;
|
||||
|
||||
if (!(res=var->value->val_str(&str)))
|
||||
plugins= resolve_engine_list("", 0);
|
||||
plugins= resolve_engine_list("", 0, true);
|
||||
else
|
||||
plugins= resolve_engine_list(res->ptr(), res->length());
|
||||
plugins= resolve_engine_list(res->ptr(), res->length(), true);
|
||||
if (!plugins)
|
||||
return true;
|
||||
var->save_result.plugins= plugins;
|
||||
@ -1611,7 +1611,7 @@ public:
|
||||
char *default_value= *reinterpret_cast<char**>(option.def_value);
|
||||
if (!default_value)
|
||||
return 0;
|
||||
return resolve_engine_list(default_value, strlen(default_value));
|
||||
return resolve_engine_list(default_value, strlen(default_value), false);
|
||||
}
|
||||
|
||||
void global_save_default(THD *thd, set_var *var)
|
||||
|
Loading…
x
Reference in New Issue
Block a user