From 80fe6268f7a110abf383866fd9db3d2fbee332a8 Mon Sep 17 00:00:00 2001 From: Ramil Kalimullin Date: Mon, 26 Jan 2009 10:35:15 +0400 Subject: Fix for bug #37756: enabling fulltext indexes with myisam_repair_threads > 1 causes crash Problem: parallel repair (myisam_repair_threads > 1) of a myisam table with two or more fulltext keys that use the same parser may lead to a server crash. ALTER TABLE ENABLE KEYS is affected as well. Fix: properly initialize fulltext structures for parallel repair. Note: 1. there's no deterministic test case. 2. now we call parser->init() for each fulltext key (not for each fulltext parser used). storage/myisam/ft_parser.c: Fix for bug #37756: enabling fulltext indexes with myisam_repair_threads > 1 causes crash In ftparser_call_initializer() we "group" parsers and allocate parameters for each unique parser used. In case of parallel repairing we may have a bunch of parsers that use the only MI_INFO structure. Each of these parsers must have its own parameter structure in order not to interfere with others. Moreover, the allocation is done without mutex lock so parallel ftparser_call_initializer() calls are unsafe. Now we don't "group" the fulltext parsers. Parameter allocation code moved to ftparser_alloc_param() function which is called from mi_repair_parallel() as well to allocate parameters for each parser used. storage/myisam/ftdefs.h: Fix for bug #37756: enabling fulltext indexes with myisam_repair_threads > 1 causes crash ftparser_alloc_param(MI_INFO *info) added. storage/myisam/mi_check.c: Fix for bug #37756: enabling fulltext indexes with myisam_repair_threads > 1 causes crash ftparser_alloc_param(info) called in case of parallel repair to allocate fulltext parser parameters. storage/myisam/mi_open.c: Fix for bug #37756: enabling fulltext indexes with myisam_repair_threads > 1 causes crash set keyinfo->ftkey_nr and share->ftkeys. --- include/myisam.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/myisam.h') diff --git a/include/myisam.h b/include/myisam.h index 16175547367..d7bfdf7191e 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -185,7 +185,7 @@ typedef struct st_mi_keydef /* Key definition with open & info */ uint16 maxlength; /* max length of (packed) key (auto) */ uint16 block_size_index; /* block_size (auto) */ uint32 version; /* For concurrent read/write */ - uint32 ftparser_nr; /* distinct ftparser number */ + uint32 ftkey_nr; /* full-text index number */ HA_KEYSEG *seg,*end; struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */ -- cgit v1.2.1