mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-14293: MyRocks lacks basic functionality
The error "Unsupported collation on string indexed column %s Use binary collation (latin1_bin, binary, utf8_bin)." is misleading. Change it: - It is now a warning - It is printed only for collations that do not support index-only access (reversible collations that use unpack_info are ok) - The new warning text is: Indexed column %s.%s uses a collation that does not allow index-only access in secondary key and has reduced disk space efficiency in primary key.
This commit is contained in:
@@ -7753,3 +7753,6 @@ ER_GEOJSON_EMPTY_COORDINATES
|
||||
ER_MYROCKS_CANT_NOPAD_COLLATION
|
||||
eng "MyRocks doesn't currently support collations with \"No pad\" attribute."
|
||||
|
||||
ER_MYROCKS_COLLATION_IS_LIMITED
|
||||
eng "Indexed column %s.%s uses a collation that does not allow index-only access in secondary key and has reduced disk space efficiency in primary key."
|
||||
|
||||
|
@@ -5958,8 +5958,10 @@ rdb_is_index_collation_supported(const my_core::Field *const field) {
|
||||
/* Handle [VAR](CHAR|BINARY) or TEXT|BLOB */
|
||||
if (type == MYSQL_TYPE_VARCHAR || type == MYSQL_TYPE_STRING ||
|
||||
type == MYSQL_TYPE_BLOB) {
|
||||
return RDB_INDEX_COLLATIONS.find(field->charset()->number) !=
|
||||
RDB_INDEX_COLLATIONS.end();
|
||||
|
||||
return (RDB_INDEX_COLLATIONS.find(field->charset()->number) !=
|
||||
RDB_INDEX_COLLATIONS.end()) ||
|
||||
rdb_is_collation_supported(field->charset());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -6118,18 +6120,10 @@ int ha_rocksdb::create_cfs(
|
||||
!rdb_is_index_collation_supported(
|
||||
table_arg->key_info[i].key_part[part].field) &&
|
||||
!rdb_collation_exceptions->matches(tablename_sys)) {
|
||||
std::string collation_err;
|
||||
for (const auto &coll : RDB_INDEX_COLLATIONS) {
|
||||
if (collation_err != "") {
|
||||
collation_err += ", ";
|
||||
}
|
||||
collation_err += get_charset_name(coll);
|
||||
}
|
||||
my_error(ER_UNSUPPORTED_COLLATION, MYF(0),
|
||||
|
||||
my_error(ER_MYROCKS_COLLATION_IS_LIMITED, MYF(ME_JUST_WARNING),
|
||||
tbl_def_arg->full_tablename().c_str(),
|
||||
table_arg->key_info[i].key_part[part].field->field_name,
|
||||
collation_err.c_str());
|
||||
DBUG_RETURN(HA_EXIT_FAILURE);
|
||||
table_arg->key_info[i].key_part[part].field->field_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -279,8 +279,15 @@ DROP TABLE t1;
|
||||
set @tmp_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check;
|
||||
set global rocksdb_strict_collation_check=1;
|
||||
CREATE TABLE t1 (a INT, b TEXT);
|
||||
# MariaDB no longer gives ER_UNSUPPORTED_COLLATION
|
||||
ALTER TABLE t1 ADD KEY kb(b(10));
|
||||
ERROR HY000: Unsupported collation on string indexed column test.t1.b Use binary collation (latin1_bin, binary, utf8_bin).
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b TEXT collate utf8_general_ci);
|
||||
# MariaDB no longer gives ER_UNSUPPORTED_COLLATION
|
||||
ALTER TABLE t1 ADD KEY kb(b(10));
|
||||
Warnings:
|
||||
Warning 4078 Indexed column test.t1.b uses a collation that does not allow index-only access in secondary key and has reduced disk space efficiency in primary key.
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
DROP TABLE t1;
|
||||
set global rocksdb_strict_collation_check= @tmp_rocksdb_strict_collation_check;
|
||||
|
@@ -173,10 +173,17 @@ set @tmp_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check;
|
||||
set global rocksdb_strict_collation_check=1;
|
||||
CREATE TABLE t1 (a INT, b TEXT);
|
||||
|
||||
--error ER_UNSUPPORTED_COLLATION
|
||||
--echo # MariaDB no longer gives ER_UNSUPPORTED_COLLATION
|
||||
ALTER TABLE t1 ADD KEY kb(b(10));
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a INT, b TEXT collate utf8_general_ci);
|
||||
--echo # MariaDB no longer gives ER_UNSUPPORTED_COLLATION
|
||||
ALTER TABLE t1 ADD KEY kb(b(10));
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a);
|
||||
DROP TABLE t1;
|
||||
|
||||
set global rocksdb_strict_collation_check= @tmp_rocksdb_strict_collation_check;
|
||||
|
||||
# make sure race condition between connection close and alter on another
|
||||
|
@@ -2921,7 +2921,7 @@ std::array<const Rdb_collation_codec *, MY_ALL_CHARSETS_SIZE>
|
||||
rdb_collation_data;
|
||||
mysql_mutex_t rdb_collation_data_mutex;
|
||||
|
||||
static bool rdb_is_collation_supported(const my_core::CHARSET_INFO *const cs) {
|
||||
bool rdb_is_collation_supported(const my_core::CHARSET_INFO *const cs) {
|
||||
return cs->strxfrm_multiply==1 && cs->mbmaxlen == 1 &&
|
||||
!(cs->state & (MY_CS_BINSORT | MY_CS_NOPAD));
|
||||
}
|
||||
|
@@ -1358,4 +1358,6 @@ struct Rdb_index_info {
|
||||
uint64 m_ttl_duration = 0;
|
||||
};
|
||||
|
||||
bool rdb_is_collation_supported(const my_core::CHARSET_INFO *const cs);
|
||||
|
||||
} // namespace myrocks
|
||||
|
Reference in New Issue
Block a user