Skip to content

Commit d04fc1a

Browse files
MDEV-37669 innodb.sys_defragment fails with wrong result
- Fixing the sporadic innodb.sys_defragment, innodb.sys_defragment_fail test case by comparing the file_size
1 parent 00c469c commit d04fc1a

File tree

4 files changed

+38
-32
lines changed

4 files changed

+38
-32
lines changed

mysql-test/suite/innodb/r/sys_defragment.result

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,f2 VARCHAR(40))ENGINE=InnoDB PARTITI
1212
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
1313
DROP TABLE t2, t1;
1414
InnoDB 0 transactions not purged
15-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
16-
name file_size
17-
innodb_system 205520896
1815
set GLOBAL innodb_fast_shutdown= 0;
1916
# restart
2017
FOUND 1 /InnoDB: Moving the data from extents 4096 through 22016/ in mysqld.1.err
2118
FOUND 1 /InnoDB: Defragmentation of system tablespace is successful/ in mysqld.1.err
22-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
23-
name file_size
24-
innodb_system 14680064
19+
select name, file_size<$fsize shrunk
20+
from information_schema.innodb_sys_tablespaces where space=0;
21+
name shrunk
22+
innodb_system 1
2523
# restart

mysql-test/suite/innodb/r/sys_defragment_fail.result

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,35 @@ InnoDB 0 transactions not purged
2020
FOUND 1 /InnoDB: User table exists in the system tablespace/ in mysqld.1.err
2121
DROP TABLE t1;
2222
InnoDB 0 transactions not purged
23-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
24-
name file_size
25-
innodb_system 58720256
2623
# restart: --debug_dbug=+d,fail_after_level_defragment
2724
FOUND 1 /InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed./ in mysqld.1.err
28-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
29-
name file_size
30-
innodb_system 58720256
25+
select name, file_size<$fsize shrunk
26+
from information_schema.innodb_sys_tablespaces where space=0;
27+
name shrunk
28+
innodb_system 0
3129
# restart: --debug_dbug=d,allocation_prepare_fail
3230
FOUND 1 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
33-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
34-
name file_size
35-
innodb_system 58720256
31+
select name, file_size<$fsize shrunk
32+
from information_schema.innodb_sys_tablespaces where space=0;
33+
name shrunk
34+
innodb_system 0
3635
# restart: --debug_dbug=d,relation_page_prepare_fail
3736
FOUND 2 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
38-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
39-
name file_size
40-
innodb_system 58720256
37+
select name, file_size<$fsize shrunk
38+
from information_schema.innodb_sys_tablespaces where space=0;
39+
name shrunk
40+
innodb_system 0
4141
# restart: --debug_dbug=d,remover_prepare_fail
4242
FOUND 3 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
43-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
44-
name file_size
45-
innodb_system 58720256
43+
select name, file_size<$fsize shrunk
44+
from information_schema.innodb_sys_tablespaces where space=0;
45+
name shrunk
46+
innodb_system 0
4647
# restart
4748
FOUND 5 /InnoDB: Moving the data from extents 4096 through 8960/ in mysqld.1.err
4849
FOUND 1 /InnoDB: Defragmentation of system tablespace is successful/ in mysqld.1.err
49-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
50-
name file_size
51-
innodb_system 15728640
50+
select name, file_size<$fsize shrunk
51+
from information_schema.innodb_sys_tablespaces where space=0;
52+
name shrunk
53+
innodb_system 1
5254
# restart

mysql-test/suite/innodb/t/sys_defragment.test

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
1818
DROP TABLE t2, t1;
1919
--source include/wait_all_purged.inc
2020

21-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
21+
let $fsize=`select file_size from information_schema.innodb_sys_tablespaces where space = 0`;
2222

2323
set GLOBAL innodb_fast_shutdown= 0;
2424
--source include/restart_mysqld.inc
@@ -30,7 +30,8 @@ let SEARCH_PATTERN=InnoDB: Moving the data from extents 4096 through 22016;
3030
let SEARCH_PATTERN=InnoDB: Defragmentation of system tablespace is successful;
3131
--source include/search_pattern_in_file.inc
3232

33-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
33+
evalp select name, file_size<$fsize shrunk
34+
from information_schema.innodb_sys_tablespaces where space=0;
3435

3536
--source include/shutdown_mysqld.inc
3637

mysql-test/suite/innodb/t/sys_defragment_fail.test

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let SEARCH_PATTERN=InnoDB: User table exists in the system tablespace;
3434
DROP TABLE t1;
3535

3636
--source include/wait_all_purged.inc
37-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
37+
let $fsize=`select file_size from information_schema.innodb_sys_tablespaces where space = 0`;
3838

3939
let $restart_parameters=--debug_dbug=+d,fail_after_level_defragment;
4040
--source include/restart_mysqld.inc
@@ -43,7 +43,8 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
4343
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed.;
4444
--source include/search_pattern_in_file.inc
4545

46-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
46+
evalp select name, file_size<$fsize shrunk
47+
from information_schema.innodb_sys_tablespaces where space=0;
4748

4849
let $restart_parameters=--debug_dbug=d,allocation_prepare_fail;
4950
--source include/restart_mysqld.inc
@@ -52,7 +53,8 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
5253
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed.;
5354
--source include/search_pattern_in_file.inc
5455

55-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
56+
evalp select name, file_size<$fsize shrunk
57+
from information_schema.innodb_sys_tablespaces where space=0;
5658

5759
let $restart_parameters=--debug_dbug=d,relation_page_prepare_fail;
5860
--source include/restart_mysqld.inc
@@ -61,7 +63,8 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
6163
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed.;
6264
--source include/search_pattern_in_file.inc
6365

64-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
66+
evalp select name, file_size<$fsize shrunk
67+
from information_schema.innodb_sys_tablespaces where space=0;
6568

6669
let $restart_parameters=--debug_dbug=d,remover_prepare_fail;
6770
--source include/restart_mysqld.inc
@@ -70,7 +73,8 @@ let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
7073
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed.;
7174
--source include/search_pattern_in_file.inc
7275

73-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
76+
evalp select name, file_size<$fsize shrunk
77+
from information_schema.innodb_sys_tablespaces where space=0;
7478

7579
let $restart_parameters=;
7680
--source include/restart_mysqld.inc
@@ -82,7 +86,8 @@ let SEARCH_PATTERN= InnoDB: Moving the data from extents 4096 through 8960;
8286
let SEARCH_PATTERN=InnoDB: Defragmentation of system tablespace is successful;
8387
--source include/search_pattern_in_file.inc
8488

85-
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
89+
evalp select name, file_size<$fsize shrunk
90+
from information_schema.innodb_sys_tablespaces where space=0;
8691

8792
--source include/shutdown_mysqld.inc
8893
--move_file $MYSQLD_DATADIR/ibdata1_copy $MYSQLD_DATADIR/ibdata1

0 commit comments

Comments
 (0)