File: log_crash.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 (95 lines) | stat: -rw-r--r-- 2,899 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
# This mtr test checks how InnoDB handles corrupted redo log files,
# if these files were created using the current redo log format.
#                                   ---------------------------
#
# For older redo formats, recovery reports that redo log isn't clean,
# and clean shutdown must be performed using older version of MySQL.
# However, scenarios for older redo formats are NOT part of this test.
# They are located in log_5_7_8.test, log_5_7_9.test, ...

# disabling checkpoints:
--source include/have_debug.inc

# perl: support for Q> in pack(), and 64-bit int:
--source include/have_64bit.inc

--source ../include/redo_log_error_patterns.inc

let $tmp_dir = $MYSQLTEST_VARDIR/tmp;

let MYSQLD_DATADIR = $tmp_dir/log_crash;
let MYSQLD_ERROR_LOG = $tmp_dir/my_restart.err;
let SEARCH_FILE = $MYSQLD_ERROR_LOG;

let $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
let $MYSQLD_EXTRA_ARGS = --innodb_page_size=$INNODB_PAGE_SIZE;
--echo # Initialize new data directory...
--source include/initialize_datadir.inc

--echo # Restart MySQL using the new data directory...
let $restart_parameters = restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_ERROR_LOG;
--replace_result $MYSQLD_ERROR_LOG my_restart.err $MYSQLD_DATADIR tmp/log_crash
--source include/restart_mysqld.inc

--echo # Prepare schema used in the tests.
--source include/ib_log_spammer_init.inc

--echo # Ensure there is a lot of free space in the redo log.
SET GLOBAL innodb_log_checkpoint_now = ON;

--echo # Disable checkpointing.
SET GLOBAL innodb_checkpoint_disabled = ON;

--echo # Create connection which generates spam to the redo log.
--connect(C1,localhost,root,,test)
--send CALL log_spammer()
--connection default

--echo # Create at least few redo records...
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t(a) VALUES(42);

--echo # Kill MySQL...
--source include/kill_mysqld.inc
let $restart_parameters = restart:;

--echo # Start MySQL...
--error 1,42
--exec $MYSQLD_CMD $MYSQLD_ARGS --$UNKNOWN_PARAM

--echo # Verify...

let SEARCH_PATTERN = $PATTERN_DATABASE_NOT_CLEAN;
# Expected: found
--source include/search_pattern.inc

let SEARCH_PATTERN = $PATTERN_STARTING_CRASH_RECOVERY;
# Expected: found
--source include/search_pattern.inc

let SEARCH_PATTERN = $PATTERN_APPLYING_BATCH;
# Expected: found
--source include/search_pattern.inc

let SEARCH_PATTERN = $PATTERN_APPLY_BATCH_COMPLETED;
# Expected: found
--source include/search_pattern.inc

let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM;
# Expected: found
--source include/search_pattern.inc

--echo # Remove the data directory...
--force-rmdir $MYSQLD_DATADIR

--echo ############################################################################################

--echo # Cleanup...
--remove_file $SEARCH_FILE
let SEARCH_FILE=;
let SEARCH_PATTERN=;
let MYSQLD_ERROR_LOG=;
let MYSQLD_DATADIR=;

--echo # Start MySQL...
--source include/start_mysqld.inc