Debian Codegraph @

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

raw
1 #
2 # Test the Redo-Log Archiving feature. Success cases.
3 #
4
5 --disable_query_log
6 # When log-bin, skip-log-bin and binlog-format options are specified, mask the warning
7 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* You need to use --log-bin to make --binlog-format work.");
8 --enable_query_log
9
10 --let $saved_dirs = `SELECT @@global.innodb_redo_log_archive_dirs`
11 --let $SERVER_UUID = `SELECT @@global.server_uuid`
12 --let $IRLA_FILENAME = archive.$SERVER_UUID.000001.log
13 --let $IRLA_DIRECTORY_1 = $MYSQLTEST_VARDIR/log/redo_log_archive_1
14 --let $IRLA_DIRECTORY_2 = $MYSQLTEST_VARDIR/log/redo_log_archive_2
15 --let $IRLA_DIRECTORY_3 = $MYSQLTEST_VARDIR/log/redo_log_archive_3
16 --let $IRLA_SUBDIR_2 = subdir_2
17 --let $IRLA_SUBDIR_3 = subdir_3
18 --let $IRLA_PATHNAME_1 = $IRLA_DIRECTORY_1/$IRLA_FILENAME
19 --let $IRLA_PATHNAME_2 = $IRLA_DIRECTORY_2/$IRLA_SUBDIR_2/$IRLA_FILENAME
20 --let $IRLA_PATHNAME_3 = $IRLA_DIRECTORY_3/$IRLA_SUBDIR_3/$IRLA_FILENAME
21
22 --echo #
23 --echo # Prepare the server for redo log archiving.
24 --echo #
25 --mkdir $IRLA_DIRECTORY_1
26 --mkdir $IRLA_DIRECTORY_2
27 --mkdir $IRLA_DIRECTORY_2/$IRLA_SUBDIR_2
28 --mkdir $IRLA_DIRECTORY_3
29 --mkdir $IRLA_DIRECTORY_3/$IRLA_SUBDIR_3
30 --replace_result $IRLA_DIRECTORY_1 IRLA_DIRECTORY_1 $IRLA_DIRECTORY_2 IRLA_DIRECTORY_2 $IRLA_DIRECTORY_3 IRLA_DIRECTORY_3
31 eval SET @@global.innodb_redo_log_archive_dirs = 'label1:$IRLA_DIRECTORY_1;label2:$IRLA_DIRECTORY_2;:$IRLA_DIRECTORY_3;';
32 --echo
33
34 --echo #
35 --echo # Start and stop redo log archiving. Using SELECT.
36 --echo #
37 SELECT innodb_redo_log_archive_start('label1');
38 SELECT innodb_redo_log_archive_stop();
39 --echo #
40 --echo # Remove the redo log archive file.
41 --echo #
42 --remove_file $IRLA_PATHNAME_1
43 --echo
44
45 --echo #
46 --echo # Start and stop redo log archiving. Using DO. Result is constant anyway.
47 --echo #
48 DO innodb_redo_log_archive_start('label1');
49 DO innodb_redo_log_archive_stop();
50 --echo #
51 --echo # Remove the redo log archive file.
52 --echo #
53 --remove_file $IRLA_PATHNAME_1
54 --echo
55
56 --echo #
57 --echo # Start and stop redo log archiving. With NULL subdir.
58 --echo #
59 DO innodb_redo_log_archive_start('label1', NULL);
60 DO innodb_redo_log_archive_stop();
61 --echo #
62 --echo # Remove the redo log archive file.
63 --echo #
64 --remove_file $IRLA_PATHNAME_1
65 --echo
66
67 --echo #
68 --echo # Start and stop redo log archiving. With empty subdir.
69 --echo #
70 DO innodb_redo_log_archive_start('label1', '');
71 DO innodb_redo_log_archive_stop();
72 --echo #
73 --echo # Remove the redo log archive file.
74 --echo #
75 --remove_file $IRLA_PATHNAME_1
76 --echo
77
78 --echo #
79 --echo # Start and stop redo log archiving. With subdir.
80 --echo #
81 eval DO innodb_redo_log_archive_start('label2', '$IRLA_SUBDIR_2');
82 DO innodb_redo_log_archive_stop();
83 --echo #
84 --echo # Remove the redo log archive file.
85 --echo #
86 --remove_file $IRLA_PATHNAME_2
87 --echo
88
89 --echo #
90 --echo # Start redo log archiving. With empty label
91 --echo #
92 eval DO innodb_redo_log_archive_start('', '$IRLA_SUBDIR_3');
93 --echo
94
95 --echo #
96 --echo # Create a lot of InnoDB redo log.
97 --echo #
98 --disable_warnings
99 DROP DATABASE IF EXISTS db1;
100 --enable_warnings
101 CREATE DATABASE db1;
102 CREATE TABLE db1.t1(id int, b longblob) ENGINE=InnoDB;
103 INSERT INTO db1.t1 VALUES(1, repeat(1, 22*1024*1024));
104 DELETE FROM db1.t1;
105 DROP TABLE db1.t1;
106 DROP DATABASE db1;
107 --echo
108
109 --echo #
110 --echo # Stop redo log archiving.
111 --echo #
112 DO innodb_redo_log_archive_stop();
113 --echo
114
115 --echo #
116 --echo # Check the minimum size of the redo log archive file.
117 --echo #
118 --file_exists $IRLA_PATHNAME_3
119 --exec perl -e "if(-s '$IRLA_PATHNAME_3' < 20971520){die 'The file is too small';}"
120 --echo
121
122 --echo #
123 --echo # Remove the redo log archive file.
124 --echo #
125 --remove_file $IRLA_PATHNAME_3
126 --echo
127
128 --echo #
129 --echo # Privileged user can start and stop redo log archiving.
130 --echo #
131 CREATE USER mysqltest_u1@localhost;
132 GRANT INNODB_REDO_LOG_ARCHIVE ON *.* TO mysqltest_u1@localhost;
133 --echo [connection u1]
134 --connect (u1, localhost, mysqltest_u1,,)
135 DO innodb_redo_log_archive_start('label1');
136 DO innodb_redo_log_archive_stop();
137 --echo #
138 --echo # Remove the redo log archive file.
139 --echo #
140 --remove_file $IRLA_PATHNAME_1
141 --echo [connection default]
142 --connection default
143 --disconnect u1
144 --echo
145
146 --echo #
147 --echo # Restart server
148 --echo #
149 --source include/shutdown_mysqld.inc
150 --let $restart_parameters="restart:"
151 --source include/start_mysqld_no_echo.inc
152 # Need to set the variable again after restart. It has not been persisted above.
153 --replace_result $IRLA_DIRECTORY_1 IRLA_DIRECTORY_1
154 eval SET @@global.innodb_redo_log_archive_dirs = 'label1:$IRLA_DIRECTORY_1';
155 --echo #
156 --echo # Verify that the user does still have the INNODB_REDO_LOG_ARCHIVE privilege.
157 --echo #
158 SHOW GRANTS FOR mysqltest_u1@localhost;
159 --echo #
160 --echo # Verify that the user can still start and stop redo log archiving.
161 --echo #
162 --echo [connection u1]
163 --connect (u1, localhost, mysqltest_u1,,)
164 DO innodb_redo_log_archive_start('label1');
165 DO innodb_redo_log_archive_stop();
166 --echo #
167 --echo # Remove the redo log archive file.
168 --echo #
169 --remove_file $IRLA_PATHNAME_1
170 --echo [connection default]
171 --connection default
172 --disconnect u1
173 DROP USER mysqltest_u1@localhost;
174 --echo
175
176 --echo #
177 --echo # Cleanup
178 --echo #
179 --rmdir $IRLA_DIRECTORY_3/$IRLA_SUBDIR_3
180 --rmdir $IRLA_DIRECTORY_3
181 --rmdir $IRLA_DIRECTORY_2/$IRLA_SUBDIR_2
182 --rmdir $IRLA_DIRECTORY_2
183 --rmdir $IRLA_DIRECTORY_1
184 eval SET @@global.innodb_redo_log_archive_dirs = '$saved_dirs';