MDEV-29677 Wrong result with join query and innodb fulltext search

InnoDB FTS scan was used by a subquery. A subquery execution may start
a table read and continue until it finds the first matching record
combination. This can happen before the table read returns EOF.

The next time the subquery is executed, it will start another table read.
InnoDB FTS table read fails to re-initialize its data structures in this
scenario and will try to continue the scan started at the first execution.

Fixed by ha_innobase::ft_init() to stop the FTS scan if there is one.

Author: Sergei Petrunia <sergey@mariadb.com>
Reviewer: Monty
This commit is contained in:
Monty 2022-11-07 14:30:42 +02:00 committed by Sergei Petrunia
parent 66d9c1b22d
commit aa5e788051

View file

@ -9467,6 +9467,11 @@ ha_innobase::ft_init()
trx->will_lock = true;
}
/* If there is an FTS scan in progress, stop it */
fts_result_t* result = (reinterpret_cast<NEW_FT_INFO*>(ft_handler))->ft_result;
if (result)
result->current= NULL;
DBUG_RETURN(rnd_init(false));
}