summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-11-07 14:30:42 +0200
committerMonty <monty@mariadb.org>2022-12-20 23:11:28 +0200
commit2b18541df486c0ebbb2776e3f03c445e08290ca4 (patch)
tree6fa555df5a0943fd3e3dd19753488a1adde69a6b
parentb5e6fa18810bf43803ea1e50e6535a45eddbdf1c (diff)
downloadmariadb-git-2b18541df486c0ebbb2776e3f03c445e08290ca4.tar.gz
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
-rw-r--r--storage/innobase/handler/ha_innodb.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index af9ebd84dbd..ad67c8ebcf4 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -9518,6 +9518,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));
}