Skip to content

Commit 732672c

Browse files
committed
MDEV-11233 CREATE FULLTEXT INDEX with a token longer than 127 bytes
crashes server This bug is the result of merging the Oracle MySQL follow-up fix BUG#22963169 MYSQL CRASHES ON CREATE FULLTEXT INDEX without merging the base bug fix: Bug#79475 Insert a token of 84 4-bytes chars into fts index causes server crash. Unlike the above mentioned fixes in MySQL, our fix will not change the storage format of fulltext indexes in InnoDB or XtraDB when a character encoding with mbmaxlen=2 or mbmaxlen=3 and the length of a word is between 128 and 84*mbmaxlen bytes. The Oracle fix would allocate 2 length bytes for these cases. Compatibility with other MySQL and MariaDB releases is ensured by persisting the used maximum length in the SYS_COLUMNS table in the InnoDB data dictionary. This fix also removes some unnecessary strcmp() calls when checking for the legacy default collation my_charset_latin1 (my_charset_latin1.name=="latin1_swedish_ci"). fts_create_one_index_table(): Store the actual length in bytes. This metadata will be written to the SYS_COLUMNS table. fts_zip_initialize(): Initialize only the first byte of the buffer. Actually the code should not even care about this first byte, because the length is set as 0. FTX_MAX_WORD_LEN: Define as HA_FT_MAXCHARLEN * 4 aka 336 bytes, not as 254 bytes. row_merge_create_fts_sort_index(): Set the actual maximum length of the column in bytes, similar to fts_create_one_index_table(). row_merge_fts_doc_tokenize(): Remove the redundant parameter word_dtype. Use the actual maximum length of the column. Calculate the extra_size in the same way as row_merge_buf_encode() does.
1 parent afb4615 commit 732672c

File tree

13 files changed

+365
-108
lines changed

13 files changed

+365
-108
lines changed
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
SET NAMES utf8mb4;
2+
#
3+
# MDEV-11233 CREATE FULLTEXT INDEX with a token
4+
# longer than 127 bytes crashes server
5+
#
6+
CREATE TABLE t(t TEXT CHARACTER SET utf8mb3) ENGINE=InnoDB;
7+
INSERT INTO t SET t=REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5);
8+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84);
9+
INSERT INTO t SET t=REPEAT('befor',17);
10+
INSERT INTO t SET t='BeforeTheIndexCreation';
11+
CREATE FULLTEXT INDEX ft ON t(t);
12+
Warnings:
13+
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
14+
INSERT INTO t SET t='this was inserted after creating the index';
15+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84);
16+
INSERT INTO t SET t=REPEAT('after',17);
17+
INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15);
18+
# The data below is not 3-byte UTF-8, but 4-byte chars.
19+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84);
20+
Warnings:
21+
Warning 1366 Incorrect string value: '\xF0\x9F\x96\x95\xF0\x9F...' for column 't' at row 1
22+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85);
23+
Warnings:
24+
Warning 1366 Incorrect string value: '\xF0\x9F\x96\x96\xF0\x9F...' for column 't' at row 1
25+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST
26+
(REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5));
27+
COUNT(*)
28+
1
29+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation');
30+
COUNT(*)
31+
1
32+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17));
33+
COUNT(*)
34+
0
35+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after');
36+
COUNT(*)
37+
1
38+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17));
39+
COUNT(*)
40+
0
41+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83));
42+
COUNT(*)
43+
0
44+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84));
45+
COUNT(*)
46+
1
47+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85));
48+
COUNT(*)
49+
0
50+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83));
51+
COUNT(*)
52+
0
53+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84));
54+
COUNT(*)
55+
1
56+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85));
57+
COUNT(*)
58+
0
59+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83));
60+
COUNT(*)
61+
0
62+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84));
63+
COUNT(*)
64+
0
65+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84));
66+
COUNT(*)
67+
0
68+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85));
69+
COUNT(*)
70+
0
71+
SELECT * FROM t;
72+
t
73+
็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้
74+
000000000000000000000000000000000000000000000000000000000000000000000000000000000000
75+
beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor
76+
BeforeTheIndexCreation
77+
this was inserted after creating the index
78+
111111111111111111111111111111111111111111111111111111111111111111111111111111111111
79+
afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter
80+
甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文
81+
????????????????????????????????????????????????????????????????????????????????????
82+
?????????????????????????????????????????????????????????????????????????????????????
83+
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
84+
len COUNT(*)
85+
252 6
86+
DROP TABLE t;
87+
CREATE TABLE t(t TEXT CHARACTER SET utf8mb4) ENGINE=InnoDB;
88+
INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15);
89+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84);
90+
INSERT INTO t SET t=REPEAT('befor',17);
91+
INSERT INTO t SET t='BeforeTheIndexCreation';
92+
CREATE FULLTEXT INDEX ft ON t(t);
93+
Warnings:
94+
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
95+
INSERT INTO t SET t='this was inserted after creating the index';
96+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84);
97+
INSERT INTO t SET t=REPEAT('after',17);
98+
INSERT INTO t SET t=REPEAT(concat(repeat(_utf8mb3 0xE0B987, 4), repeat(_utf8mb3 0xE0B989, 5)), 5);
99+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84);
100+
# The token below exceeds the 84-character limit.
101+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85);
102+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15));
103+
COUNT(*)
104+
1
105+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation');
106+
COUNT(*)
107+
1
108+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17));
109+
COUNT(*)
110+
0
111+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after');
112+
COUNT(*)
113+
1
114+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17));
115+
COUNT(*)
116+
0
117+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83));
118+
COUNT(*)
119+
0
120+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84));
121+
COUNT(*)
122+
1
123+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85));
124+
COUNT(*)
125+
0
126+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83));
127+
COUNT(*)
128+
0
129+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84));
130+
COUNT(*)
131+
1
132+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85));
133+
COUNT(*)
134+
0
135+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83));
136+
COUNT(*)
137+
0
138+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84));
139+
COUNT(*)
140+
0
141+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84));
142+
COUNT(*)
143+
0
144+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85));
145+
COUNT(*)
146+
0
147+
SELECT * FROM t;
148+
t
149+
甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文
150+
000000000000000000000000000000000000000000000000000000000000000000000000000000000000
151+
beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor
152+
BeforeTheIndexCreation
153+
this was inserted after creating the index
154+
111111111111111111111111111111111111111111111111111111111111111111111111111111111111
155+
afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter
156+
็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้
157+
🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕
158+
🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖
159+
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
160+
len COUNT(*)
161+
336 6
162+
DROP TABLE t;
163+
CREATE TABLE t(t TEXT CHARACTER SET latin1, FULLTEXT INDEX(t))
164+
ENGINE=InnoDB;
165+
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
166+
len COUNT(*)
167+
84 6
168+
DROP TABLE t;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--loose-innodb-sys-columns
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
--source include/have_innodb.inc
2+
SET NAMES utf8mb4;
3+
4+
--echo #
5+
--echo # MDEV-11233 CREATE FULLTEXT INDEX with a token
6+
--echo # longer than 127 bytes crashes server
7+
--echo #
8+
9+
# This bug is the result of merging the Oracle MySQL follow-up fix
10+
# BUG#22963169 MYSQL CRASHES ON CREATE FULLTEXT INDEX
11+
# without merging a fix of Bug#79475 Insert a token of 84 4-bytes
12+
# chars into fts index causes server crash.
13+
14+
# Oracle did not publish tests for either of the above MySQL bugs.
15+
# The tests below were developed for MariaDB Server.
16+
# The maximum length of a fulltext-indexed word is 84 characters.
17+
18+
CREATE TABLE t(t TEXT CHARACTER SET utf8mb3) ENGINE=InnoDB;
19+
INSERT INTO t SET t=REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5);
20+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84);
21+
INSERT INTO t SET t=REPEAT('befor',17); # too long, will not be indexed
22+
INSERT INTO t SET t='BeforeTheIndexCreation';
23+
CREATE FULLTEXT INDEX ft ON t(t);
24+
INSERT INTO t SET t='this was inserted after creating the index';
25+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84);
26+
INSERT INTO t SET t=REPEAT('after',17); # too long, will not be indexed
27+
INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15);
28+
--echo # The data below is not 3-byte UTF-8, but 4-byte chars.
29+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84);
30+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85);
31+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST
32+
(REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5));
33+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation');
34+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17));
35+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after');
36+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17));
37+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83));
38+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84));
39+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85));
40+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83));
41+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84));
42+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85));
43+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83));
44+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84));
45+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84));
46+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85));
47+
SELECT * FROM t;
48+
49+
# The column length should be 252 bytes (84 characters * 3 bytes/character).
50+
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
51+
DROP TABLE t;
52+
53+
CREATE TABLE t(t TEXT CHARACTER SET utf8mb4) ENGINE=InnoDB;
54+
INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15);
55+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84);
56+
INSERT INTO t SET t=REPEAT('befor',17); # too long, will not be indexed
57+
INSERT INTO t SET t='BeforeTheIndexCreation';
58+
CREATE FULLTEXT INDEX ft ON t(t);
59+
INSERT INTO t SET t='this was inserted after creating the index';
60+
INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84);
61+
INSERT INTO t SET t=REPEAT('after',17); # too long, will not be indexed
62+
INSERT INTO t SET t=REPEAT(concat(repeat(_utf8mb3 0xE0B987, 4), repeat(_utf8mb3 0xE0B989, 5)), 5);
63+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84);
64+
--echo # The token below exceeds the 84-character limit.
65+
INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85);
66+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15));
67+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation');
68+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17));
69+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after');
70+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17));
71+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83));
72+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84));
73+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85));
74+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83));
75+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84));
76+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85));
77+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83));
78+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84));
79+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84));
80+
SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85));
81+
SELECT * FROM t;
82+
83+
# The column length should be 336 bytes (84 characters * 4 bytes/character).
84+
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
85+
DROP TABLE t;
86+
87+
CREATE TABLE t(t TEXT CHARACTER SET latin1, FULLTEXT INDEX(t))
88+
ENGINE=InnoDB;
89+
90+
# The column length should be 84 bytes (84 characters * 1 byte/character).
91+
SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len;
92+
DROP TABLE t;

storage/innobase/fts/fts0fts.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
4+
Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
45
56
This program is free software; you can redistribute it and/or modify it under
67
the terms of the GNU General Public License as published by the Free Software
@@ -1934,6 +1935,8 @@ fts_create_common_tables(
19341935
/*************************************************************//**
19351936
Wrapper function of fts_create_index_tables_low(), create auxiliary
19361937
tables for an FTS index
1938+
1939+
@see row_merge_create_fts_sort_index()
19371940
@return: DB_SUCCESS or error code */
19381941
static
19391942
dict_table_t*
@@ -1965,13 +1968,12 @@ fts_create_one_index_table(
19651968
(int)(field->col->prtype & DATA_MYSQL_TYPE_MASK),
19661969
(uint) dtype_get_charset_coll(field->col->prtype));
19671970

1968-
if (strcmp(charset->name, "latin1_swedish_ci") == 0) {
1969-
dict_mem_table_add_col(new_table, heap, "word", DATA_VARCHAR,
1970-
field->col->prtype, FTS_MAX_WORD_LEN);
1971-
} else {
1972-
dict_mem_table_add_col(new_table, heap, "word", DATA_VARMYSQL,
1973-
field->col->prtype, FTS_MAX_WORD_LEN);
1974-
}
1971+
dict_mem_table_add_col(new_table, heap, "word",
1972+
charset == &my_charset_latin1
1973+
? DATA_VARCHAR : DATA_VARMYSQL,
1974+
field->col->prtype,
1975+
FTS_MAX_WORD_LEN_IN_CHAR
1976+
* DATA_MBMAXLEN(field->col->mbminmaxlen));
19751977

19761978
dict_mem_table_add_col(new_table, heap, "first_doc_id", DATA_INT,
19771979
DATA_NOT_NULL | DATA_UNSIGNED,

storage/innobase/fts/fts0opt.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
4+
Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
45
56
This program is free software; you can redistribute it and/or modify it under
67
the terms of the GNU General Public License as published by the Free Software
@@ -281,7 +282,7 @@ fts_zip_initialize(
281282
zip->last_big_block = 0;
282283

283284
zip->word.f_len = 0;
284-
memset(zip->word.f_str, 0, FTS_MAX_WORD_LEN);
285+
*zip->word.f_str = 0;
285286

286287
ib_vector_reset(zip->blocks);
287288

storage/innobase/handler/ha_innodb.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,6 @@ innobase_init(
35393539
and consequently we do not need to know the ordering internally in
35403540
InnoDB. */
35413541

3542-
ut_a(0 == strcmp(my_charset_latin1.name, "latin1_swedish_ci"));
35433542
srv_latin1_ordering = my_charset_latin1.sort_order;
35443543

35453544
innobase_commit_concurrency_init_default();
@@ -6149,18 +6148,16 @@ get_innobase_type_from_mysql_type(
61496148
case MYSQL_TYPE_VARCHAR: /* new >= 5.0.3 true VARCHAR */
61506149
if (field->binary()) {
61516150
return(DATA_BINARY);
6152-
} else if (strcmp(field->charset()->name,
6153-
"latin1_swedish_ci") == 0) {
6151+
} else if (field->charset() == &my_charset_latin1) {
61546152
return(DATA_VARCHAR);
61556153
} else {
61566154
return(DATA_VARMYSQL);
61576155
}
61586156
case MYSQL_TYPE_BIT:
6159-
case MYSQL_TYPE_STRING: if (field->binary()) {
6160-
6157+
case MYSQL_TYPE_STRING:
6158+
if (field->binary()) {
61616159
return(DATA_FIXBINARY);
6162-
} else if (strcmp(field->charset()->name,
6163-
"latin1_swedish_ci") == 0) {
6160+
} else if (field->charset() == &my_charset_latin1) {
61646161
return(DATA_CHAR);
61656162
} else {
61666163
return(DATA_MYSQL);

storage/innobase/include/fts0fts.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
4+
Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
45
56
This program is free software; you can redistribute it and/or modify it under
67
the terms of the GNU General Public License as published by the Free Software
@@ -366,8 +367,8 @@ extern ulong fts_min_token_size;
366367
need a sync to free some memory */
367368
extern bool fts_need_sync;
368369

369-
/** Maximum possible Fulltext word length */
370-
#define FTS_MAX_WORD_LEN HA_FT_MAXBYTELEN
370+
/** Maximum possible Fulltext word length in bytes (assuming mbmaxlen=4) */
371+
#define FTS_MAX_WORD_LEN (HA_FT_MAXCHARLEN * 4)
371372

372373
/** Maximum possible Fulltext word length (in characters) */
373374
#define FTS_MAX_WORD_LEN_IN_CHAR HA_FT_MAXCHARLEN

0 commit comments

Comments
 (0)