mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Simplify a WL#6494/WL#7142 test.
The test innodb.log_file_size_checkpoint was originally added to MySQL 5.7 by me in a bug fix, to fix the interaction of WL#6494 (redo log resizing, introduced in MySQL 5.6) and WL#7142 (data file discovery based on MLOG_FILE_NAME records, introduced in MySQL 5.7): commit 70f9ef4e1220827132b50275ca7272f2bcca1864 Author: Marko Mäkelä <marko.makela@oracle.com> Date: Wed May 21 13:31:29 2014 +0300 Bug#18755095 REDO LOG SIZE CHANGE AFTER CRASH RESULTS IN CHECKPOINT AGE ERROR MESSAGE This is a regression from fixing Bug#18730524 REPEATED KILL+RESTART FAILS DUE TO MISSING MLOG_FILE_NAME RECORD innobase_start_or_create_for_mysql(): Invoke fil_names_clear() before creating the "checkpoint" when changing redo log files. Approved by Jimmy Yang on IM. The relevant part of the test is that fil_names_clear() is invoked to emit an MLOG_CHECKPOINT record before the redo log files are deleted. In case the server is killed before ib_logfile0 has been deleted, the old (not-yet-resized) redo log will be treated as valid. We do not need to create a large number of tables for that.
This commit is contained in:
@ -5,4 +5,10 @@
|
||||
SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus';
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
# Kill the server
|
||||
SELECT * FROM t1;
|
||||
ERROR 42000: Unknown storage engine 'InnoDB'
|
||||
FOUND /InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either/ in mysqld.1.err
|
||||
SELECT * FROM t1;
|
||||
ERROR 42000: Unknown storage engine 'InnoDB'
|
||||
FOUND /srv_prepare_to_delete_redo_log_files: ib_log: MLOG_CHECKPOINT.* written/ in mysqld.1.err
|
||||
DROP TABLE t1;
|
||||
|
@ -1,4 +0,0 @@
|
||||
CREATE DATABASE logtest;
|
||||
USE logtest;
|
||||
# Kill and restart: --innodb-log-files-in-group=2 --innodb-log-file-size=4M --innodb-buffer-pool-size=50M
|
||||
DROP DATABASE logtest;
|
@ -10,9 +10,15 @@
|
||||
|
||||
SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus';
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
|
||||
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
|
||||
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
|
||||
FLUSH TABLES;
|
||||
--enable_query_log
|
||||
|
||||
--let $n_logs=`SELECT if(@@innodb_log_files_in_group = 1, 2, 1)`
|
||||
--let $resize= --innodb-log-files-in-group=$n_logs --innodb-log-file-size=4M
|
||||
|
||||
--source include/no_checkpoint_start.inc
|
||||
|
||||
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
@ -20,12 +26,24 @@ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
--let CLEANUP_IF_CHECKPOINT=DROP TABLE t1;
|
||||
--source include/no_checkpoint_end.inc
|
||||
|
||||
--let $restart_parameters= --debug=d,innodb_log_abort_1 $resize
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
DROP TABLE t1;
|
||||
--error ER_UNKNOWN_STORAGE_ENGINE
|
||||
SELECT * FROM t1;
|
||||
|
||||
--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err
|
||||
--let SEARCH_PATTERN = InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either
|
||||
--let SEARCH_ABORT = NOT FOUND
|
||||
--let SEARCH_RANGE = -50000
|
||||
--let SEARCH_PATTERN = InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--let $restart_parameters= --debug=d,innodb_log_abort_3,ib_log $resize
|
||||
--source include/restart_mysqld.inc
|
||||
--error ER_UNKNOWN_STORAGE_ENGINE
|
||||
SELECT * FROM t1;
|
||||
--let SEARCH_PATTERN= srv_prepare_to_delete_redo_log_files: ib_log: MLOG_CHECKPOINT.* written
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--let $restart_parameters=
|
||||
--source include/restart_mysqld.inc
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/no_valgrind_without_big.inc
|
||||
|
||||
CREATE DATABASE logtest;
|
||||
USE logtest;
|
||||
let $n=250;
|
||||
let $t=veryLongTableNameToCreateMLOG_FILE_NAMErecords;
|
||||
|
||||
--disable_query_log
|
||||
let $i=$n;
|
||||
while ($i)
|
||||
{
|
||||
--eval CREATE TABLE $t$i(a INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
dec $i;
|
||||
}
|
||||
|
||||
# If we set above n to 500, this test case could fail easily, because
|
||||
# the inndob buffer pool is too small, some of which would be occupied
|
||||
# by the recv*. With n=250, this test case could sporadically fail too.
|
||||
# So we have to set buffer pool size to 50M which should be enough for this
|
||||
# test case. Once we fix the bug#22179133 and bug#22186325, we should use
|
||||
# the default innodb buffer pool(or the smaller one).
|
||||
let $restart_parameters = --innodb-log-files-in-group=2 --innodb-log-file-size=4M --innodb-buffer-pool-size=50M;
|
||||
--source include/kill_and_restart_mysqld.inc
|
||||
|
||||
DROP DATABASE logtest;
|
@ -421,9 +421,11 @@ create_log_files(
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_6", return(DB_ERROR););
|
||||
}
|
||||
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_6"));
|
||||
ut_ad(!buf_pool_check_no_pending_io());
|
||||
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_7", return(DB_ERROR););
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_7"));
|
||||
|
||||
for (unsigned i = 0; i < srv_n_log_files; i++) {
|
||||
sprintf(logfilename + dirnamelen,
|
||||
@ -437,6 +439,7 @@ create_log_files(
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_8", return(DB_ERROR););
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_8"));
|
||||
|
||||
/* We did not create the first log file initially as
|
||||
ib_logfile0, so that crash recovery cannot find it until it
|
||||
@ -445,7 +448,7 @@ create_log_files(
|
||||
|
||||
fil_space_t* log_space = fil_space_create(
|
||||
"innodb_redo_log", SRV_LOG_SPACE_FIRST_ID, 0, FIL_TYPE_LOG,
|
||||
NULL, /* No encryption yet */
|
||||
NULL, /* innodb_encrypt_log works at a different level */
|
||||
true /* this is create */);
|
||||
ut_a(fil_validate());
|
||||
ut_a(log_space != NULL);
|
||||
@ -513,6 +516,7 @@ create_log_files_rename(
|
||||
fil_flush(SRV_LOG_SPACE_FIRST_ID);
|
||||
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_9", return(DB_ERROR););
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_9"));
|
||||
|
||||
/* Close the log files, so that we can rename
|
||||
the first one. */
|
||||
@ -1348,6 +1352,8 @@ lsn_t
|
||||
srv_prepare_to_delete_redo_log_files(
|
||||
ulint n_files)
|
||||
{
|
||||
DBUG_ENTER("srv_prepare_to_delete_redo_log_files");
|
||||
|
||||
lsn_t flushed_lsn;
|
||||
ulint pending_io = 0;
|
||||
ulint count = 0;
|
||||
@ -1356,7 +1362,8 @@ srv_prepare_to_delete_redo_log_files(
|
||||
/* Clean the buffer pool. */
|
||||
buf_flush_sync_all_buf_pools();
|
||||
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_1", return(0););
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_1", DBUG_RETURN(0););
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_1"));
|
||||
|
||||
log_mutex_enter();
|
||||
|
||||
@ -1426,7 +1433,7 @@ srv_prepare_to_delete_redo_log_files(
|
||||
|
||||
} while (buf_pool_check_no_pending_io());
|
||||
|
||||
return(flushed_lsn);
|
||||
DBUG_RETURN(flushed_lsn);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
@ -2346,11 +2353,13 @@ files_checked:
|
||||
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_3",
|
||||
return(srv_init_abort(DB_ERROR)););
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_3"));
|
||||
|
||||
/* Stamp the LSN to the data files. */
|
||||
err = fil_write_flushed_lsn(flushed_lsn);
|
||||
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_4", err = DB_ERROR;);
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_4"));
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
return(srv_init_abort(err));
|
||||
@ -2362,6 +2371,7 @@ files_checked:
|
||||
|
||||
DBUG_EXECUTE_IF("innodb_log_abort_5",
|
||||
return(srv_init_abort(DB_ERROR)););
|
||||
DBUG_PRINT("ib_log", ("After innodb_log_abort_5"));
|
||||
|
||||
/* Free the old log file space. */
|
||||
log_group_close_all();
|
||||
|
Reference in New Issue
Block a user