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 | dac9e51811a6c4cee0a4ab127f4d264d80a07962 (patch) | |
tree | 9bc94d6dd78b23d3ce99ca324e4259942ff61cc2 /storage/myisam/ft_boolean_search.c | |
parent | 1750b79fd15e0ebc95a29123c18053fb7154ea3c (diff) | |
download | mariadb-git-dac9e51811a6c4cee0a4ab127f4d264d80a07962.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.
mysql-test/r/fulltext.result:
A test case for BUG#50351.
mysql-test/t/fulltext.test:
A test case for BUG#50351.
storage/myisam/ft_boolean_search.c:
When going up to first-level tree, we need to restore docid[0],
so it informs fulltext index merge not to enter this second-level
tree again (avoiding dead-loop).
Diffstat (limited to 'storage/myisam/ft_boolean_search.c')
-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; |