Commit 743ac7c2 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12061 Allow innodb_log_files_in_group=1

The InnoDB redo log consists of a list of files that logically form
a bigger file, as if the individual files were concatenated together.

The first file will always be written on redo log checkpoint, because
the two checkpoint pages are at the start of the single logical
redo log file.

There is no technical reason why InnoDB requires at least 2 files
to exist. Let us reduce the minimum number to 1. In that way,
restoring from backups will become easier, since InnoDB can directly
deal with a single backed-up redo log file.
parent 3d85292a
......@@ -335,50 +335,12 @@ ibdata2
undo001
undo002
undo003
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND /Only one log file found/ in mysqld.1.err
bak_ib_logfile0
bak_ib_logfile1
bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
ib_logfile2
ibdata1
ibdata2
undo001
undo002
undo003
# 12. With ibdata*, without ib_logfile2
bak_ib_logfile0
bak_ib_logfile1
bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
ib_logfile1
ibdata1
ibdata2
undo001
undo002
undo003
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES
WHERE engine='innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
1
1
FOUND /Resizing redo log from 2\*\d+ to 3\*\d+ pages, LSN=\d+/ in mysqld.1.err
FOUND /Resizing redo log from 1\*\d+ to 3\*\d+ pages, LSN=\d+/ in mysqld.1.err
# Cleanup
bak_ib_logfile0
bak_ib_logfile1
......
......@@ -53,8 +53,6 @@ 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
123
......
......@@ -26,7 +26,7 @@ let bugdir= $MYSQLTEST_VARDIR/tmp/log_file;
--mkdir $bugdir
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_RANGE = -50000;
let SEARCH_RANGE = -100000;
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
......@@ -217,21 +217,9 @@ eval $check_no_innodb;
--remove_file $bugdir/ib_logfile1
--list_files $bugdir
--source include/start_mysqld.inc
eval $check_no_innodb;
--source include/shutdown_mysqld.inc
let SEARCH_PATTERN=Only one log file found;
--source include/search_pattern_in_file.inc
# clean up & Restore
--source ../include/log_file_cleanup.inc
--echo # 12. With ibdata*, without ib_logfile2
--remove_file $bugdir/ib_logfile2
--list_files $bugdir
--source include/start_mysqld.inc
eval $check_yes_innodb;
--source include/shutdown_mysqld.inc
let SEARCH_PATTERN=Resizing redo log from 2\*\d+ to 3\*\d+ pages, LSN=\d+;
--let SEARCH_PATTERN=Resizing redo log from 1\*\d+ to 3\*\d+ pages, LSN=\d+
--source include/search_pattern_in_file.inc
--let $restart_parameters=
......
......@@ -163,25 +163,15 @@ let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
# 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
--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
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
perl;
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0");
print FILE "garbage";
close(FILE);
EOF
--source include/restart_mysqld.inc
--source include/start_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;
......
......@@ -1470,7 +1470,7 @@ DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
NUMERIC_MIN_VALUE 2
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
......
......@@ -21265,7 +21265,7 @@ static MYSQL_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size,
static MYSQL_SYSVAR_ULONG(log_files_in_group, srv_n_log_files,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of log files in the log group. InnoDB writes to the files in a circular fashion.",
NULL, NULL, 2, 2, SRV_N_LOG_FILES_MAX, 0);
NULL, NULL, 2, 1, SRV_N_LOG_FILES_MAX, 0);
static MYSQL_SYSVAR_ULONG(log_write_ahead_size, srv_log_write_ahead_size,
PLUGIN_VAR_RQCMDARG,
......
......@@ -205,9 +205,9 @@ extern bool trx_commit_disallowed;
#endif /* UNIV_DEBUG */
/*------------------------- LOG FILES ------------------------ */
char* srv_log_group_home_dir = NULL;
char* srv_log_group_home_dir;
ulong srv_n_log_files = SRV_N_LOG_FILES_MAX;
ulong srv_n_log_files;
/** At startup, this is the current redo log file size.
During startup, if this is different from srv_log_file_size_requested
(innodb_log_file_size), the redo log will be rebuilt and this size
......
......@@ -1977,11 +1977,6 @@ innobase_start_or_create_for_mysql(void)
crash recovery. */
flushed_lsn = log_get_lsn();
goto files_checked;
} else if (i < 2) {
/* must have at least 2 log files */
ib::error() << "Only one log file"
" found.";
return(srv_init_abort(err));
}
/* opened all files */
......
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