File: dd_bootstrap.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (164 lines) | stat: -rw-r--r-- 5,252 bytes parent folder | download
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
--source include/big_test.inc

--echo #
--echo # This file contains bootstrap test cases that do not
--echo # need to be run with a debug build. See also the 
--echo # test file 'dd_bootstrap_debug.test' for debug
--echo # test cases.
--echo #

let BASEDIR=    `select @@basedir`;
let DDIR=       $MYSQL_TMP_DIR/dd_bootstrap_test;
let MYSQLD_LOG= $MYSQL_TMP_DIR/server.log;
let extra_args= --no-defaults --innodb_dedicated_server=OFF --log-error=$MYSQLD_LOG --secure-file-priv="" --loose-skip-auto_generate_certs --loose-skip-sha256_password_auto_generate_rsa_keys --skip-ssl --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR;
let BOOTSTRAP_SQL= $MYSQL_TMP_DIR/tiny_bootstrap.sql;

--echo # Preparation: Shut server down.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc

--echo #
--echo # 1. Try restart after dropping the time_zone_transition_type table.
--echo # ------------------------------------------------------------------

--echo # 1.1 Create bootstrap file.
write_file $BOOTSTRAP_SQL;
  CREATE SCHEMA test;
  DROP TABLE mysql.time_zone_transition_type;
EOF

--echo # 1.2 First start the server with --initialize, and drop the time_zone_transition_type table.
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --init-file=$BOOTSTRAP_SQL

--echo # 1.3 Restart the server against DDIR - should succeed.
--exec echo "restart: --datadir=$DDIR --no-console --log-error=$MYSQLD_LOG" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc

--echo # 1.4 Shut server down.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc

--echo # 1.5 Look for warning.
perl;
  use strict;
  my $log= $ENV{'MYSQLD_LOG'} or die;
  open(FILE, "$log") or die;
  my $c_e= grep(/\[Warning\] \[[^]]*\] \[[^]]*\] Can\'t open and lock time zone table/gi,<FILE>);
  print "#     Time zone table warning found $c_e times.\n";
  close(FILE);
EOF

--echo # 1.6 Delete bootstrap file, log file and datadir.
remove_file $BOOTSTRAP_SQL;
remove_file $MYSQLD_LOG;
--force-rmdir $DDIR

--echo #
--echo # 2. Try restart after deleting the mysql dd tablespace file.
--echo # -----------------------------------------------------------

--echo # 2.1 First start the server with --initialize.
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR

--echo # 2.2 Delete the physical tablespace file for mysql.ibd.
remove_file $DDIR/mysql.ibd;

--echo # 2.3 Restart the server against DDIR - should fail.
--error 1
--exec $MYSQLD $extra_args --datadir=$DDIR

--echo # 2.4 Look for error.
perl;
  use strict;
  my $log= $ENV{'MYSQLD_LOG'} or die;
  open(FILE, "$log") or die;
  my $c_e= grep(/Failed to find valid data directory./gi,<FILE>);
  print "#     DD initialization error found $c_e times.\n";
  close(FILE);
EOF

--echo # 2.5 Delete log file and datadir.
remove_file $MYSQLD_LOG;
--force-rmdir $DDIR

--echo #
--echo # 3. Try restart on a non-existing datadir.
--echo # -----------------------------------------

--echo # 3.1 Restart the server against non-existing DDIR - should fail.
# Note that the error happens before log-error is setup, so we must redirect
# stderr to get log messages for analysis below.
--error 1
--exec $MYSQLD $extra_args --datadir=$DDIR > $MYSQLD_LOG 2>&1

--echo # 3.2 Look for error.
perl;
  use strict;
  my $log= $ENV{'MYSQLD_LOG'} or die;
  open(FILE, "$log") or die;
  my $c_e= grep(/\[ERROR\] \[[^]]*\] \[[^]]*\] failed to set datadir/gi,<FILE>);
  print "#     Datadir error found $c_e times.\n";
  close(FILE);
EOF

--echo # 3.3 Delete log file but datadir does not need cleanup
--echo # since it is non-existent.
remove_file $MYSQLD_LOG;

--echo #
--echo # 4. Try restart on an empty datadir (non-existing mysql dir).
--echo # ------------------------------------------------------------

--mkdir $DDIR

--echo # 4.1 Restart the server against existing but empty DDIR - should fail.
--error 1
--exec $MYSQLD $extra_args --datadir=$DDIR

--echo # 4.2 Look for error.
perl;
  use strict;
  my $log= $ENV{'MYSQLD_LOG'} or die;
  open(FILE, "$log") or die;
  my $c_e= grep(/Failed to find valid data directory/gi,<FILE>);
  print "#     DD initialization error found $c_e times.\n";
  close(FILE);
EOF

--echo # 4.3 Delete log file and datadir.
remove_file $MYSQLD_LOG;
--force-rmdir $DDIR

--echo #
--echo # 5. Try restart on an empty mysql dir.
--echo # -------------------------------------

--mkdir $DDIR
--mkdir $DDIR/mysql

--echo # 5.1 Restart the server against existing but empty mysql dir - should fail.
--error 1
--exec $MYSQLD $extra_args --datadir=$DDIR

--echo # 5.2 Look for error.
perl;
  use strict;
  my $log= $ENV{'MYSQLD_LOG'} or die;
  open(FILE, "$log") or die;
  my $c_e= grep(/Failed to find valid data directory/gi,<FILE>);
  print "#     DD initialization error found $c_e times.\n";
  close(FILE);
EOF

--echo # 5.3 Delete log file and datadir.
remove_file $MYSQLD_LOG;
--force-rmdir $DDIR

--echo #
--echo # Cleanup: Restarting the server against default datadir.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc