diff options
author | Sergey Vojtovich <svoj@sun.com> | 2010-02-02 15:08:49 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@sun.com> | 2010-02-02 15:08:49 +0400 |
commit | 37934f862ec7952f6baeb5c5c323e37b151aa298 (patch) | |
tree | 9bc94d6dd78b23d3ce99ca324e4259942ff61cc2 /storage | |
parent | a5618bfa15f0c37d44836c5c20a84ff98be3914d (diff) | |
download | mariadb-git-37934f862ec7952f6baeb5c5c323e37b151aa298.tar.gz |
BUG#50351 - ft_min_word_len=2 Causes query to hang
Performing fulltext prefix search (a word with truncation
operator) may cause a dead-loop. ft_min_word_len value
doesn't matter actually.
The problem was introduced along with "smarter index merge"
optimization.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/myisam/ft_boolean_search.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 492261c5efc..52ad6b11aa1 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -437,8 +437,18 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) return 0; } - /* going up to the first-level tree to continue search there */ + /* + Going up to the first-level tree to continue search there. + Only done when performing prefix search. + + Key buffer data pointer as well as docid[0] may be smaller + than values we got while searching first-level tree. Thus + they must be restored to original values to avoid dead-loop, + when subsequent search for a bigger value eventually ends up + in this same second-level tree. + */ _mi_dpointer(info, (uchar*) (lastkey_buf+HA_FT_WLEN), ftbw->key_root); + ftbw->docid[0]= ftbw->key_root; ftbw->key_root=info->s->state.key_root[ftb->keynr]; ftbw->keyinfo=info->s->keyinfo+ftb->keynr; ftbw->off=0; |