Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 # need to restart server
3 --source include/not_embedded.inc
4
5 --connect(con1, localhost, root)
6 CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
7 INSERT INTO t VALUES(1);
8 BEGIN;
9 # Generate insert_undo log.
10 INSERT INTO t VALUES(2);
11 # Generate update_undo log.
12 DELETE FROM t WHERE a=2;
13 --connection default
14 --echo # Normal MariaDB shutdown would roll back the above transaction.
15 --echo # We want the transaction to remain open, so we will kill the server
16 --echo # after ensuring that any non-transactional files are clean.
17 FLUSH TABLES;
18 --echo # Ensure that the above incomplete transaction becomes durable.
19 SET GLOBAL innodb_flush_log_at_trx_commit=1;
20 BEGIN;
21 INSERT INTO t VALUES(0);
22 DELETE FROM t WHERE a=0;
23 COMMIT;
24 --let $restart_parameters= --innodb-force-recovery=3
25 --let $shutdown_timeout= 0
26 --source include/restart_mysqld.inc
27 --let $shutdown_timeout= 30
28 --disconnect con1
29 SELECT * FROM t;
30 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
31 SELECT * FROM t;
32 UPDATE t SET a=3 WHERE a=1;
33 --let $restart_parameters= --innodb-read-only
34 --source include/restart_mysqld.inc
35 --echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
36 --echo # In earlier versions, this would return the last committed version
37 --echo # (empty table)!
38 SHOW VARIABLES LIKE "innodb_read_only";
39 SELECT * FROM t;
40 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
41 SELECT * FROM t;
42 SET GLOBAL innodb_max_purge_lag_wait=0;
43 INSERT INTO mysql.innodb_index_stats
44 SELECT * FROM mysql.innodb_index_stats LIMIT 0;
45 --echo Test Temp tablespace truncate in read only mode
46 SET GLOBAL innodb_truncate_temporary_tablespace_now=1;
47 --let $restart_parameters=
48 --source include/restart_mysqld.inc
49 SELECT * FROM t;
50 DROP TABLE t;