summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-11-07 14:30:42 +0200
committerMonty <monty@mariadb.org>2022-11-18 13:52:04 +0200
commit803f8d8056b3550e8020ff221e298334e826b995 (patch)
tree3c28eb4370ef3e345bd8ffd27fd5d01027978c26
parent197b1429fa39233394fcc460c5bd71e344c4049e (diff)
downloadmariadb-git-803f8d8056b3550e8020ff221e298334e826b995.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 5b0058c0883..ed3b0239e48 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -9522,6 +9522,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));
}