Skip to content

Commit d58437d

Browse files
committed
MDEV-20149 innodb.innodb-system-table-view fails with wrong result
The test occasionally fails with different table reference count due to purge activity after INSERT operations (MDEV-12288). Wait for purge before accessing dict_table_t::n_ref_count.
1 parent d4246e2 commit d58437d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

mysql-test/suite/innodb/r/innodb-system-table-view.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
2+
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
13
SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables
24
WHERE name = 'mysql/innodb_table_stats';
35
SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables
@@ -108,6 +110,7 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
108110
ID FOR_COL_NAME REF_COL_NAME POS
109111
test/constraint_test parent_id id 0
110112
INSERT INTO parent VALUES(1);
113+
InnoDB 0 transactions not purged
111114
SELECT name, num_rows, ref_count
112115
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
113116
WHERE name LIKE "%parent";
@@ -169,10 +172,12 @@ INSERT INTO parent VALUES(1, 9);
169172
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
170173
id newid
171174
1 9
175+
InnoDB 0 transactions not purged
172176
SELECT name, num_rows, ref_count
173177
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
174178
WHERE name LIKE "%parent";
175179
name num_rows ref_count
176180
test/parent 1 2
177181
DROP TABLE child;
178182
DROP TABLE parent;
183+
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

mysql-test/suite/innodb/t/innodb-system-table-view.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
--source include/innodb_page_size_small.inc
66

7+
SET @save_frequency=@@GLOBAL.innodb_purge_rseg_truncate_frequency;
8+
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
79
LET $MYSQLD_DATADIR = `select @@datadir`;
810
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
911

@@ -70,6 +72,8 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
7072
# INNODB_SYS_TABLESTATS
7173
INSERT INTO parent VALUES(1);
7274

75+
--source include/wait_all_purged.inc
76+
7377
--sorted_result
7478
SELECT name, num_rows, ref_count
7579
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
@@ -126,6 +130,8 @@ INSERT INTO parent VALUES(1, 9);
126130
--sorted_result
127131
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
128132

133+
--source include/wait_all_purged.inc
134+
129135
--sorted_result
130136
SELECT name, num_rows, ref_count
131137
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
@@ -134,3 +140,4 @@ WHERE name LIKE "%parent";
134140
DROP TABLE child;
135141

136142
DROP TABLE parent;
143+
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

0 commit comments

Comments
 (0)