Commit 9ce639af authored by Sergei Golubchik's avatar Sergei Golubchik

don't export all charsets to plugins

don't use internal server collation symbol names, use collation
properties and collation IDs, they are much more stable.
parent 76a262cd
...@@ -360,7 +360,7 @@ struct my_collation_handler_st ...@@ -360,7 +360,7 @@ struct my_collation_handler_st
}; };
extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MYSQL_PLUGIN_IMPORT MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler;
extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
...@@ -586,83 +586,83 @@ extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad; ...@@ -586,83 +586,83 @@ extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_ci; extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_bin; extern struct charset_info_st my_charset_big5_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_chinese_ci; extern struct charset_info_st my_charset_big5_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_nopad_bin; extern struct charset_info_st my_charset_big5_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_chinese_nopad_ci; extern struct charset_info_st my_charset_big5_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp1250_czech_ci; extern struct charset_info_st my_charset_cp1250_czech_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_bin; extern struct charset_info_st my_charset_cp932_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_japanese_ci; extern struct charset_info_st my_charset_cp932_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_nopad_bin; extern struct charset_info_st my_charset_cp932_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_japanese_nopad_ci; extern struct charset_info_st my_charset_cp932_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_bin; extern struct charset_info_st my_charset_eucjpms_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_japanese_ci; extern struct charset_info_st my_charset_eucjpms_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_nopad_bin; extern struct charset_info_st my_charset_eucjpms_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_japanese_nopad_ci; extern struct charset_info_st my_charset_eucjpms_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_bin; extern struct charset_info_st my_charset_euckr_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_korean_ci; extern struct charset_info_st my_charset_euckr_korean_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_nopad_bin; extern struct charset_info_st my_charset_euckr_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_korean_nopad_ci; extern struct charset_info_st my_charset_euckr_korean_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_bin; extern struct charset_info_st my_charset_gb2312_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_chinese_ci; extern struct charset_info_st my_charset_gb2312_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_nopad_bin; extern struct charset_info_st my_charset_gb2312_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_chinese_nopad_ci; extern struct charset_info_st my_charset_gb2312_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_bin; extern struct charset_info_st my_charset_gbk_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_chinese_ci; extern struct charset_info_st my_charset_gbk_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_nopad_bin; extern struct charset_info_st my_charset_gbk_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_chinese_nopad_ci; extern struct charset_info_st my_charset_gbk_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_bin; extern struct charset_info_st my_charset_latin1_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad_bin; extern struct charset_info_st my_charset_latin1_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_german2_ci; extern struct charset_info_st my_charset_latin1_german2_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin2_czech_ci; extern struct charset_info_st my_charset_latin2_czech_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_bin; extern struct charset_info_st my_charset_sjis_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_japanese_ci; extern struct charset_info_st my_charset_sjis_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_nopad_bin; extern struct charset_info_st my_charset_sjis_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_japanese_nopad_ci; extern struct charset_info_st my_charset_sjis_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_bin; extern struct charset_info_st my_charset_tis620_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_thai_ci; extern struct charset_info_st my_charset_tis620_thai_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_nopad_bin; extern struct charset_info_st my_charset_tis620_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_thai_nopad_ci; extern struct charset_info_st my_charset_tis620_thai_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_bin; extern struct charset_info_st my_charset_ucs2_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_ci; extern struct charset_info_st my_charset_ucs2_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_nopad_bin; extern struct charset_info_st my_charset_ucs2_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_nopad_ci; extern struct charset_info_st my_charset_ucs2_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_mysql500_ci; extern struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_unicode_ci; extern struct charset_info_st my_charset_ucs2_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_unicode_nopad_ci; extern struct charset_info_st my_charset_ucs2_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_mysql500_ci; extern struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_bin; extern struct charset_info_st my_charset_ujis_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_japanese_ci; extern struct charset_info_st my_charset_ujis_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_nopad_bin; extern struct charset_info_st my_charset_ujis_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_japanese_nopad_ci; extern struct charset_info_st my_charset_ujis_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_bin; extern struct charset_info_st my_charset_utf16_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_general_ci; extern struct charset_info_st my_charset_utf16_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_unicode_ci; extern struct charset_info_st my_charset_utf16_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_unicode_nopad_ci; extern struct charset_info_st my_charset_utf16_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_bin; extern struct charset_info_st my_charset_utf16le_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_general_ci; extern struct charset_info_st my_charset_utf16le_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_general_nopad_ci; extern struct charset_info_st my_charset_utf16_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_nopad_bin; extern struct charset_info_st my_charset_utf16_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_nopad_bin; extern struct charset_info_st my_charset_utf16le_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_general_nopad_ci; extern struct charset_info_st my_charset_utf16le_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_bin; extern struct charset_info_st my_charset_utf32_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_general_ci; extern struct charset_info_st my_charset_utf32_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_unicode_ci; extern struct charset_info_st my_charset_utf32_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_unicode_nopad_ci; extern struct charset_info_st my_charset_utf32_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_nopad_bin; extern struct charset_info_st my_charset_utf32_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_general_nopad_ci; extern struct charset_info_st my_charset_utf32_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_bin; extern struct charset_info_st my_charset_utf8_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_nopad_bin; extern struct charset_info_st my_charset_utf8_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_nopad_ci; extern struct charset_info_st my_charset_utf8_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_mysql500_ci; extern struct charset_info_st my_charset_utf8_general_mysql500_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_unicode_ci; extern struct charset_info_st my_charset_utf8_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_unicode_nopad_ci; extern struct charset_info_st my_charset_utf8_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_bin; extern struct charset_info_st my_charset_utf8mb4_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_general_ci; extern struct charset_info_st my_charset_utf8mb4_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_nopad_bin; extern struct charset_info_st my_charset_utf8mb4_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_general_nopad_ci; extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_unicode_ci; extern struct charset_info_st my_charset_utf8mb4_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci; extern struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci;
#define MY_UTF8MB3 "utf8" #define MY_UTF8MB3 "utf8"
#define MY_UTF8MB4 "utf8mb4" #define MY_UTF8MB4 "utf8mb4"
......
...@@ -4827,8 +4827,8 @@ bool ha_rocksdb::get_error_message(const int error, String *const buf) { ...@@ -4827,8 +4827,8 @@ bool ha_rocksdb::get_error_message(const int error, String *const buf) {
} }
/* MyRocks supports only the following collations for indexed columns */ /* MyRocks supports only the following collations for indexed columns */
static const std::set<const my_core::CHARSET_INFO *> RDB_INDEX_COLLATIONS = { static const std::set<uint> RDB_INDEX_COLLATIONS = {
&my_charset_bin, &my_charset_utf8_bin, &my_charset_latin1_bin}; COLLATION_BINARY, COLLATION_UTF8_BIN, COLLATION_LATIN1_BIN};
static bool static bool
rdb_is_index_collation_supported(const my_core::Field *const field) { rdb_is_index_collation_supported(const my_core::Field *const field) {
...@@ -4836,7 +4836,7 @@ rdb_is_index_collation_supported(const my_core::Field *const field) { ...@@ -4836,7 +4836,7 @@ rdb_is_index_collation_supported(const my_core::Field *const field) {
/* Handle [VAR](CHAR|BINARY) or TEXT|BLOB */ /* Handle [VAR](CHAR|BINARY) or TEXT|BLOB */
if (type == MYSQL_TYPE_VARCHAR || type == MYSQL_TYPE_STRING || if (type == MYSQL_TYPE_VARCHAR || type == MYSQL_TYPE_STRING ||
type == MYSQL_TYPE_BLOB) { type == MYSQL_TYPE_BLOB) {
return RDB_INDEX_COLLATIONS.find(field->charset()) != return RDB_INDEX_COLLATIONS.find(field->charset()->number) !=
RDB_INDEX_COLLATIONS.end(); RDB_INDEX_COLLATIONS.end();
} }
return true; return true;
...@@ -4971,7 +4971,7 @@ int ha_rocksdb::create_cfs( ...@@ -4971,7 +4971,7 @@ int ha_rocksdb::create_cfs(
if (collation_err != "") { if (collation_err != "") {
collation_err += ", "; collation_err += ", ";
} }
collation_err += coll->name; collation_err += get_charset_name(coll);
} }
my_printf_error( my_printf_error(
ER_UNKNOWN_ERROR, "Unsupported collation on string indexed " ER_UNKNOWN_ERROR, "Unsupported collation on string indexed "
......
...@@ -201,6 +201,17 @@ const char *const RDB_CF_NAME_QUALIFIER = "cfname"; ...@@ -201,6 +201,17 @@ const char *const RDB_CF_NAME_QUALIFIER = "cfname";
#define RDB_BQUAL_SZ 1 #define RDB_BQUAL_SZ 1
#define RDB_XIDHDR_LEN (RDB_FORMATID_SZ + RDB_GTRID_SZ + RDB_BQUAL_SZ) #define RDB_XIDHDR_LEN (RDB_FORMATID_SZ + RDB_GTRID_SZ + RDB_BQUAL_SZ)
/* collations, used in MariaRocks */
enum collations_used {
COLLATION_UTF8MB4_BIN = 46,
COLLATION_LATIN1_BIN = 47,
COLLATION_UTF16LE_BIN = 55,
COLLATION_UTF32_BIN = 61,
COLLATION_UTF16_BIN = 62,
COLLATION_BINARY = 63,
COLLATION_UTF8_BIN = 83
};
/* /*
To fix an unhandled exception we specify the upper bound as LONGLONGMAX To fix an unhandled exception we specify the upper bound as LONGLONGMAX
instead of ULONGLONGMAX because the latter is -1 and causes an exception when instead of ULONGLONGMAX because the latter is -1 and causes an exception when
......
...@@ -280,7 +280,7 @@ set @tmp_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check; ...@@ -280,7 +280,7 @@ set @tmp_rocksdb_strict_collation_check= @@rocksdb_strict_collation_check;
set global rocksdb_strict_collation_check=1; set global rocksdb_strict_collation_check=1;
CREATE TABLE t1 (a INT, b TEXT); CREATE TABLE t1 (a INT, b TEXT);
ALTER TABLE t1 ADD KEY kb(b(10)); ALTER TABLE t1 ADD KEY kb(b(10));
ERROR HY000: Unsupported collation on string indexed column test.t1.b Use binary collation (binary, latin1_bin, utf8_bin). 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); ALTER TABLE t1 ADD PRIMARY KEY(a);
DROP TABLE t1; DROP TABLE t1;
set global rocksdb_strict_collation_check= @tmp_rocksdb_strict_collation_check; set global rocksdb_strict_collation_check= @tmp_rocksdb_strict_collation_check;
......
...@@ -3,9 +3,9 @@ DROP TABLE IF EXISTS t1; ...@@ -3,9 +3,9 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text, index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text, index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.t1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.t1.value Use binary collation (latin1_bin, binary, utf8_bin).
CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text, index(value3(50))) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text, index(value3(50))) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.t1.value3 Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.t1.value3 Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_check=0; SET GLOBAL rocksdb_strict_collation_check=0;
CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text, index(value3(50))) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), value2 varbinary(50), value3 text, index(value3(50))) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
...@@ -22,109 +22,109 @@ SET GLOBAL rocksdb_strict_collation_exceptions=t1; ...@@ -22,109 +22,109 @@ SET GLOBAL rocksdb_strict_collation_exceptions=t1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t2 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t2 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="t.*"; SET GLOBAL rocksdb_strict_collation_exceptions="t.*";
CREATE TABLE t123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t123; DROP TABLE t123;
CREATE TABLE s123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.s123.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.s123.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions=".t.*"; SET GLOBAL rocksdb_strict_collation_exceptions=".t.*";
CREATE TABLE xt123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE xt123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE xt123; DROP TABLE xt123;
CREATE TABLE t123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t123 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.t123.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.t123.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="s.*,t.*"; SET GLOBAL rocksdb_strict_collation_exceptions="s.*,t.*";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="s.*|t.*"; SET GLOBAL rocksdb_strict_collation_exceptions="s.*|t.*";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions=",s.*,t.*"; SET GLOBAL rocksdb_strict_collation_exceptions=",s.*,t.*";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="|s.*|t.*"; SET GLOBAL rocksdb_strict_collation_exceptions="|s.*|t.*";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="s.*,,t.*"; SET GLOBAL rocksdb_strict_collation_exceptions="s.*,,t.*";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="s.*||t.*"; SET GLOBAL rocksdb_strict_collation_exceptions="s.*||t.*";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="s.*,t.*,"; SET GLOBAL rocksdb_strict_collation_exceptions="s.*,t.*,";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="s.*|t.*|"; SET GLOBAL rocksdb_strict_collation_exceptions="s.*|t.*|";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="||||,,,,s.*,,|,,||,t.*,,|||,,,"; SET GLOBAL rocksdb_strict_collation_exceptions="||||,,,,s.*,,|,,||,t.*,,|||,,,";
CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE s1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE s1; DROP TABLE s1;
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE u1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.u1.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions='t1'; SET GLOBAL rocksdb_strict_collation_exceptions='t1';
CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb; CREATE TABLE t1 (id INT primary key, value varchar(50), index(value)) engine=rocksdb;
ALTER TABLE t1 AUTO_INCREMENT=1; ALTER TABLE t1 AUTO_INCREMENT=1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t2 (id INT primary key, value varchar(50), index(value)) engine=rocksdb; CREATE TABLE t2 (id INT primary key, value varchar(50), index(value)) engine=rocksdb;
ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (latin1_bin, binary, utf8_bin).
CREATE TABLE t2 (id INT primary key, value varchar(50)) engine=rocksdb; CREATE TABLE t2 (id INT primary key, value varchar(50)) engine=rocksdb;
ALTER TABLE t2 ADD INDEX(value); ALTER TABLE t2 ADD INDEX(value);
ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.t2.value Use binary collation (latin1_bin, binary, utf8_bin).
DROP TABLE t2; DROP TABLE t2;
SET GLOBAL rocksdb_strict_collation_exceptions="[a-b"; SET GLOBAL rocksdb_strict_collation_exceptions="[a-b";
Invalid pattern in strict_collation_exceptions: [a-b Invalid pattern in strict_collation_exceptions: [a-b
CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.a.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.a.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="[a-b]"; SET GLOBAL rocksdb_strict_collation_exceptions="[a-b]";
CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE a (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
CREATE TABLE b (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE b (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
CREATE TABLE c (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE c (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.c.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.c.value Use binary collation (latin1_bin, binary, utf8_bin).
DROP TABLE a, b; DROP TABLE a, b;
call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:"); call mtr.add_suppression("Invalid pattern in strict_collation_exceptions:");
SET GLOBAL rocksdb_strict_collation_exceptions="abc\\"; SET GLOBAL rocksdb_strict_collation_exceptions="abc\\";
Invalid pattern in strict_collation_exceptions: abc\ Invalid pattern in strict_collation_exceptions: abc\
CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.abc.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.abc.value Use binary collation (latin1_bin, binary, utf8_bin).
SET GLOBAL rocksdb_strict_collation_exceptions="abc"; SET GLOBAL rocksdb_strict_collation_exceptions="abc";
CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE abc (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
CREATE TABLE abcd (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8; CREATE TABLE abcd (id INT PRIMARY KEY, value varchar(50), index(value)) engine=rocksdb charset utf8;
ERROR HY000: Unsupported collation on string indexed column test.abcd.value Use binary collation (binary, latin1_bin, utf8_bin). ERROR HY000: Unsupported collation on string indexed column test.abcd.value Use binary collation (latin1_bin, binary, utf8_bin).
DROP TABLE abc; DROP TABLE abc;
SET GLOBAL rocksdb_strict_collation_exceptions=null; SET GLOBAL rocksdb_strict_collation_exceptions=null;
SET GLOBAL rocksdb_strict_collation_exceptions=@start_global_value; SET GLOBAL rocksdb_strict_collation_exceptions=@start_global_value;
...@@ -1690,7 +1690,7 @@ static int rdb_unpack_binary_or_utf8_varchar( ...@@ -1690,7 +1690,7 @@ static int rdb_unpack_binary_or_utf8_varchar(
/* /*
Now, we need to decode used_bytes of data and append them to the value. Now, we need to decode used_bytes of data and append them to the value.
*/ */
if (fpi->m_varchar_charset == &my_charset_utf8_bin) { if (fpi->m_varchar_charset->number == COLLATION_UTF8_BIN) {
if (used_bytes & 1) { if (used_bytes & 1) {
/* /*
UTF-8 characters are encoded into two-byte entities. There is no way UTF-8 characters are encoded into two-byte entities. There is no way
...@@ -1793,7 +1793,7 @@ static int rdb_unpack_binary_or_utf8_varchar_space_pad( ...@@ -1793,7 +1793,7 @@ static int rdb_unpack_binary_or_utf8_varchar_space_pad(
} }
// Now, need to decode used_bytes of data and append them to the value. // Now, need to decode used_bytes of data and append them to the value.
if (fpi->m_varchar_charset == &my_charset_utf8_bin) { if (fpi->m_varchar_charset->number == COLLATION_UTF8_BIN) {
if (used_bytes & 1) { if (used_bytes & 1) {
/* /*
UTF-8 characters are encoded into two-byte entities. There is no way UTF-8 characters are encoded into two-byte entities. There is no way
...@@ -2239,7 +2239,8 @@ std::array<const Rdb_collation_codec *, MY_ALL_CHARSETS_SIZE> ...@@ -2239,7 +2239,8 @@ std::array<const Rdb_collation_codec *, MY_ALL_CHARSETS_SIZE>
mysql_mutex_t rdb_collation_data_mutex; mysql_mutex_t rdb_collation_data_mutex;
static bool rdb_is_collation_supported(const my_core::CHARSET_INFO *const cs) { static bool rdb_is_collation_supported(const my_core::CHARSET_INFO *const cs) {
return (cs->coll == &my_collation_8bit_simple_ci_handler); return cs->strxfrm_multiply==1 && cs->mbmaxlen == 1 &&
!(cs->state & (MY_CS_BINSORT | MY_CS_NOPAD));
} }
static const Rdb_collation_codec * static const Rdb_collation_codec *
...@@ -2255,7 +2256,7 @@ rdb_init_collation_mapping(const my_core::CHARSET_INFO *const cs) { ...@@ -2255,7 +2256,7 @@ rdb_init_collation_mapping(const my_core::CHARSET_INFO *const cs) {
Rdb_collation_codec *cur = nullptr; Rdb_collation_codec *cur = nullptr;
// Compute reverse mapping for simple collations. // Compute reverse mapping for simple collations.
if (cs->coll == &my_collation_8bit_simple_ci_handler) { if (rdb_is_collation_supported(cs)) {
cur = new Rdb_collation_codec; cur = new Rdb_collation_codec;
std::map<uchar, std::vector<uchar>> rev_map; std::map<uchar, std::vector<uchar>> rev_map;
size_t max_conflict_size = 0; size_t max_conflict_size = 0;
...@@ -2302,8 +2303,8 @@ rdb_init_collation_mapping(const my_core::CHARSET_INFO *const cs) { ...@@ -2302,8 +2303,8 @@ rdb_init_collation_mapping(const my_core::CHARSET_INFO *const cs) {
static int get_segment_size_from_collation(const CHARSET_INFO *const cs) { static int get_segment_size_from_collation(const CHARSET_INFO *const cs) {
int ret; int ret;
if (cs == &my_charset_utf8mb4_bin || cs == &my_charset_utf16_bin || if (cs->number == COLLATION_UTF8MB4_BIN || cs->number == COLLATION_UTF16_BIN ||
cs == &my_charset_utf16le_bin || cs == &my_charset_utf32_bin) { cs->number == COLLATION_UTF16LE_BIN || cs->number == COLLATION_UTF32_BIN) {
/* /*
In these collations, a character produces one weight, which is 3 bytes. In these collations, a character produces one weight, which is 3 bytes.
Segment has 3 characters, add one byte for VARCHAR_CMP_* marker, and we Segment has 3 characters, add one byte for VARCHAR_CMP_* marker, and we
...@@ -2424,7 +2425,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr, ...@@ -2424,7 +2425,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr,
// //
// See Field_blob::make_sort_key for details. // See Field_blob::make_sort_key for details.
m_max_image_len = m_max_image_len =
key_length + (field->charset() == &my_charset_bin key_length + (field->charset()->number == COLLATION_BINARY
? reinterpret_cast<const Field_blob *>(field) ? reinterpret_cast<const Field_blob *>(field)
->pack_length_no_ptr() ->pack_length_no_ptr()
: 0); : 0);
...@@ -2475,7 +2476,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr, ...@@ -2475,7 +2476,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr,
DBUG_EXECUTE_IF("myrocks_enable_unknown_collation_index_only_scans", DBUG_EXECUTE_IF("myrocks_enable_unknown_collation_index_only_scans",
use_unknown_collation = true;); use_unknown_collation = true;);
if (cs == &my_charset_bin) { if (cs->number == COLLATION_BINARY) {
// - SQL layer pads BINARY(N) so that it always is N bytes long. // - SQL layer pads BINARY(N) so that it always is N bytes long.
// - For VARBINARY(N), values may have different lengths, so we're using // - For VARBINARY(N), values may have different lengths, so we're using
// variable-length encoding. This is also the only charset where the // variable-length encoding. This is also the only charset where the
...@@ -2483,7 +2484,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr, ...@@ -2483,7 +2484,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr,
m_unpack_func = is_varchar ? rdb_unpack_binary_or_utf8_varchar m_unpack_func = is_varchar ? rdb_unpack_binary_or_utf8_varchar
: rdb_unpack_binary_str; : rdb_unpack_binary_str;
res = true; res = true;
} else if (cs == &my_charset_latin1_bin || cs == &my_charset_utf8_bin) { } else if (cs->number == COLLATION_LATIN1_BIN || cs->number == COLLATION_UTF8_BIN) {
// For _bin collations, mem-comparable form of the string is the string // For _bin collations, mem-comparable form of the string is the string
// itself. // itself.
...@@ -2504,7 +2505,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr, ...@@ -2504,7 +2505,7 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr,
} else { } else {
// SQL layer pads CHAR(N) values to their maximum length. // SQL layer pads CHAR(N) values to their maximum length.
// We just store that and restore it back. // We just store that and restore it back.
m_unpack_func = (cs == &my_charset_latin1_bin) ? rdb_unpack_binary_str m_unpack_func = (cs->number == COLLATION_LATIN1_BIN) ? rdb_unpack_binary_str
: rdb_unpack_utf8_str; : rdb_unpack_utf8_str;
} }
res = true; res = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment