Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

Commit 052a8b8

Browse files
author
Shaohua Wang
committed
BUG#22963169 MYSQL CRASHES ON CREATE FULLTEXT INDEX
The crash is because of length mismatch. since the max length for FTS token now is larger than 255, so we will need to signify length byte itself, so only 1 to 128 bytes can be used for 1 bytes, larger than that 2 bytes. Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com> RB: 12334
1 parent cfd5ee1 commit 052a8b8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

storage/innobase/row/row0ftsort.cc

+12-2
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,18 @@ row_merge_fts_doc_tokenize(
512512
dfield_dup(field, buf->heap);
513513

514514
/* One variable length column, word with its lenght less than
515-
fts_max_token_size, add one extra size and one extra byte */
516-
cur_len += 2;
515+
fts_max_token_size, add one extra size and one extra byte.
516+
517+
Since the max length for FTS token now is larger than 255,
518+
so we will need to signify length byte itself, so only 1 to 128
519+
bytes can be used for 1 bytes, larger than that 2 bytes. */
520+
if (t_str.f_len < 128) {
521+
/* Extra size is one byte. */
522+
cur_len += 2;
523+
} else {
524+
/* Extra size is two bytes. */
525+
cur_len += 3;
526+
}
517527

518528
/* Reserve one byte for the end marker of row_merge_block_t. */
519529
if (buf->total_size + data_size[idx] + cur_len

0 commit comments

Comments
 (0)