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

Merge 10.11 into 11.0

This commit is contained in:
Marko Mäkelä
2024-03-28 10:51:36 +02:00
490 changed files with 14843 additions and 4704 deletions

View File

@@ -3515,6 +3515,17 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
DBUG_ASSERT(alloc_root_inited(&table->mem_root));
set_partitions_to_open(partitions_to_open);
internal_tmp_table= MY_TEST(test_if_locked & HA_OPEN_INTERNAL_TABLE);
if (!internal_tmp_table && (test_if_locked & HA_OPEN_TMP_TABLE) &&
current_thd->slave_thread)
{
/*
This is a temporary table used by replication that is not attached
to a THD. Mark it as a global temporary table.
*/
test_if_locked|= HA_OPEN_GLOBAL_TMP_TABLE;
}
if (unlikely((error=open(name,mode,test_if_locked))))
{
@@ -3574,7 +3585,6 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode,
/* Copy current optimizer costs. Needed in case clone() is used */
reset_statistics();
}
internal_tmp_table= MY_TEST(test_if_locked & HA_OPEN_INTERNAL_TABLE);
DBUG_RETURN(error);
}
@@ -4929,7 +4939,8 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
KEY *keyinfo, *keyend;
KEY_PART_INFO *keypart, *keypartend;
if (table->s->incompatible_version)
if (table->s->incompatible_version ||
check_old_types())
return HA_ADMIN_NEEDS_ALTER;
if (!table->s->mysql_version)
@@ -4955,6 +4966,12 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
}
}
}
/*
True VARCHAR appeared in MySQL-5.0.3.
If the FRM is older than 5.0.3, force alter even if the check_old_type()
call above did not find data types that want upgrade.
*/
if (table->s->frm_version < FRM_VER_TRUE_VARCHAR)
return HA_ADMIN_NEEDS_ALTER;
@@ -4968,26 +4985,15 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
}
int handler::check_old_types()
bool handler::check_old_types() const
{
Field** field;
if (!table->s->mysql_version)
for (Field **field= table->field; (*field); field++)
{
/* check for bad DECIMAL field */
for (field= table->field; (*field); field++)
{
if ((*field)->type() == MYSQL_TYPE_NEWDECIMAL)
{
return HA_ADMIN_NEEDS_ALTER;
}
if ((*field)->type() == MYSQL_TYPE_VAR_STRING)
{
return HA_ADMIN_NEEDS_ALTER;
}
}
const Type_handler *th= (*field)->type_handler();
if (th != th->type_handler_for_implicit_upgrade())
return true;
}
return 0;
return false;
}
@@ -5188,8 +5194,6 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
if (table->s->mysql_version < MYSQL_VERSION_ID)
{
if (unlikely((error= check_old_types())))
return error;
error= ha_check_for_upgrade(check_opt);
if (unlikely(error && (error != HA_ADMIN_NEEDS_CHECK)))
return error;
@@ -5693,6 +5697,9 @@ handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info_arg)
{
DBUG_ASSERT(m_lock_type == F_UNLCK);
mark_trx_read_write();
if ((info_arg->options & HA_LEX_CREATE_TMP_TABLE) &&
current_thd->slave_thread)
info_arg->options|= HA_LEX_CREATE_GLOBAL_TMP_TABLE;
int error= create(name, form, info_arg);
if (!error &&
!(info_arg->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER)))