1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2025-01-20 09:57:37 +02:00
142 changed files with 3642 additions and 828 deletions

View File

@@ -7087,7 +7087,16 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info,
DBUG_RETURN(1);
/* Some very basic checks. */
if (table->s->fields != alter_info->create_list.elements ||
uint fields= table->s->fields;
/* There is no field count on system-invisible fields, count them. */
for (Field **f_ptr= table->field; *f_ptr; f_ptr++)
{
if ((*f_ptr)->invisible >= INVISIBLE_SYSTEM)
fields--;
}
if (fields != alter_info->create_list.elements ||
table->s->db_type() != create_info->db_type ||
table->s->tmp_table ||
(table->s->row_type != create_info->row_type))
@@ -7098,6 +7107,9 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info,
for (Field **f_ptr= table->field; *f_ptr; f_ptr++)
{
Field *field= *f_ptr;
/* Skip hidden generated field like long hash index. */
if (field->invisible >= INVISIBLE_SYSTEM)
continue;
Create_field *tmp_new_field= tmp_new_field_it++;
/* Check that NULL behavior is the same. */
@@ -7109,8 +7121,12 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info,
{
if (!tmp_new_field->field->vcol_info)
DBUG_RETURN(false);
if (!field->vcol_info->is_equal(tmp_new_field->field->vcol_info))
bool err;
if (!field->vcol_info->is_equivalent(thd, table->s, create_info->table->s,
tmp_new_field->field->vcol_info, err))
DBUG_RETURN(false);
if (err)
DBUG_RETURN(true);
}
/*
@@ -7146,13 +7162,13 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info,
DBUG_RETURN(false);
/* Go through keys and check if they are compatible. */
KEY *table_key;
KEY *table_key_end= table->key_info + table->s->keys;
KEY *table_key= table->s->key_info;
KEY *table_key_end= table_key + table->s->keys;
KEY *new_key;
KEY *new_key_end= key_info_buffer + key_count;
/* Step through all keys of the first table and search matching keys. */
for (table_key= table->key_info; table_key < table_key_end; table_key++)
for (; table_key < table_key_end; table_key++)
{
/* Search a key with the same name. */
for (new_key= key_info_buffer; new_key < new_key_end; new_key++)
@@ -7195,7 +7211,7 @@ bool mysql_compare_tables(TABLE *table, Alter_info *alter_info,
for (new_key= key_info_buffer; new_key < new_key_end; new_key++)
{
/* Search a key with the same name. */
for (table_key= table->key_info; table_key < table_key_end; table_key++)
for (table_key= table->s->key_info; table_key < table_key_end; table_key++)
{
if (!lex_string_cmp(system_charset_info, &table_key->name,
&new_key->name))
@@ -8615,7 +8631,14 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
LEX_CSTRING tmp_name;
bzero((char*) &key_create_info, sizeof(key_create_info));
if (key_info->algorithm == HA_KEY_ALG_LONG_HASH)
key_info->algorithm= HA_KEY_ALG_UNDEF;
key_info->algorithm= alter_ctx->fast_alter_partition ?
HA_KEY_ALG_HASH : HA_KEY_ALG_UNDEF;
/*
For fast alter partition we set HA_KEY_ALG_HASH above to make sure it
doesn't lose the hash property.
Otherwise we let mysql_prepare_create_table() decide if the hash field
is needed depending on the (possibly changed) data types.
*/
key_create_info.algorithm= key_info->algorithm;
/*
We copy block size directly as some engines, like Area, sets this
@@ -9731,7 +9754,6 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
#ifdef WITH_PARTITION_STORAGE_ENGINE
bool partition_changed= false;
bool fast_alter_partition= false;
#endif
/*
Create .FRM for new version of table with a temporary name.
@@ -10287,7 +10309,7 @@ do_continue:;
Partitioning: part_info is prepared and returned via thd->work_part_info
*/
if (prep_alter_part_table(thd, table, alter_info, create_info,
&partition_changed, &fast_alter_partition))
&partition_changed, &alter_ctx.fast_alter_partition))
{
DBUG_RETURN(true);
}
@@ -10322,7 +10344,7 @@ do_continue:;
Note, one can run a separate "ALTER TABLE t1 FORCE;" statement
before or after the partition change ALTER statement to upgrade data types.
*/
if (IF_PARTITIONING(!fast_alter_partition, 1))
if (!alter_ctx.fast_alter_partition)
Create_field::upgrade_data_types(alter_info->create_list);
if (create_info->check_fields(thd, alter_info,
@@ -10334,7 +10356,7 @@ do_continue:;
promote_first_timestamp_column(&alter_info->create_list);
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (fast_alter_partition)
if (alter_ctx.fast_alter_partition)
{
/*
ALGORITHM and LOCK clauses are generally not allowed by the