1connect con1, localhost, root;
2CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
3INSERT INTO t VALUES(1);
4BEGIN;
5INSERT INTO t VALUES(2);
6UPDATE t SET a=20 WHERE a=2;
7connect con2, localhost, root;
8# Normal MariaDB shutdown would roll back the above transaction.
9# We want the transaction to remain open, so we will kill the server
10# after ensuring that any non-transactional files are clean.
11FLUSH TABLES;
12# Create another transaction that will be recovered as COMMITTED.
13BEGIN;
14SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL committed WAIT_FOR ever';
15COMMIT;
16connection default;
17SET DEBUG_SYNC='now WAIT_FOR committed';
18# Ensure that the above transactions become durable.
19SET GLOBAL innodb_flush_log_at_trx_commit=1;
20BEGIN;
21INSERT INTO t VALUES(-10000);
22ROLLBACK;
23# restart: --innodb-force-recovery=3
24disconnect con1;
25disconnect con2;
26SELECT * FROM t;
27a
281
29SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
30SELECT * FROM t;
31a
321
3320
34UPDATE t SET a=3 WHERE a=1;
35# restart: --innodb-read-only
36SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output;
37# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED.
38# In earlier versions, this would return the last committed version
39# (only a=3; no record for a=20)!
40SELECT * FROM t;
41a
423
4320
44SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
45SELECT * FROM t;
46a
473
4820
49# restart: --innodb-force-recovery=5
50#
51# MDEV-15418 innodb_force_recovery=5 displays bogus warnings
52#            about too new transaction identifier
53#
54# With the fix, innodb_force_recovery=5 implies READ UNCOMMITTED.
55SELECT * FROM t;
56a
573
5820
59SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
60SELECT * FROM t;
61a
623
6320
64SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
65SELECT * FROM t;
66a
673
6820
69#
70# MDEV-27332 SIGSEGV in fetch_data_into_cache
71#
72BEGIN;
73SELECT trx_state FROM information_schema.innodb_trx;
74trx_state
75COMMIT;
76# restart
77SELECT * FROM t;
78a
793
80DROP TABLE t;
81FOUND 1 /Rolled back recovered transaction [^0]/ in mysqld.1.err
82