Commit 1293e5e5 authored by Marko Mäkelä's avatar Marko Mäkelä

Rewrite the innodb.log_file_size test with DBUG_EXECUTE_IF.

Remove the debug parameter innodb_force_recovery_crash that was
introduced into MySQL 5.6 by me in WL#6494 which allowed InnoDB
to resize the redo log on startup.

Let innodb.log_file_size actually start up the server, but ensure
that the InnoDB storage engine refuses to start up in each of the
scenarios.
parent 9f918b9c
......@@ -15,15 +15,38 @@ INSERT INTO t1 VALUES (123);
BEGIN;
DELETE FROM t1;
# Kill the server
--innodb-force-recovery-crash=1
--innodb-force-recovery-crash=3
--innodb-force-recovery-crash=4
--innodb-force-recovery-crash=5
--innodb-force-recovery-crash=6
--innodb-force-recovery-crash=7
--innodb-force-recovery-crash=8
--innodb-force-recovery-crash=9
--innodb-force-recovery-crash=10
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
a
42
......
......@@ -6,7 +6,7 @@
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
# innodb-force-recovery-crash needs debug
# DBUG_EXECUTE_IF is needed
--source include/have_debug.inc
if (`SELECT @@innodb_log_file_size = 1048576`) {
......@@ -18,6 +18,16 @@ call mtr.add_suppression("InnoDB: Resizing redo log");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
call mtr.add_suppression("InnoDB: New log files created");
call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
call mtr.add_suppression("syntax error in innodb_log_group_home_dir");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery");
call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfiles");
call mtr.add_suppression("InnoDB: Cannot create log files in read-only mode");
call mtr.add_suppression("InnoDB: Only one log file found");
call mtr.add_suppression("InnoDB: Log file .*ib_logfile[01].* size");
call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native AIO read support");
FLUSH TABLES;
--enable_query_log
......@@ -43,106 +53,122 @@ INSERT INTO t1 VALUES (123);
let MYSQLD_DATADIR= `select @@datadir`;
let SEARCH_ABORT = NOT FOUND;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
# MDEV-11689 FIXME: add --core-file to $args, and remove all ,134 below
let $args=--innodb --unknown-option --loose-console > $SEARCH_FILE 2>&1;
let $crash=$args --innodb-force-recovery-crash;
let SEARCH_RANGE= -50000;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
BEGIN;
DELETE FROM t1;
--source include/kill_mysqld.inc
--error 2
--exec $MYSQLD_CMD $args --innodb-log-group-home-dir=foo\;bar
--let $restart_parameters= --innodb-log-group-home-dir=foo\;bar
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=1
--error 3,134
--exec $MYSQLD_CMD $crash=1
--let $restart_parameters= --debug=d,innodb_log_abort_1
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=3
--error 3,134
--exec $MYSQLD_CMD $crash=3
--let $restart_parameters= --debug=d,innodb_log_abort_3
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--error 2
--exec $MYSQLD_CMD $args --innodb-read-only
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=4
--error 3,134
--exec $MYSQLD_CMD $crash=4
--let $restart_parameters= --debug=d,innodb_log_abort_4
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=5
--error 3,134
--exec $MYSQLD_CMD $crash=5
--let $restart_parameters= --debug=d,innodb_log_abort_5
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--error 2
--exec $MYSQLD_CMD $args --innodb-read-only
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=6
--error 3,134
--exec $MYSQLD_CMD $crash=6
--let $restart_parameters= --debug=d,innodb_log_abort_6
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=7
--error 3,134
--exec $MYSQLD_CMD $crash=7
# this crashes right after deleting all log files
--remove_file $SEARCH_FILE
--error 2
--exec $MYSQLD_CMD $args --innodb-read-only
--let $restart_parameters= --debug=d,innodb_log_abort_7
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
# this aborts right after deleting all log files
--let $restart_parameters= --innodb-read-only
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Cannot create log files in read-only mode;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=8
--error 3,134
--exec $MYSQLD_CMD $crash=8
--let $restart_parameters= --debug=d,innodb_log_abort_8
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=9
--error 3,134
--exec $MYSQLD_CMD $crash=9
--let $restart_parameters= --debug=d,innodb_log_abort_9
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--source include/shutdown_mysqld.inc
# We should have perfectly synced files here.
# Rename the log files, and trigger an error in recovery.
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden
--error 2,134
--exec $MYSQLD_CMD $args
--let $restart_parameters=
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Only one log file found;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
perl;
......@@ -150,11 +176,12 @@ die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0");
print FILE "garbage";
close(FILE);
EOF
--error 2,134
--exec $MYSQLD_CMD $args
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
......@@ -164,26 +191,28 @@ print FILE "junkfill" x 131072;
close(FILE);
EOF
--error 2,134
--exec $MYSQLD_CMD $args
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile1
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
--move_file $MYSQLD_DATADIR/ib_logfile1_hidden $MYSQLD_DATADIR/ib_logfile1
--echo --innodb-force-recovery-crash=10
--error 3,134
--exec $MYSQLD_CMD $crash=10
--let $restart_parameters= --debug=d,innodb_log_abort_10
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--let $restart_parameters=
--source include/start_mysqld.inc
--source include/restart_mysqld.inc
SELECT * FROM t1;
DROP TABLE t1;
select @@global.innodb_force_recovery_crash in (0, 1);
@@global.innodb_force_recovery_crash in (0, 1)
1
select @@global.innodb_force_recovery_crash;
@@global.innodb_force_recovery_crash
0
select @@session.innodb_force_recovery_crash;
ERROR HY000: Variable 'innodb_force_recovery_crash' is a GLOBAL variable
show global variables like 'innodb_force_recovery_crash';
Variable_name Value
innodb_force_recovery_crash 0
show session variables like 'innodb_force_recovery_crash';
Variable_name Value
innodb_force_recovery_crash 0
select * from information_schema.global_variables where variable_name='innodb_force_recovery_crash';
VARIABLE_NAME VARIABLE_VALUE
INNODB_FORCE_RECOVERY_CRASH 0
select * from information_schema.session_variables where variable_name='innodb_force_recovery_crash';
VARIABLE_NAME VARIABLE_VALUE
INNODB_FORCE_RECOVERY_CRASH 0
set global innodb_force_recovery_crash=1;
ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
set global innodb_force_recovery_crash=0;
ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
select @@global.innodb_force_recovery_crash;
@@global.innodb_force_recovery_crash
0
set session innodb_force_recovery_crash='some';
ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
set @@session.innodb_force_recovery_crash='some';
ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
set global innodb_force_recovery_crash='some';
ERROR HY000: Variable 'innodb_force_recovery_crash' is a read only variable
......@@ -1168,20 +1168,6 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_FORCE_RECOVERY_CRASH
SESSION_VALUE NULL
GLOBAL_VALUE 0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Kills the server during crash recovery.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 100
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_FT_AUX_TABLE
SESSION_VALUE NULL
GLOBAL_VALUE
......
--source include/have_innodb.inc
--source include/have_debug.inc
#
# exists as global only
#
select @@global.innodb_force_recovery_crash in (0, 1);
select @@global.innodb_force_recovery_crash;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_force_recovery_crash;
show global variables like 'innodb_force_recovery_crash';
show session variables like 'innodb_force_recovery_crash';
--disable_warnings
select * from information_schema.global_variables where variable_name='innodb_force_recovery_crash';
select * from information_schema.session_variables where variable_name='innodb_force_recovery_crash';
--enable_warnings
# show that it's read-only
#
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global innodb_force_recovery_crash=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global innodb_force_recovery_crash=0;
select @@global.innodb_force_recovery_crash;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set session innodb_force_recovery_crash='some';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@session.innodb_force_recovery_crash='some';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global innodb_force_recovery_crash='some';
......@@ -3,7 +3,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2015, 2016, MariaDB Corporation.
Copyright (c) 2015, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -4208,7 +4208,6 @@ btr_cur_pessimistic_update(
ut_ad(thr_get_trx(thr)->in_rollback);
DBUG_EXECUTE_IF("ib_blob_update_rollback", DBUG_SUICIDE(););
RECOVERY_CRASH(99);
btr_rec_free_updated_extern_fields(
index, rec, page_zip, *offsets, update, true, mtr);
......
......@@ -21326,13 +21326,6 @@ static MYSQL_SYSVAR_ULONG(force_recovery, srv_force_recovery,
"Helps to save your data in case the disk image of the database becomes corrupt.",
NULL, NULL, 0, 0, 6, 0);
#ifndef DBUG_OFF
static MYSQL_SYSVAR_ULONG(force_recovery_crash, srv_force_recovery_crash,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Kills the server during crash recovery.",
NULL, NULL, 0, 0, 100, 0);
#endif /* !DBUG_OFF */
static MYSQL_SYSVAR_ULONG(page_size, srv_page_size,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Page size to use for all InnoDB tablespaces.",
......@@ -21975,9 +21968,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(flush_log_at_trx_commit),
MYSQL_SYSVAR(flush_method),
MYSQL_SYSVAR(force_recovery),
#ifndef DBUG_OFF
MYSQL_SYSVAR(force_recovery_crash),
#endif /* !DBUG_OFF */
MYSQL_SYSVAR(fill_factor),
MYSQL_SYSVAR(ft_cache_size),
MYSQL_SYSVAR(ft_total_cache_size),
......
......@@ -450,9 +450,6 @@ extern double srv_adaptive_flushing_lwm;
extern ulong srv_flushing_avg_loops;
extern ulong srv_force_recovery;
#ifndef DBUG_OFF
extern ulong srv_force_recovery_crash;
#endif /* !DBUG_OFF */
extern ulint srv_fast_shutdown; /*!< If this is 1, do not do a
purge and index buffer merge.
......
......@@ -34,19 +34,6 @@ Created 10/10/1995 Heikki Tuuri
// Forward declaration
struct dict_table_t;
#ifdef DBUG_OFF
# define RECOVERY_CRASH(x) do {} while(0)
#else
# define RECOVERY_CRASH(x) do { \
if (srv_force_recovery_crash == x) { \
fprintf(stderr, "innodb_force_recovery_crash=%lu\n", \
srv_force_recovery_crash); \
fflush(stderr); \
exit(3); \
} \
} while (0)
#endif /* DBUG_OFF */
/** If buffer pool is less than the size,
only one buffer pool instance is used. */
#define BUF_POOL_SIZE_THRESHOLD (1024 * 1024 * 1024)
......
/*****************************************************************************
Copyright (c) 2012, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -30,7 +31,6 @@ Created 2012-03-24 Sunny Bains.
extern uint srv_spin_wait_delay;
extern ulong srv_n_spin_wait_rounds;
extern ulong srv_force_recovery_crash;
#include "sync0policy.h"
#include "ib0mutex.h"
......
......@@ -359,11 +359,6 @@ starting from SRV_FORCE_IGNORE_CORRUPT, so that data can be recovered
by SELECT or mysqldump. When this is nonzero, we do not allow any user
modifications to the data. */
ulong srv_force_recovery;
#ifndef DBUG_OFF
/** Inject a crash at different steps of the recovery process.
This is for testing and debugging only. */
ulong srv_force_recovery_crash;
#endif /* !DBUG_OFF */
/** Print all user-level transactions deadlocks to mysqld stderr */
......
......@@ -418,12 +418,12 @@ create_log_files(
file should be recoverable. The buffer
pool was clean, and we can simply create
all log files from the scratch. */
RECOVERY_CRASH(6);
DBUG_EXECUTE_IF("innodb_log_abort_6", return(DB_ERROR););
}
ut_ad(!buf_pool_check_no_pending_io());
RECOVERY_CRASH(7);
DBUG_EXECUTE_IF("innodb_log_abort_7", return(DB_ERROR););
for (unsigned i = 0; i < srv_n_log_files; i++) {
sprintf(logfilename + dirnamelen,
......@@ -436,7 +436,7 @@ create_log_files(
}
}
RECOVERY_CRASH(8);
DBUG_EXECUTE_IF("innodb_log_abort_8", return(DB_ERROR););
/* We did not create the first log file initially as
ib_logfile0, so that crash recovery cannot find it until it
......@@ -488,10 +488,16 @@ create_log_files(
return(DB_SUCCESS);
}
/*********************************************************************//**
Renames the first log file. */
/** Rename the first redo log file.
@param[in,out] logfilename buffer for the log file name
@param[in] dirnamelen length of the directory path
@param[in] lsn FIL_PAGE_FILE_FLUSH_LSN value
@param[in,out] logfile0 name of the first log file
@return error code
@retval DB_SUCCESS on successful operation */
MY_ATTRIBUTE((warn_unused_result, nonnull))
static
void
dberr_t
create_log_files_rename(
/*====================*/
char* logfilename, /*!< in/out: buffer for log file name */
......@@ -502,6 +508,9 @@ create_log_files_rename(
/* If innodb_flush_method=O_DSYNC,
we need to explicitly flush the log buffers. */
fil_flush(SRV_LOG_SPACE_FIRST_ID);
DBUG_EXECUTE_IF("innodb_log_abort_9", return(DB_ERROR););
/* Close the log files, so that we can rename
the first one. */
fil_close_log_files(false);
......@@ -510,26 +519,26 @@ create_log_files_rename(
checkpoint has been created. */
sprintf(logfilename + dirnamelen, "ib_logfile%u", 0);
RECOVERY_CRASH(9);
ib::info() << "Renaming log file " << logfile0 << " to "
<< logfilename;
log_mutex_enter();
ut_ad(strlen(logfile0) == 2 + strlen(logfilename));
bool success = os_file_rename(
innodb_log_file_key, logfile0, logfilename);
ut_a(success);
RECOVERY_CRASH(10);
dberr_t err = os_file_rename(
innodb_log_file_key, logfile0, logfilename)
? DB_SUCCESS : DB_ERROR;
/* Replace the first file with ib_logfile0. */
strcpy(logfile0, logfilename);
log_mutex_exit();
DBUG_EXECUTE_IF("innodb_log_abort_10", err = DB_ERROR;);
fil_open_log_and_system_tablespace_files();
ib::warn() << "New log files created, LSN=" << lsn;
return(err);
}
/*********************************************************************//**
......@@ -1117,8 +1126,6 @@ srv_open_tmp_tablespace(bool create_new_db)
srv_tmp_space.set_space_id(SRV_TMP_SPACE_ID);
RECOVERY_CRASH(100);
dberr_t err = srv_tmp_space.check_file_spec(
&create_new_temp_space, 12 * 1024 * 1024);
......@@ -1347,7 +1354,7 @@ srv_prepare_to_delete_redo_log_files(
/* Clean the buffer pool. */
buf_flush_sync_all_buf_pools();
RECOVERY_CRASH(1);
DBUG_EXECUTE_IF("innodb_log_abort_1", return(0););
log_mutex_enter();
......@@ -1952,14 +1959,17 @@ innobase_start_or_create_for_mysql(void)
logfilename, dirnamelen,
flushed_lsn, logfile0);
if (err == DB_SUCCESS) {
err = create_log_files_rename(
logfilename,
dirnamelen,
flushed_lsn, logfile0);
}
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
create_log_files_rename(
logfilename, dirnamelen,
flushed_lsn, logfile0);
/* Suppress the message about
crash recovery. */
flushed_lsn = log_get_lsn();
......@@ -2119,13 +2129,15 @@ innobase_start_or_create_for_mysql(void)
err = fil_write_flushed_lsn(flushed_lsn);
if (err == DB_SUCCESS) {
err = create_log_files_rename(
logfilename, dirnamelen,
flushed_lsn, logfile0);
}
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
create_log_files_rename(
logfilename, dirnamelen, flushed_lsn, logfile0);
} else {
/* Check if we support the max format that is stamped
......@@ -2348,28 +2360,32 @@ innobase_start_or_create_for_mysql(void)
/* Prepare to delete the old redo log files */
flushed_lsn = srv_prepare_to_delete_redo_log_files(i);
DBUG_EXECUTE_IF("innodb_log_abort_1",
return(srv_init_abort(DB_ERROR)););
/* Prohibit redo log writes from any other
threads until creating a log checkpoint at the
end of create_log_files(). */
ut_d(recv_no_log_write = true);
ut_ad(!buf_pool_check_no_pending_io());
RECOVERY_CRASH(3);
DBUG_EXECUTE_IF("innodb_log_abort_3",
return(srv_init_abort(DB_ERROR)););
/* Stamp the LSN to the data files. */
err = fil_write_flushed_lsn(flushed_lsn);
DBUG_EXECUTE_IF("innodb_log_abort_4", err = DB_ERROR;);
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
RECOVERY_CRASH(4);
/* Close and free the redo log files, so that
we can replace them. */
fil_close_log_files(true);
RECOVERY_CRASH(5);
DBUG_EXECUTE_IF("innodb_log_abort_5",
return(srv_init_abort(DB_ERROR)););
/* Free the old log file space. */
log_group_close_all();
......@@ -2383,13 +2399,15 @@ innobase_start_or_create_for_mysql(void)
logfilename, dirnamelen, flushed_lsn,
logfile0);
if (err == DB_SUCCESS) {
err = create_log_files_rename(
logfilename, dirnamelen, flushed_lsn,
logfile0);
}
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
}
create_log_files_rename(
logfilename, dirnamelen, flushed_lsn,
logfile0);
}
recv_recovery_rollback_active();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment