1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#
# BUG#22516559 MYSQL INSTANCE STALLS WHEN SYNCING FTS INDEX
#
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/not_valgrind.inc
--source include/not_embedded.inc
--source include/not_crashrep.inc
--source include/maybe_versioning.inc
connect (con1,localhost,root,,);
connection default;
--echo # Case 1: Test select and insert(row in both disk and cache)
CREATE TABLE t1 (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT(title)
) ENGINE = InnoDB;
INSERT INTO t1(title) VALUES('mysql');
INSERT INTO t1(title) VALUES('database');
connection con1;
SET @old_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,fts_instrument_sync_debug';
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected';
send INSERT INTO t1(title) VALUES('mysql database');
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR written';
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
SET DEBUG_SYNC= 'now SIGNAL selected';
connection con1;
--reap
SET @old_dbug = @@SESSION.debug_dbug;
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
connection default;
DROP TABLE t1;
--echo # Case 2: Test insert and insert(sync)
CREATE TABLE t1 (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT(title)
) ENGINE = InnoDB;
INSERT INTO t1(title) VALUES('mysql');
INSERT INTO t1(title) VALUES('database');
connection con1;
SET debug_dbug = '+d,fts_instrument_sync_debug';
SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted';
send INSERT INTO t1(title) VALUES('mysql database');
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR written';
INSERT INTO t1(title) VALUES('mysql database');
SET DEBUG_SYNC= 'now SIGNAL inserted';
connection con1;
--reap
SET debug_dbug = @old_dbug;
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
connection default;
disconnect con1;
DROP TABLE t1;
--echo # Case 3: Test insert crash recovery
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
CREATE TABLE t1 (
FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
FULLTEXT(title)
) ENGINE = InnoDB;
INSERT INTO t1(title) VALUES('database');
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash';
--error 2013
INSERT INTO t1(title) VALUES('mysql');
--source include/start_mysqld.inc
-- echo After restart
# PAGE_ROOT_AUTO_INC could contain last failed autoinc value. Avoid
# doing show the result of auto increment field
SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
SET @old_dbug = @@SESSION.debug_dbug;
SET debug_dbug = '+d,fts_instrument_sync_debug';
INSERT INTO t1(title) VALUES('mysql');
SET debug_dbug = @old_dbug;
SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database');
DROP TABLE t1;
--echo # Case 4: Test sync commit & rollback in background
CREATE TABLE t1(
id INT AUTO_INCREMENT,
title VARCHAR(100),
FULLTEXT(title),
PRIMARY KEY(id)) ENGINE=InnoDB;
SET debug_dbug = '+d,fts_instrument_sync';
INSERT INTO t1(title) VALUES('mysql');
SET debug_dbug = @old_dbug;
--source include/restart_mysqld.inc
SET @old_global_dbug = @@GLOBAL.debug_dbug;
SET @old_dbug = @@SESSION.debug_dbug;
SET GLOBAL debug_dbug='+d,fts_instrument_sync,fts_instrument_sync_interrupted';
INSERT INTO t1(title) VALUES('database');
SET GLOBAL debug_dbug = @old_global_dbug;
SET debug_dbug = '+d,fts_instrument_sync_debug';
INSERT INTO t1(title) VALUES('good');
SET debug_dbug = @old_dbug;
SET GLOBAL innodb_ft_aux_table="test/t1";
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database good');
DROP TABLE t1;
--echo #
--echo # MDEV-26273 InnoDB fts DDL fails when
--echo # innodb_force_recovery is set to 2
--echo #
let $restart_parameters=--innodb_force_recovery=2;
--source include/restart_mysqld.inc
CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED KEY,
f1 CHAR(200)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FULLTEXT INDEX(f1);
DROP TABLE t1;
let $restart_parameters=;
--source include/restart_mysqld.inc
|