Skip to content
Permalink
Browse files

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.
  • Loading branch information...
vuvova committed Mar 10, 2017
1 parent 76a262c commit 9ce639af5217f877fd9e4b93d1b0ecd0ef0dfd80
@@ -360,7 +360,7 @@ struct my_collation_handler_st
};

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_simple_nopad_ci_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;
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_big5_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp1250_czech_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_korean_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_korean_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_german2_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin2_czech_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_thai_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_thai_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_nopad_bin;
extern MYSQL_PLUGIN_IMPORT 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 MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_unicode_ci;
extern MYSQL_PLUGIN_IMPORT 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 MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_nopad_bin;
extern MYSQL_PLUGIN_IMPORT 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 MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT 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_big5_bin;
extern struct charset_info_st my_charset_big5_chinese_ci;
extern struct charset_info_st my_charset_big5_nopad_bin;
extern struct charset_info_st my_charset_big5_chinese_nopad_ci;
extern struct charset_info_st my_charset_cp1250_czech_ci;
extern struct charset_info_st my_charset_cp932_bin;
extern struct charset_info_st my_charset_cp932_japanese_ci;
extern struct charset_info_st my_charset_cp932_nopad_bin;
extern struct charset_info_st my_charset_cp932_japanese_nopad_ci;
extern struct charset_info_st my_charset_eucjpms_bin;
extern struct charset_info_st my_charset_eucjpms_japanese_ci;
extern struct charset_info_st my_charset_eucjpms_nopad_bin;
extern struct charset_info_st my_charset_eucjpms_japanese_nopad_ci;
extern struct charset_info_st my_charset_euckr_bin;
extern struct charset_info_st my_charset_euckr_korean_ci;
extern struct charset_info_st my_charset_euckr_nopad_bin;
extern struct charset_info_st my_charset_euckr_korean_nopad_ci;
extern struct charset_info_st my_charset_gb2312_bin;
extern struct charset_info_st my_charset_gb2312_chinese_ci;
extern struct charset_info_st my_charset_gb2312_nopad_bin;
extern struct charset_info_st my_charset_gb2312_chinese_nopad_ci;
extern struct charset_info_st my_charset_gbk_bin;
extern struct charset_info_st my_charset_gbk_chinese_ci;
extern struct charset_info_st my_charset_gbk_nopad_bin;
extern struct charset_info_st my_charset_gbk_chinese_nopad_ci;
extern struct charset_info_st my_charset_latin1_bin;
extern struct charset_info_st my_charset_latin1_nopad_bin;
extern struct charset_info_st my_charset_latin1_german2_ci;
extern struct charset_info_st my_charset_latin2_czech_ci;
extern struct charset_info_st my_charset_sjis_bin;
extern struct charset_info_st my_charset_sjis_japanese_ci;
extern struct charset_info_st my_charset_sjis_nopad_bin;
extern struct charset_info_st my_charset_sjis_japanese_nopad_ci;
extern struct charset_info_st my_charset_tis620_bin;
extern struct charset_info_st my_charset_tis620_thai_ci;
extern struct charset_info_st my_charset_tis620_nopad_bin;
extern struct charset_info_st my_charset_tis620_thai_nopad_ci;
extern struct charset_info_st my_charset_ucs2_bin;
extern struct charset_info_st my_charset_ucs2_general_ci;
extern struct charset_info_st my_charset_ucs2_nopad_bin;
extern struct charset_info_st my_charset_ucs2_general_nopad_ci;
extern struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern struct charset_info_st my_charset_ucs2_unicode_ci;
extern struct charset_info_st my_charset_ucs2_unicode_nopad_ci;
extern struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern struct charset_info_st my_charset_ujis_bin;
extern struct charset_info_st my_charset_ujis_japanese_ci;
extern struct charset_info_st my_charset_ujis_nopad_bin;
extern struct charset_info_st my_charset_ujis_japanese_nopad_ci;
extern struct charset_info_st my_charset_utf16_bin;
extern struct charset_info_st my_charset_utf16_general_ci;
extern struct charset_info_st my_charset_utf16_unicode_ci;
extern struct charset_info_st my_charset_utf16_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf16le_bin;
extern struct charset_info_st my_charset_utf16le_general_ci;
extern struct charset_info_st my_charset_utf16_general_nopad_ci;
extern struct charset_info_st my_charset_utf16_nopad_bin;
extern struct charset_info_st my_charset_utf16le_nopad_bin;
extern struct charset_info_st my_charset_utf16le_general_nopad_ci;
extern struct charset_info_st my_charset_utf32_bin;
extern struct charset_info_st my_charset_utf32_general_ci;
extern struct charset_info_st my_charset_utf32_unicode_ci;
extern struct charset_info_st my_charset_utf32_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf32_nopad_bin;
extern struct charset_info_st my_charset_utf32_general_nopad_ci;
extern struct charset_info_st my_charset_utf8_bin;
extern struct charset_info_st my_charset_utf8_nopad_bin;
extern struct charset_info_st my_charset_utf8_general_nopad_ci;
extern struct charset_info_st my_charset_utf8_general_mysql500_ci;
extern struct charset_info_st my_charset_utf8_unicode_ci;
extern struct charset_info_st my_charset_utf8_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf8mb4_bin;
extern struct charset_info_st my_charset_utf8mb4_general_ci;
extern struct charset_info_st my_charset_utf8mb4_nopad_bin;
extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci;
extern struct charset_info_st my_charset_utf8mb4_unicode_ci;
extern struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci;

#define MY_UTF8MB3 "utf8"
#define MY_UTF8MB4 "utf8mb4"
@@ -4827,16 +4827,16 @@ bool ha_rocksdb::get_error_message(const int error, String *const buf) {
}

/* MyRocks supports only the following collations for indexed columns */
static const std::set<const my_core::CHARSET_INFO *> RDB_INDEX_COLLATIONS = {
&my_charset_bin, &my_charset_utf8_bin, &my_charset_latin1_bin};
static const std::set<uint> RDB_INDEX_COLLATIONS = {
COLLATION_BINARY, COLLATION_UTF8_BIN, COLLATION_LATIN1_BIN};

static bool
rdb_is_index_collation_supported(const my_core::Field *const field) {
const my_core::enum_field_types type = field->real_type();
/* 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()) !=
return RDB_INDEX_COLLATIONS.find(field->charset()->number) !=
RDB_INDEX_COLLATIONS.end();
}
return true;
@@ -4971,7 +4971,7 @@ int ha_rocksdb::create_cfs(
if (collation_err != "") {
collation_err += ", ";
}
collation_err += coll->name;
collation_err += get_charset_name(coll);
}
my_printf_error(
ER_UNKNOWN_ERROR, "Unsupported collation on string indexed "
@@ -201,6 +201,17 @@ const char *const RDB_CF_NAME_QUALIFIER = "cfname";
#define RDB_BQUAL_SZ 1
#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
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;
set global rocksdb_strict_collation_check=1;
CREATE TABLE t1 (a INT, b TEXT);
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);
DROP TABLE t1;
set global rocksdb_strict_collation_check= @tmp_rocksdb_strict_collation_check;

0 comments on commit 9ce639a

Please sign in to comment.
You can’t perform that action at this time.