1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.11 into 11.0

This commit is contained in:
Marko Mäkelä
2023-02-16 13:34:45 +02:00
493 changed files with 7008 additions and 2592 deletions

View File

@ -4848,6 +4848,35 @@ int handler::check_collation_compatibility()
}
int handler::check_long_hash_compatibility() const
{
if (!table->s->old_long_hash_function())
return 0;
KEY *key= table->key_info;
KEY *key_end= key + table->s->keys;
for ( ; key < key_end; key++)
{
if (key->algorithm == HA_KEY_ALG_LONG_HASH)
{
/*
The old (pre-MDEV-27653) hash function was wrong.
So the long hash unique constraint can have some
duplicate records. REPAIR TABLE can't fix this,
it will fail on a duplicate key error.
Only "ALTER IGNORE TABLE .. FORCE" can fix this.
So we need to return HA_ADMIN_NEEDS_ALTER here,
(not HA_ADMIN_NEEDS_UPGRADE which is used elsewhere),
to properly send the error message text corresponding
to ER_TABLE_NEEDS_REBUILD (rather than to ER_TABLE_NEEDS_UPGRADE)
to the user.
*/
return HA_ADMIN_NEEDS_ALTER;
}
}
return 0;
}
int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
{
int error;
@ -4885,6 +4914,9 @@ int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
if (unlikely((error= check_collation_compatibility())))
return error;
if (unlikely((error= check_long_hash_compatibility())))
return error;
return check_for_upgrade(check_opt);
}