1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-5271 Support engine-defined attributes per partition

Make it possible to specify engine-defined attributes on partitions
as well as tables.

If an engine-defined attribute is only specified at the table level,
it applies to all the partitions in the table.
This is a backward-compatible behavior.

If the same attribute is specified both at the table level and the
partition level, the per-partition one takes precedence.
So, we can consider per-table attributes as default values.

One cannot specify engine-defined attributes on subpartitions.

Implementation details:

* We store per-partition attributes in the partition_element class
  because we already have the part_comment field, which is for
  per-partition comments.

* In the case of ALTER TABLE statements, the partition_elements in
  table->part_info is set up by mysql_unpack_partition().
  So, we parse per-partition attributes after the call of the function.
This commit is contained in:
Nayuta Yanagisawa
2021-11-05 16:39:28 +09:00
parent 83dd7db69d
commit c5d09f731a
11 changed files with 588 additions and 124 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2010 Monty Program Ab
/* Copyright (C) 2010, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,30 +35,23 @@ class engine_option_value: public Sql_alloc
bool parsed; ///< to detect unrecognized options
bool quoted_value; ///< option=VAL vs. option='VAL'
engine_option_value(engine_option_value *src,
engine_option_value **start, engine_option_value **end) :
engine_option_value(engine_option_value *src) :
name(src->name), value(src->value),
next(NULL), parsed(src->parsed), quoted_value(src->quoted_value)
{
link(start, end);
}
engine_option_value(LEX_CSTRING &name_arg, LEX_CSTRING &value_arg,
bool quoted,
engine_option_value **start, engine_option_value **end) :
bool quoted) :
name(name_arg), value(value_arg),
next(NULL), parsed(false), quoted_value(quoted)
{
link(start, end);
}
engine_option_value(LEX_CSTRING &name_arg,
engine_option_value **start, engine_option_value **end) :
engine_option_value(LEX_CSTRING &name_arg):
name(name_arg), value(null_clex_str),
next(NULL), parsed(false), quoted_value(false)
{
link(start, end);
}
engine_option_value(LEX_CSTRING &name_arg, ulonglong value_arg,
engine_option_value **start, engine_option_value **end,
MEM_ROOT *root) :
name(name_arg), next(NULL), parsed(false), quoted_value(false)
{
@@ -66,7 +59,6 @@ class engine_option_value: public Sql_alloc
if (likely((value.str= str= (char *)alloc_root(root, 22))))
{
value.length= longlong10_to_str(value_arg, str, 10) - str;
link(start, end);
}
}
static uchar *frm_read(const uchar *buff, const uchar *buff_end,
@@ -83,15 +75,18 @@ class Create_field;
bool resolve_sysvar_table_options(handlerton *hton);
void free_sysvar_table_options(handlerton *hton);
bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share);
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool parse_engine_part_options(THD *thd, TABLE *table);
#endif
bool parse_option_list(THD* thd, handlerton *hton, void *option_struct,
engine_option_value **option_list,
ha_create_table_option *rules,
bool suppress_warning, MEM_ROOT *root);
bool engine_table_options_frm_read(const uchar *buff, size_t length,
TABLE_SHARE *share);
engine_option_value *merge_engine_table_options(engine_option_value *source,
engine_option_value *changes,
MEM_ROOT *root);
bool merge_engine_options(engine_option_value *source,
engine_option_value *changes,
engine_option_value **out, MEM_ROOT *root);
uint engine_table_options_frm_length(engine_option_value *table_option_list,
List<Create_field> &create_fields,