| 1 |
connect con1, localhost, root; |
| 2 |
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; |
| 3 |
INSERT INTO t VALUES(1); |
| 4 |
BEGIN; |
| 5 |
INSERT INTO t VALUES(2); |
| 6 |
UPDATE t SET a=20 WHERE a=2; |
| 7 |
connect 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. |
| 11 |
FLUSH TABLES; |
| 12 |
# Create another transaction that will be recovered as COMMITTED. |
| 13 |
BEGIN; |
| 14 |
SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL committed WAIT_FOR ever'; |
| 15 |
COMMIT; |
| 16 |
connection default; |
| 17 |
SET DEBUG_SYNC='now WAIT_FOR committed'; |
| 18 |
# Ensure that the above transactions become durable. |
| 19 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 20 |
BEGIN; |
| 21 |
INSERT INTO t VALUES(-10000); |
| 22 |
DELETE FROM t WHERE a=-10000; |
| 23 |
COMMIT; |
| 24 |
# restart: --innodb-force-recovery=3 |
| 25 |
disconnect con1; |
| 26 |
disconnect con2; |
| 27 |
SELECT * FROM t; |
| 28 |
a |
| 29 |
1 |
| 30 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 31 |
SELECT * FROM t; |
| 32 |
a |
| 33 |
1 |
| 34 |
20 |
| 35 |
UPDATE t SET a=3 WHERE a=1; |
| 36 |
# restart: --innodb-read-only |
| 37 |
SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output; |
| 38 |
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. |
| 39 |
# In earlier versions, this would return the last committed version |
| 40 |
# (only a=3; no record for a=20)! |
| 41 |
SELECT * FROM t; |
| 42 |
a |
| 43 |
3 |
| 44 |
20 |
| 45 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 46 |
SELECT * FROM t; |
| 47 |
a |
| 48 |
3 |
| 49 |
20 |
| 50 |
# restart: --innodb-force-recovery=5 |
| 51 |
# |
| 52 |
# MDEV-15418 innodb_force_recovery=5 displays bogus warnings |
| 53 |
# about too new transaction identifier |
| 54 |
# |
| 55 |
# With the fix, innodb_force_recovery=5 implies READ UNCOMMITTED. |
| 56 |
SELECT * FROM t; |
| 57 |
a |
| 58 |
3 |
| 59 |
20 |
| 60 |
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; |
| 61 |
SELECT * FROM t; |
| 62 |
a |
| 63 |
3 |
| 64 |
20 |
| 65 |
SET TRANSACTION ISOLATION LEVEL READ COMMITTED; |
| 66 |
SELECT * FROM t; |
| 67 |
a |
| 68 |
3 |
| 69 |
20 |
| 70 |
# |
| 71 |
# MDEV-27332 SIGSEGV in fetch_data_into_cache |
| 72 |
# |
| 73 |
BEGIN; |
| 74 |
SELECT trx_state FROM information_schema.innodb_trx; |
| 75 |
trx_state |
| 76 |
COMMIT; |
| 77 |
# restart |
| 78 |
SELECT * FROM t; |
| 79 |
a |
| 80 |
3 |
| 81 |
DROP TABLE t; |
| 82 |
FOUND 1 /Rolled back recovered transaction [^0]/ in mysqld.1.err |