mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.6' into 10.7
This commit is contained in:
@ -4695,6 +4695,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;
|
||||
@ -4732,6 +4761,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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user