| 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 |
DELETE FROM t WHERE a=2; |
| 7 |
connection default; |
| 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 |
# Ensure that the above incomplete transaction becomes durable. |
| 13 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 14 |
BEGIN; |
| 15 |
INSERT INTO t VALUES(0); |
| 16 |
DELETE FROM t WHERE a=0; |
| 17 |
COMMIT; |
| 18 |
# restart: --innodb-force-recovery=3 |
| 19 |
disconnect con1; |
| 20 |
SELECT * FROM t; |
| 21 |
a |
| 22 |
1 |
| 23 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 24 |
SELECT * FROM t; |
| 25 |
a |
| 26 |
1 |
| 27 |
UPDATE t SET a=3 WHERE a=1; |
| 28 |
# restart: --innodb-read-only |
| 29 |
# Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. |
| 30 |
# In earlier versions, this would return the last committed version |
| 31 |
# (empty table)! |
| 32 |
SHOW VARIABLES LIKE "innodb_read_only"; |
| 33 |
Variable_name Value |
| 34 |
innodb_read_only ON |
| 35 |
SELECT * FROM t; |
| 36 |
a |
| 37 |
3 |
| 38 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 39 |
SELECT * FROM t; |
| 40 |
a |
| 41 |
3 |
| 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 |
Test Temp tablespace truncate in read only mode |
| 46 |
SET GLOBAL innodb_truncate_temporary_tablespace_now=1; |
| 47 |
# restart |
| 48 |
SELECT * FROM t; |
| 49 |
a |
| 50 |
3 |
| 51 |
DROP TABLE t; |