| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_debug_sync.inc |
| 4 |
--source include/no_valgrind_without_big.inc |
| 5 |
# need to restart server |
| 6 |
--source include/not_embedded.inc |
| 7 |
--source include/no_valgrind_without_big.inc |
| 8 |
|
| 9 |
--disable_query_log |
| 10 |
# Ignore messages from the innodb_force_recovery=5 startup. |
| 11 |
call mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to find tablespace for table `test`\\.`t` in the cache"); |
| 12 |
call mtr.add_suppression("\\[Warning\\] InnoDB: Allocated tablespace ID.* for test/t, old maximum was 0"); |
| 13 |
FLUSH TABLES; |
| 14 |
--enable_query_log |
| 15 |
|
| 16 |
--connect(con1, localhost, root) |
| 17 |
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; |
| 18 |
INSERT INTO t VALUES(1); |
| 19 |
BEGIN; |
| 20 |
# Generate insert_undo log. |
| 21 |
INSERT INTO t VALUES(2); |
| 22 |
# Generate update_undo log. |
| 23 |
UPDATE t SET a=20 WHERE a=2; |
| 24 |
--connect(con2, localhost, root) |
| 25 |
--echo # Normal MariaDB shutdown would roll back the above transaction. |
| 26 |
--echo # We want the transaction to remain open, so we will kill the server |
| 27 |
--echo # after ensuring that any non-transactional files are clean. |
| 28 |
FLUSH TABLES; |
| 29 |
--echo # Create another transaction that will be recovered as COMMITTED. |
| 30 |
BEGIN; |
| 31 |
# Generate multiple pages of both insert_undo and update_undo, so that |
| 32 |
# the state TRX_UNDO_CACHE will not be chosen. |
| 33 |
--disable_query_log |
| 34 |
let $n= 10000; |
| 35 |
while ($n) { |
| 36 |
dec $n; |
| 37 |
eval INSERT INTO t VALUES(-$n); |
| 38 |
eval DELETE FROM t WHERE a=-$n; |
| 39 |
} |
| 40 |
--enable_query_log |
| 41 |
SET DEBUG_SYNC='after_trx_committed_in_memory SIGNAL committed WAIT_FOR ever'; |
| 42 |
send COMMIT; |
| 43 |
|
| 44 |
connection default; |
| 45 |
SET DEBUG_SYNC='now WAIT_FOR committed'; |
| 46 |
--echo # Ensure that the above transactions become durable. |
| 47 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 48 |
BEGIN; |
| 49 |
INSERT INTO t VALUES(-10000); |
| 50 |
DELETE FROM t WHERE a=-10000; |
| 51 |
COMMIT; |
| 52 |
--let $restart_parameters= --innodb-force-recovery=3 |
| 53 |
--let $shutdown_timeout= 0 |
| 54 |
--source include/restart_mysqld.inc |
| 55 |
--let $shutdown_timeout= 30 |
| 56 |
--disconnect con1 |
| 57 |
--disconnect con2 |
| 58 |
SELECT * FROM t; |
| 59 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 60 |
--disable_ps2_protocol |
| 61 |
SELECT * FROM t; |
| 62 |
--enable_ps2_protocol |
| 63 |
# refused on MySQL 5.6, MariaDB 10.0, 10.1, but not MariaDB 10.2+ |
| 64 |
UPDATE t SET a=3 WHERE a=1; |
| 65 |
--let $restart_parameters= --innodb-read-only |
| 66 |
--source include/restart_mysqld.inc |
| 67 |
SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output; |
| 68 |
--echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. |
| 69 |
--echo # In earlier versions, this would return the last committed version |
| 70 |
--echo # (only a=3; no record for a=20)! |
| 71 |
SELECT * FROM t; |
| 72 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 73 |
SELECT * FROM t; |
| 74 |
--let $restart_parameters= --innodb-force-recovery=5 |
| 75 |
--source include/restart_mysqld.inc |
| 76 |
--echo # |
| 77 |
--echo # MDEV-15418 innodb_force_recovery=5 displays bogus warnings |
| 78 |
--echo # about too new transaction identifier |
| 79 |
--echo # |
| 80 |
--echo # With the fix, innodb_force_recovery=5 implies READ UNCOMMITTED. |
| 81 |
SELECT * FROM t; |
| 82 |
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; |
| 83 |
SELECT * FROM t; |
| 84 |
SET TRANSACTION ISOLATION LEVEL READ COMMITTED; |
| 85 |
SELECT * FROM t; |
| 86 |
|
| 87 |
--echo # |
| 88 |
--echo # MDEV-27332 SIGSEGV in fetch_data_into_cache |
| 89 |
--echo # |
| 90 |
BEGIN; |
| 91 |
SELECT trx_state FROM information_schema.innodb_trx; |
| 92 |
COMMIT; |
| 93 |
--let $restart_parameters= |
| 94 |
--source include/restart_mysqld.inc |
| 95 |
SELECT * FROM t; |
| 96 |
DROP TABLE t; |
| 97 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 98 |
--let SEARCH_PATTERN= Rolled back recovered transaction [^0] |
| 99 |
--source include/search_pattern_in_file.inc |