1#
2# Test the interaction between innodb_flush_method and bitmap file writes
3#
4--source include/not_windows.inc
5--source include/have_innodb.inc
6
7call mtr.add_suppression("Failed to set O_DIRECT on file");
8call mtr.add_suppression("O_DIRECT is known to result in");
9
10let $MYSQLD_DATADIR= `select @@datadir`;
11let $BITMAP_FILE= $MYSQLD_DATADIR/ib_modified_log_1_0.xdb;
12
13--disable_warnings
14DROP TABLE IF EXISTS t1;
15--enable_warnings
16
17RESET CHANGED_PAGE_BITMAPS;
18
19CREATE TABLE t1 (a INT, b BLOB) ENGINE=InnoDB;
20
21#
22# Test innodb_flush_method=fdatasync (the default)
23#
24--let $restart_parameters=restart:--innodb-track-changed-pages=1
25--source include/restart_mysqld.inc
26
27INSERT INTO t1 VALUES (1, REPEAT("a", 20000));
28
29#
30# Test innodb_flush_method=O_DSYNC
31# Check that the previous test produced bitmap data while the server is down.
32#
33--source include/shutdown_mysqld.inc
34file_exists $BITMAP_FILE;
35# Here and below remove the LSNs from the file names on listing them
36--replace_regex /_[[:digit:]]+\.xdb$//
37list_files $MYSQLD_DATADIR ib_modified_log*;
38--let $restart_parameters=restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DSYNC
39--source include/start_mysqld.inc
40
41INSERT INTO t1 VALUES (2, REPEAT("b", 20000));
42
43#
44# Test innodb_flush_method=O_DIRECT
45# Check that the previous test produced bitmap data while the server is down.
46#
47--source include/shutdown_mysqld.inc
48file_exists $BITMAP_FILE;
49--replace_regex /_[[:digit:]]+\.xdb$//
50list_files $MYSQLD_DATADIR ib_modified_log*;
51--let $restart_parameters=restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DIRECT
52--source include/start_mysqld.inc
53
54INSERT INTO t1 VALUES (3, REPEAT("c", 20000));
55
56# Test innodb_flush_method=ALL_O_DIRECT
57# Check that the previous test produced bitmap data while the server is down.
58#
59--source include/shutdown_mysqld.inc
60file_exists $BITMAP_FILE;
61--replace_regex /_[[:digit:]]+\.xdb$//
62list_files $MYSQLD_DATADIR ib_modified_log*;
63--let $restart_parameters=restart:--innodb-track-changed-pages=1 --innodb-flush-method=ALL_O_DIRECT
64--source include/start_mysqld.inc
65
66INSERT INTO t1 VALUES (4, REPEAT("d", 20000));
67
68#
69# Test innodb_flush_method=O_DIRECT_NO_FSYNC
70# Check that the previous test produced bitmap data while the server is down.
71#
72--source include/shutdown_mysqld.inc
73file_exists $BITMAP_FILE;
74--replace_regex /_[[:digit:]]+\.xdb$//
75list_files $MYSQLD_DATADIR ib_modified_log*;
76--let $restart_parameters=restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DIRECT_NO_FSYNC
77--source include/start_mysqld.inc
78
79INSERT INTO t1 VALUES (4, REPEAT("e", 20000));
80
81#
82# Restart the server with default options
83#
84--source include/shutdown_mysqld.inc
85file_exists $BITMAP_FILE;
86--replace_regex /_[[:digit:]]+\.xdb$//
87list_files $MYSQLD_DATADIR ib_modified_log*;
88--let $restart_parameters=restart
89--source include/start_mysqld.inc
90
91RESET CHANGED_PAGE_BITMAPS;
92DROP TABLE t1;
93