| 1 |
# Test for redo files cooperation between producer (log_writer) |
| 2 |
# and consumer (log_checkpointer) when it comes to log files |
| 3 |
# producing and consuming. |
| 4 |
|
| 5 |
--source include/have_debug.inc |
| 6 |
--source include/have_debug_sync.inc |
| 7 |
|
| 8 |
--echo # Prepare schema used in the tests. |
| 9 |
--source include/ib_log_spammer_init.inc |
| 10 |
CREATE TABLE t (a INT) ENGINE=InnoDB; |
| 11 |
|
| 12 |
--echo # Ensure there is a lot of free space in the redo log. |
| 13 |
SET GLOBAL innodb_log_checkpoint_now = ON; |
| 14 |
|
| 15 |
SET GLOBAL DEBUG = '+d,log_force_consumption'; |
| 16 |
|
| 17 |
SET GLOBAL DEBUG = '+d,syncpoint_log_before_waiting_for_next_file'; |
| 18 |
|
| 19 |
--echo # Freeze log files consumer. |
| 20 |
let err_msg=Redo log writer is waiting for a new redo log file. Consider increasing innodb_redo_log_capacity. The current log capacity is; |
| 21 |
--eval CALL mtr.add_suppression("$err_msg.*"); |
| 22 |
|
| 23 |
SET GLOBAL DEBUG = '+d,syncpoint_log_before_file_consume'; |
| 24 |
|
| 25 |
--echo # Wait until log files consumer is frozen. |
| 26 |
|
| 27 |
SET DEBUG_SYNC = 'now WAIT_FOR reached_log_before_file_consume'; |
| 28 |
|
| 29 |
--echo # Consumer is frozen. Create connection which generates spam to the redo log. |
| 30 |
|
| 31 |
--connect(C1,localhost,root,,test) |
| 32 |
--send CALL log_spammer() |
| 33 |
--connection default |
| 34 |
|
| 35 |
--echo # Redo log data is being generated. |
| 36 |
--echo # Wait until log_writer signals it is waiting for a next file available. |
| 37 |
|
| 38 |
SET DEBUG_SYNC = 'now WAIT_FOR reached_log_before_waiting_for_next_file'; |
| 39 |
|
| 40 |
SET GLOBAL DEBUG = '-d,syncpoint_log_before_waiting_for_next_file'; |
| 41 |
|
| 42 |
# No need to keep the log_writer paused because it will be waiting anyway. |
| 43 |
SET DEBUG_SYNC = 'now SIGNAL continue_log_before_waiting_for_next_file'; |
| 44 |
|
| 45 |
--echo # The log_writer is waiting because there are no free files and consumer is frozen. |
| 46 |
--echo # Check that error log received information about that. |
| 47 |
|
| 48 |
let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 49 |
|
| 50 |
let SEARCH_PATTERN=$err_msg; |
| 51 |
--source include/search_pattern.inc |
| 52 |
|
| 53 |
--echo # Unfreeze the log file consumer and wait until next log file is produced. |
| 54 |
|
| 55 |
SET GLOBAL DEBUG = '+d,syncpoint_log_after_file_produced'; |
| 56 |
|
| 57 |
SET GLOBAL DEBUG = '-d,syncpoint_log_before_file_consume'; |
| 58 |
|
| 59 |
SET DEBUG_SYNC = 'now SIGNAL continue_log_before_file_consume'; |
| 60 |
SET DEBUG_SYNC = 'now WAIT_FOR reached_log_after_file_produced'; |
| 61 |
|
| 62 |
SET GLOBAL DEBUG = '-d,syncpoint_log_after_file_produced'; |
| 63 |
SET DEBUG_SYNC = 'now SIGNAL continue_log_after_file_produced'; |
| 64 |
|
| 65 |
--echo # Create 1 row in t. |
| 66 |
INSERT INTO t(a) VALUES(42); |
| 67 |
|
| 68 |
--echo # Kill the MySQL and recover to see all is fine |
| 69 |
--source include/kill_and_restart_mysqld.inc |
| 70 |
|
| 71 |
SELECT * FROM t; |
| 72 |
|
| 73 |
--echo # Cleanup. |
| 74 |
SET DEBUG_SYNC = 'RESET'; |
| 75 |
DROP TABLE t; |
| 76 |
--source include/ib_log_spammer_cleanup.inc |