mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-30746 Regression in ucs2_general_mysql500_ci
1. Adding a separate MY_COLLATION_HANDLER my_collation_ucs2_general_mysql500_ci_handler implementing a proper order for ucs2_general_mysql500_ci The problem happened because ucs2_general_mysql500_ci erroneously used my_collation_ucs2_general_ci_handler. 2. Cosmetic changes: Renaming: - plane00_mysql500 to my_unicase_mysql500_page00 - my_unicase_pages_mysql500 to my_unicase_mysql500_pages to use the same naming style with: - my_unicase_default_page00 - my_unicase_defaul_pages 3. Moving code fragments from - handler::check_collation_compatibility() in handler.cc - upgrade_collation() in table.cc into new methods in class Charset, to reuse the code easier.
This commit is contained in:
@ -184,6 +184,83 @@ public:
|
||||
{
|
||||
return m_charset != &my_charset_bin;
|
||||
}
|
||||
|
||||
/*
|
||||
The MariaDB version when the last collation change happened,
|
||||
e.g. due to a bug fix. See functions below.
|
||||
*/
|
||||
static ulong latest_mariadb_version_with_collation_change()
|
||||
{
|
||||
return 110002;
|
||||
}
|
||||
|
||||
/*
|
||||
Check if the collation with the given ID changed its order
|
||||
since the given MariaDB version.
|
||||
*/
|
||||
static bool collation_changed_order(ulong mysql_version, uint cs_number)
|
||||
{
|
||||
if ((mysql_version < 50048 &&
|
||||
(cs_number == 11 || /* ascii_general_ci - bug #29499, bug #27562 */
|
||||
cs_number == 41 || /* latin7_general_ci - bug #29461 */
|
||||
cs_number == 42 || /* latin7_general_cs - bug #29461 */
|
||||
cs_number == 20 || /* latin7_estonian_cs - bug #29461 */
|
||||
cs_number == 21 || /* latin2_hungarian_ci - bug #29461 */
|
||||
cs_number == 22 || /* koi8u_general_ci - bug #29461 */
|
||||
cs_number == 23 || /* cp1251_ukrainian_ci - bug #29461 */
|
||||
cs_number == 26)) || /* cp1250_general_ci - bug #29461 */
|
||||
(mysql_version < 50124 &&
|
||||
(cs_number == 33 || /* utf8_general_ci - bug #27877 */
|
||||
cs_number == 35))) /* ucs2_general_ci - bug #27877 */
|
||||
return true;
|
||||
|
||||
if (cs_number == 159 && /* ucs2_general_mysql500_ci - MDEV-30746 */
|
||||
((mysql_version >= 100400 && mysql_version < 100429) ||
|
||||
(mysql_version >= 100500 && mysql_version < 100520) ||
|
||||
(mysql_version >= 100600 && mysql_version < 100613) ||
|
||||
(mysql_version >= 100700 && mysql_version < 100708) ||
|
||||
(mysql_version >= 100800 && mysql_version < 100808) ||
|
||||
(mysql_version >= 100900 && mysql_version < 100906) ||
|
||||
(mysql_version >= 101000 && mysql_version < 101004) ||
|
||||
(mysql_version >= 101100 && mysql_version < 101103) ||
|
||||
(mysql_version >= 110000 && mysql_version < 110002)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Check if a collation has changed ID since the given version.
|
||||
Return the new ID.
|
||||
|
||||
@param mysql_version
|
||||
@param cs_number - collation ID
|
||||
|
||||
@retval the new collation ID (or cs_number, if no change)
|
||||
*/
|
||||
|
||||
static uint upgrade_collation_id(ulong mysql_version, uint cs_number)
|
||||
{
|
||||
if (mysql_version >= 50300 && mysql_version <= 50399)
|
||||
{
|
||||
switch (cs_number) {
|
||||
case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci
|
||||
case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci
|
||||
}
|
||||
}
|
||||
if ((mysql_version >= 50500 && mysql_version <= 50599) ||
|
||||
(mysql_version >= 100000 && mysql_version <= 100005))
|
||||
{
|
||||
switch (cs_number) {
|
||||
case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci
|
||||
case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci
|
||||
case 214: return MY_PAGE2_COLLATION_ID_UTF32; // utf32_croatian_ci
|
||||
case 215: return MY_PAGE2_COLLATION_ID_UTF16; // utf16_croatian_ci
|
||||
case 245: return MY_PAGE2_COLLATION_ID_UTF8MB4;// utf8mb4_croatian_ci
|
||||
}
|
||||
}
|
||||
return cs_number;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user