Commit e391417f authored by Sachin Agarwal's avatar Sachin Agarwal Committed by Marko Mäkelä

Bug #30933728 INNODB FTS PHRASE SEARCH HIT AN ASSERT

Problem:
In Full-text phrase search, we filter out row that do not contain
all the tokens in the phrase.
If we do not filter out doc_id that doesn't appear in all the
token's doc_id lists then we hit an assert.

Fix:
if any of the token has last doc_id equal to ith doc_id of the first
token doc_id list then filter out rest of the higher doc_ids.

RB: 24909
Reviewed by : Annamalai Gurusami <annamalai.gurusami@oracle.com>

This is a cherry-pick of
mysql/mysql-server@5aa075277dfe84a17a0331c57a6fe9b91dafb4cf
but without a test case, because the test case depends on an n-gram
tokenizer that will be missing from MariaDB until MDEV-10267 is added.
parent 784473b9
......@@ -4421,24 +4421,27 @@ fts_phrase_or_proximity_search(
if (k == ib_vector_size(query->match_array[j])) {
end_list = TRUE;
if (match[j]->doc_id != match[0]->doc_id) {
/* no match */
if (query->flags & FTS_PHRASE) {
ulint s;
if (query->flags & FTS_PHRASE) {
ulint s;
/* Since i is the last doc id in the
match_array[j], remove all doc ids > i
from the match_array[0]. */
fts_match_t* match_temp;
for (s = i + 1; s < n_matched; s++) {
match_temp = static_cast<
fts_match_t*>(ib_vector_get(
query->match_array[0], s));
match_temp->doc_id = 0;
}
if (match[j]->doc_id !=
match[0]->doc_id) {
/* no match */
match[0]->doc_id = 0;
for (s = i + 1; s < n_matched;
s++) {
match[0] = static_cast<
fts_match_t*>(
ib_vector_get(
query->match_array[0],
s));
match[0]->doc_id = 0;
}
}
}
if (match[j]->doc_id != match[0]->doc_id) {
goto func_exit;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment