Debian Codegraph @

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

raw
1 --source include/big_test.inc
2 --source include/have_innodb_16k.inc
3
4 --let $MYSQLD_DATADIR1= $MYSQL_TMP_DIR/data
5 # This is a file created by mysql-8.0.29 on Windows using following steps:
6 # mysqld --initialize-insecure --lower-case-table-names=1 --innodb-log-file-size=4194304
7 # mysqld --lower-case-table-names=1 --innodb-log-file-size=4194304
8 # connect to it and execute:
9 # ALTER INSTANCE DISABLE INNODB REDO_LOG;
10 # CREATE DATABASE test;
11 # use test;
12 # CREATE TABLE t(id INT PRIMARY KEY);
13 # INSERT INTO t VALUES (42);
14 # SHUTDOWN;
15 # $ cd mysql-bin;
16 # $ sed -i -s 's@\\@/@g' data/binlog.index
17 # $ zip -qr -9 data_80029_empty_disabled_log_normal_shutdown.zip data
18 # The idea is that the redo log is logically empty, because all dirty pages were written back to disc,
19 # so the instance *is* crash safe, even though the redo logging is disabled.
20 # This should result in LOG_HEADER_FLAG_NO_LOGGING being set, but
21 # also LOG_HEADER_FLAG_CRASH_UNSAFE not being set.
22 # Also the flushed_lsn in system tablepsace's header should match the checkpoint_lsn in ib_logfile0.
23 # You can use xxd -l $((512*4)) ib_logfile0 to verify that the relevant pieces of info are as needed for this scenario:
24 # The flags are at offset 48 = 0x30, and LOG_HEADER_FLAG_NO_LOGGING == 1:
25 # 00000030: 0000 0001 0000 0000 0000 0000 0000 0000 ................
26 # The checkpoint is stored in two places, at offset 512 + 8:
27 # 00000200: 0000 0000 0000 0012 0000 0000 011f 6592 ..............e.
28 # and at offset 512*3 + 8 :
29 # 00000600: 0000 0000 0000 0013 0000 0000 0125 822f .............%./
30 # where the preceeding 8 bytes indicate the checkpoint number, and we pick the larger (0x12 vs 0x13).
31 # Thus the checkpoint is 0x0125822f
32 --let $ZIP_FILE= $MYSQLTEST_VARDIR/std_data/upgrade/data_80029_empty_disabled_log_normal_shutdown.zip
33 --let $MYSQLD_LOG = $MYSQLD_DATADIR1/mysqld.err
34 --let SEARCH_FILE= $MYSQLD_LOG
35 --let $args=--datadir=$MYSQLD_DATADIR1 --log-error=$MYSQLD_LOG --log-error-verbosity=3 --lower-case-table-names=1
36
37 # Stop current instance
38 --source include/kill_mysqld.inc
39 # Unpack the zipped datadir:
40 --exec unzip -qo $ZIP_FILE -d $MYSQL_TMP_DIR
41 --list_files $MYSQLD_DATADIR1 ib_logfile*
42 # Now, perform the upgrade:
43
44 --let $restart_parameters = restart: $args
45 --replace_result $MYSQLD_DATADIR1 MYSQLD_DATADIR1
46 --source include/start_mysqld.inc
47 SELECT * FROM test.t;
48 SET GLOBAL innodb_monitor_enable = module_log;
49 SELECT 0x0125822f <= `COUNT` FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'log_lsn_last_checkpoint';
50 SELECT 0x0125822f <= `COUNT` FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME = 'log_lsn_current';
51 # As a side effect of upgrade, the redo log gets enabled again (because we clear the flag)
52 SELECT * FROM performance_schema.global_status WHERE variable_name = 'Innodb_redo_log_enabled';
53 --source include/kill_mysqld.inc
54
55 --let $error_name=ER_IB_MSG_LOG_FILES_UPGRADE
56 --source include/get_error_id.inc
57 # The checkpoint_lsn in ib_logfile0 is 0x0125822f = 19235375, and this should be found and reported during upgrade
58 --let SEARCH_PATTERN=$error_id\b.*\bLSN=19235375
59 --echo # Expect found
60 --source include/search_pattern.inc
61
62 --force-rmdir $MYSQLD_DATADIR1
63
64 # Start the server with original settings
65 --let $restart_parameters = restart:
66 --source include/start_mysqld.inc