| 1 |
# Miscellanous FULLTEXT INDEX tests for debug-instrumented servers. |
| 2 |
# Note: These tests used to be part of a larger test, innodb_fts_misc_debug |
| 3 |
# or innodb_fts.misc_debug. A large part of that test can be run on a |
| 4 |
# non-debug server and has been renamed to innodb_fts.crash_recovery. |
| 5 |
|
| 6 |
--source include/have_innodb.inc |
| 7 |
--source include/have_debug.inc |
| 8 |
--source include/have_debug_sync.inc |
| 9 |
--source include/count_sessions.inc |
| 10 |
--source include/maybe_versioning.inc |
| 11 |
|
| 12 |
# Following test is for Bug 14668777 - ASSERT ON IB_VECTOR_SIZE( |
| 13 |
# TABLE->FTS->INDEXES, ALTER TABLE |
| 14 |
CREATE TABLE articles ( |
| 15 |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, |
| 16 |
title VARCHAR(200), |
| 17 |
body TEXT, |
| 18 |
FULLTEXT (title,body) |
| 19 |
) ENGINE=InnoDB; |
| 20 |
|
| 21 |
# Abort the operation in dict_create_index_step by setting |
| 22 |
# return status of dict_create_index_tree_step() to DB_OUT_OF_MEMORY |
| 23 |
# The newly create dict_index_t should be removed from fts cache |
| 24 |
SET @saved_debug_dbug = @@SESSION.debug_dbug; |
| 25 |
SET SESSION debug_dbug="+d,ib_dict_create_index_tree_fail"; |
| 26 |
if ($MTR_COMBINATION_ORIG) { |
| 27 |
--error ER_OUT_OF_RESOURCES |
| 28 |
CREATE FULLTEXT INDEX idx ON articles(body); |
| 29 |
} |
| 30 |
if (!$MTR_COMBINATION_ORIG) { |
| 31 |
--error ER_CANT_CREATE_TABLE |
| 32 |
CREATE FULLTEXT INDEX idx ON articles(body); |
| 33 |
} |
| 34 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 35 |
|
| 36 |
# This simply go through ha_innobase::commit_inplace_alter_table |
| 37 |
# and do a fts_check_cached_index() |
| 38 |
ALTER TABLE articles STATS_PERSISTENT=DEFAULT; |
| 39 |
|
| 40 |
DROP TABLE articles; |
| 41 |
|
| 42 |
# This test used to be called innodb_fts.innobase_drop_fts_index_table: |
| 43 |
|
| 44 |
CREATE TABLE t (a INT, b TEXT) engine=innodb; |
| 45 |
SET debug_dbug='+d,alter_table_rollback_new_index'; |
| 46 |
if ($MTR_COMBINATION_ORIG) { |
| 47 |
-- error ER_UNKNOWN_ERROR |
| 48 |
ALTER TABLE t ADD FULLTEXT INDEX (b(64)); |
| 49 |
} |
| 50 |
if (!$MTR_COMBINATION_ORIG) { |
| 51 |
-- error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON |
| 52 |
ALTER TABLE t ADD FULLTEXT INDEX (b(64)), ALGORITHM=INPLACE; |
| 53 |
} |
| 54 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 55 |
|
| 56 |
DROP TABLE t; |
| 57 |
|
| 58 |
# MDEV-21550 Assertion `!table->fts->in_queue' failed in |
| 59 |
# fts_optimize_remove_table |
| 60 |
CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk), |
| 61 |
FULLTEXT KEY(a)) ENGINE=InnoDB; |
| 62 |
CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(pk)) ENGINE=InnoDB; |
| 63 |
--error ER_ROW_IS_REFERENCED_2 |
| 64 |
DROP TABLE/*foo*/ t1; |
| 65 |
SET DEBUG_DBUG="+d,fts_instrument_sync"; |
| 66 |
INSERT INTO t1 VALUES(1, "mariadb"); |
| 67 |
ALTER TABLE t1 FORCE; |
| 68 |
# Cleanup |
| 69 |
DROP TABLE t2, t1; |
| 70 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 71 |
|
| 72 |
if ($MTR_COMBINATION_ORIG) { |
| 73 |
--echo # |
| 74 |
--echo # MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX |
| 75 |
--echo # |
| 76 |
CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB; |
| 77 |
INSERT INTO t1 VALUES(1, "test", "test_1"); |
| 78 |
connect(con1,localhost,root,,test); |
| 79 |
SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter"; |
| 80 |
SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2'; |
| 81 |
send ALTER TABLE t1 ADD FULLTEXT(c); |
| 82 |
connection default; |
| 83 |
SET DEBUG_SYNC='now WAIT_FOR s2'; |
| 84 |
START TRANSACTION; |
| 85 |
SELECT * FROM t1; |
| 86 |
SET DEBUG_SYNC='now SIGNAL g2'; |
| 87 |
connection con1; |
| 88 |
--error ER_OUT_OF_RESOURCES |
| 89 |
reap; |
| 90 |
disconnect con1; |
| 91 |
connection default; |
| 92 |
SET DEBUG_SYNC=RESET; |
| 93 |
# Exploit MDEV-17468 to force the table definition to be reloaded |
| 94 |
ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; |
| 95 |
CHECK TABLE t1; |
| 96 |
DROP TABLE t1; |
| 97 |
--source include/wait_until_count_sessions.inc |
| 98 |
} |
| 99 |
|
| 100 |
--echo # |
| 101 |
--echo # MDEV-25663 Double free of transaction during TRUNCATE |
| 102 |
--echo # |
| 103 |
call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); |
| 104 |
call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions"); |
| 105 |
SET @saved_debug_dbug= @@debug_dbug; |
| 106 |
|
| 107 |
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; |
| 108 |
SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; |
| 109 |
if ($MTR_COMBINATION_ORIG) |
| 110 |
{ |
| 111 |
TRUNCATE t1; |
| 112 |
} |
| 113 |
if (!$MTR_COMBINATION_ORIG) |
| 114 |
{ |
| 115 |
--echo TRUNCATE t1; |
| 116 |
} |
| 117 |
SET debug_dbug=@saved_debug_dbug; |
| 118 |
DROP TABLE t1; |
| 119 |
--echo # End of 10.3 tests |
| 120 |
|
| 121 |
if ($MTR_COMBINATION_ORIG) { |
| 122 |
# Fulltext fails in commit phase |
| 123 |
|
| 124 |
CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB; |
| 125 |
SET DEBUG_DBUG="+d,stats_lock_fail"; |
| 126 |
--error ER_LOCK_WAIT_TIMEOUT |
| 127 |
ALTER TABLE t1 ADD FULLTEXT(f2); |
| 128 |
SET debug_dbug=@saved_debug_dbug; |
| 129 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 130 |
--error ER_TABLESPACE_DISCARDED |
| 131 |
ALTER TABLE t1 ADD FULLTEXT(f2); |
| 132 |
DROP TABLE t1; |
| 133 |
} |