mirror of
https://github.com/MariaDB/server.git
synced 2025-02-04 21:02:17 +01:00
228b7e4db5
This imports and adapts a number of MySQL 5.7 test cases that are applicable to MariaDB. Some tests for old bug fixes are not that relevant because the code has been refactored since then (especially starting with MariaDB Server 10.6), and the tests would not reproduce the original bug if the fix was reverted. In the test innodb_fts.opt, there are many duplicate MATCH ranks, which would make the results nondeterministic. The test was stabilized by changing some LIMIT clauses or by adding sorted_result in those cases where the purpose of a test was to show that no sorting took place in the server. In the test innodb_fts.phrase, MySQL 5.7 would generate FTS_DOC_ID that are 1 larger than in MariaDB. In innodb_fts.index_table the difference is 2. This is because in MariaDB, fts_get_next_doc_id() post-increments cache->next_doc_id, while MySQL 5.7 pre-increments it. Reviewed by: Thirunarayanan Balathandayuthapani
52 lines
1.8 KiB
Text
52 lines
1.8 KiB
Text
# This is a basic test for innodb fts result cache limit.
|
|
|
|
-- source include/have_innodb.inc
|
|
|
|
# Must have debug code to use SET SESSION debug
|
|
--source include/have_debug.inc
|
|
|
|
# Create FTS table
|
|
CREATE TABLE t1 (
|
|
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
|
a VARCHAR(200),
|
|
b TEXT
|
|
) ENGINE= InnoDB;
|
|
|
|
# Create the FTS index again
|
|
CREATE FULLTEXT INDEX idx on t1 (a,b);
|
|
|
|
# Insert rows
|
|
INSERT INTO t1 (a,b) VALUES
|
|
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
|
('when To Use MySQL Well','After that you went through a ...'),
|
|
('where will Optimizing MySQL','what In this tutorial we will show ...'),
|
|
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
|
('when To Use MySQL Well','After that you went through a ...'),
|
|
('where will Optimizing MySQL','what In this tutorial we will show ...'),
|
|
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
|
('when To Use MySQL Well','After that you went through a ...'),
|
|
('where will Optimizing MySQL','what In this tutorial we will show ...');
|
|
|
|
SET @save_limit=@@GLOBAL.innodb_ft_result_cache_limit;
|
|
SET @save_dbug=@@debug_dbug;
|
|
SET debug_dbug="+d,fts_instrument_result_cache_limit";
|
|
|
|
# Simple term search
|
|
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' IN BOOLEAN MODE);
|
|
|
|
# Query expansion
|
|
--error 128
|
|
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' WITH QUERY EXPANSION);
|
|
|
|
# Simple phrase search
|
|
--error 128
|
|
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database"' IN BOOLEAN MODE);
|
|
|
|
# Simple proximity search
|
|
--error 128
|
|
SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database" @ 5' IN BOOLEAN MODE);
|
|
|
|
SET debug_dbug=@save_dbug;
|
|
|
|
DROP TABLE t1;
|
|
SET GLOBAL innodb_ft_result_cache_limit=@save_limit;
|