summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2020-01-12 02:05:28 +0700
committerEugene Kosov <claprix@yandex.ru>2020-02-19 12:21:59 +0300
commit9ef2d29ff44de2013c95666a011b993e5c2e5674 (patch)
treec7f6f4c73243db0230c5a689a369000f73944982
parent8d7a8e45bf8c320ed006f7f41b34f6e58fca659a (diff)
downloadmariadb-git-9ef2d29ff44de2013c95666a011b993e5c2e5674.tar.gz
MDEV-14425 deprecate and ignore innodb_log_files_in_group
Now there can be only one log file instead of several which logically work as a single file. Possible names of redo log files: ib_logfile0, ib_logfile101 (for just created one) innodb_log_fiels_in_group: value of this variable is not used by InnoDB. Possible values are still 1..100, to not break upgrade LOG_FILE_NAME: add constant of value "ib_logfile0" LOG_FILE_NAME_PREFIX: add constant of value "ib_logfile" get_log_file_path(): convenience function that returns full path of a redo log file SRV_N_LOG_FILES_MAX: removed srv_n_log_files: we can't remove this for compatibility reasons, but now server doesn't use this variable log_sys_t::file::fd: now just one, not std::vector log_sys_t::log_capacity: removed word 'group' find_and_check_log_file(): part of logic from huge srv_start() moved here recv_sys_t::files: file descriptors of redo log files. There can be several of those in case we're upgrading from older MariaDB version. recv_sys_t::remove_extra_log_files: whether to remove ib_logfile{1,2,3...} after successfull upgrade. recv_sys_t::read(): open if needed and read from one of several log files recv_sys_t::files_size(): open if needed and return files count redo_file_sizes_are_correct(): check that redo log files sizes are equal. Just to log an error for a user. Corresponding check was moved from srv0start.cc namespace deprecated: put all deprecated variables here to prevent usage of it by us, developers
-rw-r--r--extra/mariabackup/backup_copy.cc21
-rw-r--r--extra/mariabackup/backup_mysql.cc6
-rw-r--r--extra/mariabackup/xtrabackup.cc57
-rw-r--r--mysql-test/include/default_mysqld.cnf1
-rw-r--r--mysql-test/suite/encryption/r/innodb_encrypt_log.result2
-rw-r--r--mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result3
-rw-r--r--mysql-test/suite/encryption/t/innodb_encrypt_log.opt1
-rw-r--r--mysql-test/suite/encryption/t/innodb_encrypt_log.test2
-rw-r--r--mysql-test/suite/innodb/include/log_file_cleanup.inc2
-rw-r--r--mysql-test/suite/innodb/r/log_corruption.result3
-rw-r--r--mysql-test/suite/innodb/r/log_file.result106
-rw-r--r--mysql-test/suite/innodb/r/log_file_name_debug.result6
-rw-r--r--mysql-test/suite/innodb/r/log_file_size.result22
-rw-r--r--mysql-test/suite/innodb/t/doublewrite.test2
-rw-r--r--mysql-test/suite/innodb/t/log_corruption.test4
-rw-r--r--mysql-test/suite/innodb/t/log_file.test16
-rw-r--r--mysql-test/suite/innodb/t/log_file_name_debug.test6
-rw-r--r--mysql-test/suite/innodb/t/log_file_size.test29
-rw-r--r--mysql-test/suite/mariabackup/huge_lsn.result2
-rw-r--r--mysql-test/suite/mariabackup/huge_lsn.test2
-rw-r--r--mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--storage/innobase/handler/ha_innodb.cc95
-rw-r--r--storage/innobase/include/fil0fil.h3
-rw-r--r--storage/innobase/include/log0log.h115
-rw-r--r--storage/innobase/include/log0log.ic12
-rw-r--r--storage/innobase/include/log0recv.h14
-rw-r--r--storage/innobase/include/srv0srv.h5
-rw-r--r--storage/innobase/log/log0log.cc172
-rw-r--r--storage/innobase/log/log0recv.cc153
-rw-r--r--storage/innobase/os/os0file.cc58
-rw-r--r--storage/innobase/srv/srv0srv.cc1
-rw-r--r--storage/innobase/srv/srv0start.cc487
33 files changed, 637 insertions, 775 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index c1e96422dec..edcbb94c20f 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1863,24 +1863,25 @@ copy_back()
dst_dir = (srv_log_group_home_dir && *srv_log_group_home_dir)
? srv_log_group_home_dir : mysql_data_home;
- /* --backup generates a single ib_logfile0, which we must copy
+ /* --backup generates a single LOG_FILE_NAME, which we must copy
if it exists. */
ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);
MY_STAT stat_arg;
- if (!my_stat("ib_logfile0", &stat_arg, MYF(0)) || !stat_arg.st_size) {
+ if (!my_stat(LOG_FILE_NAME, &stat_arg, MYF(0)) || !stat_arg.st_size) {
/* After completed --prepare, redo log files are redundant.
We must delete any redo logs at the destination, so that
the database will not jump to a different log sequence number
(LSN). */
- for (uint i = 0; i <= SRV_N_LOG_FILES_MAX + 1; i++) {
- char filename[FN_REFLEN];
- snprintf(filename, sizeof filename, "%s/ib_logfile%u",
- dst_dir, i);
- unlink(filename);
- }
- } else if (!(ret = copy_or_move_file("ib_logfile0", "ib_logfile0",
+ char filename[FN_REFLEN];
+ snprintf(filename, sizeof filename, "%s/%s0", dst_dir,
+ LOG_FILE_NAME_PREFIX);
+ unlink(filename);
+ snprintf(filename, sizeof filename, "%s/%s101", dst_dir,
+ LOG_FILE_NAME_PREFIX);
+ unlink(filename);
+ } else if (!(ret = copy_or_move_file(LOG_FILE_NAME, LOG_FILE_NAME,
dst_dir, 1))) {
goto cleanup;
}
@@ -1972,7 +1973,7 @@ copy_back()
}
/* skip the redo log (it was already copied) */
- if (!strcmp(filename, "ib_logfile0")) {
+ if (!strcmp(filename, LOG_FILE_NAME)) {
continue;
}
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index 9cac43dd6f8..df8d1c0956b 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -483,9 +483,7 @@ get_mysql_vars(MYSQL *connection)
}
if (innodb_log_files_in_group_var) {
- srv_n_log_files = strtol(
- innodb_log_files_in_group_var, &endptr, 10);
- ut_ad(*endptr == 0);
+ // deprecated
}
if (innodb_log_file_size_var) {
@@ -1573,7 +1571,6 @@ bool write_backup_config_file()
"[mysqld]\n"
"innodb_checksum_algorithm=%s\n"
"innodb_data_file_path=%s\n"
- "innodb_log_files_in_group=%lu\n"
"innodb_log_file_size=%llu\n"
"innodb_page_size=%lu\n"
"innodb_undo_directory=%s\n"
@@ -1583,7 +1580,6 @@ bool write_backup_config_file()
"%s\n",
innodb_checksum_algorithm_names[srv_checksum_algorithm],
make_local_paths(innobase_data_file_path).c_str(),
- srv_n_log_files,
srv_log_file_size,
srv_page_size,
srv_undo_dir,
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 70ddc933fe3..a17aace794b 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -1166,6 +1166,10 @@ uint xb_client_options_count = array_elements(xb_client_options);
static const char *dbug_option;
#endif
+namespace deprecated {
+extern ulong srv_n_log_files;
+}
+
struct my_option xb_server_options[] =
{
{"datadir", 'h', "Path to the database root.", (G_PTR*) &mysql_data_home,
@@ -1274,7 +1278,7 @@ struct my_option xb_server_options[] =
UNIV_PAGE_SIZE_MAX, 0},
{"innodb_log_files_in_group", OPT_INNODB_LOG_FILES_IN_GROUP,
"Ignored for mysqld option compatibility",
- &srv_n_log_files, &srv_n_log_files,
+ &deprecated::srv_n_log_files, &deprecated::srv_n_log_files,
0, GET_LONG, REQUIRED_ARG, 1, 1, 100, 0, 1, 0},
{"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR,
"Path to InnoDB log files.", &srv_log_group_home_dir,
@@ -2894,7 +2898,7 @@ Initialize the appropriate datasink(s). Both local backups and streaming in the
Otherwise (i.e. when streaming in the 'tar' format) we need 2 separate datasinks
for the data stream (and don't allow parallel data copying) and for metainfo
-files (including ib_logfile0). The second datasink writes to temporary
+files (including LOG_FILE_NAME). The second datasink writes to temporary
files first, and then streams them in a serialized way when closed. */
static void
xtrabackup_init_datasinks(void)
@@ -3760,36 +3764,6 @@ xb_filters_free()
}
}
-/**Create log file metadata.
-@param[in] i log file number in group
-@param[in,out] file_names redo log file names */
-static
-void
-open_or_create_log_file(
- ulint i,
- std::vector<std::string> &file_names)
-{
- char name[FN_REFLEN];
- ulint dirnamelen;
-
- os_normalize_path(srv_log_group_home_dir);
-
- dirnamelen = strlen(srv_log_group_home_dir);
- ut_a(dirnamelen < (sizeof name) - 10 - sizeof "ib_logfile");
- memcpy(name, srv_log_group_home_dir, dirnamelen);
-
- /* Add a path separator if needed. */
- if (dirnamelen && name[dirnamelen - 1] != OS_PATH_SEPARATOR) {
- name[dirnamelen++] = OS_PATH_SEPARATOR;
- }
-
- sprintf(name + dirnamelen, "%s%zu", "ib_logfile", i);
-
- ut_a(fil_validate());
-
- file_names.emplace_back(name);
-}
-
/***********************************************************************
Set the open files limit. Based on set_max_open_files().
@@ -4046,15 +4020,8 @@ fail:
SRV_MAX_N_PENDING_SYNC_IOS);
log_sys.create();
- log_sys.log.create(srv_n_log_files);
-
- std::vector<std::string> file_names;
-
- for (ulint i = 0; i < srv_n_log_files; i++) {
- open_or_create_log_file(i, file_names);
- }
-
- log_sys.log.open_files(std::move(file_names));
+ log_sys.log.create();
+ log_sys.log.open_file(get_log_file_path());
/* create extra LSN dir if it does not exist. */
if (xtrabackup_extra_lsndir
@@ -4123,10 +4090,10 @@ reread_log_header:
/* open the log file */
memset(&stat_info, 0, sizeof(MY_STAT));
- dst_log_file = ds_open(ds_redo, "ib_logfile0", &stat_info);
+ dst_log_file = ds_open(ds_redo, LOG_FILE_NAME, &stat_info);
if (dst_log_file == NULL) {
- msg("Error: failed to open the target stream for "
- "'ib_logfile0'.");
+ msg("Error: failed to open the target stream for '%s'.",
+ LOG_FILE_NAME);
goto fail;
}
@@ -4147,7 +4114,7 @@ reread_log_header:
log_hdr_field +=
(log_sys.next_checkpoint_no & 1) ? LOG_CHECKPOINT_2 : LOG_CHECKPOINT_1;
/* The least significant bits of LOG_CHECKPOINT_OFFSET must be
- stored correctly in the copy of the ib_logfile. The most significant
+ stored correctly in the copy of the LOG_FILE_NAME. The most significant
bits, which identify the start offset of the log block in the file,
we did choose freely, as LOG_FILE_HDR_SIZE. */
ut_ad(!((log_sys.log.get_lsn() ^ checkpoint_lsn_start)
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 9674260e898..e85f3ffbde3 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -54,7 +54,6 @@ loose-innodb_write_io_threads= 2
loose-innodb_read_io_threads= 2
loose-innodb_log_buffer_size= 1M
loose-innodb_log_file_size= 10M
-loose-innodb_log_files_in_group= 1
loose-innodb-stats-persistent= OFF
slave-net-timeout=120
diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log.result b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
index 86446e4eabd..1a7a9267b60 100644
--- a/mysql-test/suite/encryption/r/innodb_encrypt_log.result
+++ b/mysql-test/suite/encryption/r/innodb_encrypt_log.result
@@ -40,7 +40,7 @@ NOT FOUND /private|secret|sacr(ed|ament)|success|story|secur(e|ity)/ in t0.ibd
# ib_logfile0 expecting NOT FOUND
NOT FOUND /private|secret|sacr(ed|ament)|success|story|secur(e|ity)/ in ib_logfile0
# Restart without redo log encryption
-# restart: --skip-innodb-encrypt-log --innodb-log-files-in-group=1
+# restart: --skip-innodb-encrypt-log
SELECT COUNT(*) FROM t0;
COUNT(*)
1024
diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result b/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result
index 3a1aea4c1fd..8d1eb447b03 100644
--- a/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result
+++ b/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result
@@ -53,13 +53,14 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files 2097152 bytes!/ in mysqld.1.err
+FOUND 1 /InnoDB: Upgrade after a crash is not supported\. The redo log was created with BogoDB 1\.2\.3\.4, and it appears corrupted\./ in mysqld.1.err
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
-FOUND 1 /InnoDB: Upgrade after a crash is not supported\. The redo log was created with BogoDB 1\.2\.3\.4, and it appears corrupted\./ in mysqld.1.err
+FOUND 2 /InnoDB: Upgrade after a crash is not supported\. The redo log was created with BogoDB 1\.2\.3\.4, and it appears corrupted\./ in mysqld.1.err
# Empty multi-file redo log from after MariaDB 10.2.2
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_log.opt b/mysql-test/suite/encryption/t/innodb_encrypt_log.opt
index 34dc9a80f87..24046fe779a 100644
--- a/mysql-test/suite/encryption/t/innodb_encrypt_log.opt
+++ b/mysql-test/suite/encryption/t/innodb_encrypt_log.opt
@@ -3,5 +3,4 @@
--plugin-load-add=$FILE_KEY_MANAGEMENT_SO
--loose-file-key-management
--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt
---innodb-log-files-in-group=1
--file-key-management-encryption-algorithm=aes_cbc
diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_log.test b/mysql-test/suite/encryption/t/innodb_encrypt_log.test
index 4b3d92e876c..ead00ba54b8 100644
--- a/mysql-test/suite/encryption/t/innodb_encrypt_log.test
+++ b/mysql-test/suite/encryption/t/innodb_encrypt_log.test
@@ -59,7 +59,7 @@ INSERT INTO t0
-- source include/search_pattern_in_file.inc
--echo # Restart without redo log encryption
--- let $restart_parameters=--skip-innodb-encrypt-log --innodb-log-files-in-group=1
+-- let $restart_parameters=--skip-innodb-encrypt-log
-- source include/start_mysqld.inc
SELECT COUNT(*) FROM t0;
diff --git a/mysql-test/suite/innodb/include/log_file_cleanup.inc b/mysql-test/suite/innodb/include/log_file_cleanup.inc
index ef57d58b788..80ce1df0c97 100644
--- a/mysql-test/suite/innodb/include/log_file_cleanup.inc
+++ b/mysql-test/suite/innodb/include/log_file_cleanup.inc
@@ -9,8 +9,6 @@
--copy_file $bugdir/bak_ibdata1 $bugdir/ibdata1
--copy_file $bugdir/bak_ibdata2 $bugdir/ibdata2
--copy_file $bugdir/bak_ib_logfile0 $bugdir/ib_logfile0
---copy_file $bugdir/bak_ib_logfile1 $bugdir/ib_logfile1
---copy_file $bugdir/bak_ib_logfile2 $bugdir/ib_logfile2
--copy_file $bugdir/bak_undo001 $bugdir/undo001
--copy_file $bugdir/bak_undo002 $bugdir/undo002
--copy_file $bugdir/bak_undo003 $bugdir/undo003
diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result
index 6655e118fe3..bf92f77d30c 100644
--- a/mysql-test/suite/innodb/r/log_corruption.result
+++ b/mysql-test/suite/innodb/r/log_corruption.result
@@ -53,13 +53,14 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files 2097152 bytes!/ in mysqld.1.err
+FOUND 1 /InnoDB: Upgrade after a crash is not supported\. The redo log was created with BogoDB 1\.2\.3\.4, and it appears corrupted\./ in mysqld.1.err
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
COUNT(*)
0
-FOUND 1 /InnoDB: Upgrade after a crash is not supported\. The redo log was created with BogoDB 1\.2\.3\.4, and it appears corrupted\./ in mysqld.1.err
+FOUND 2 /InnoDB: Upgrade after a crash is not supported\. The redo log was created with BogoDB 1\.2\.3\.4, and it appears corrupted\./ in mysqld.1.err
# Empty multi-file redo log from after MariaDB 10.2.2
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_corruption --innodb-force-recovery=5 --innodb-log-file-size=2m
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
diff --git a/mysql-test/suite/innodb/r/log_file.result b/mysql-test/suite/innodb/r/log_file.result
index afcc5dd47e9..83ca8f07b63 100644
--- a/mysql-test/suite/innodb/r/log_file.result
+++ b/mysql-test/suite/innodb/r/log_file.result
@@ -2,15 +2,15 @@
# Bug#16691130 - ASSERT WHEN INNODB_LOG_GROUP_HOME_DIR DOES NOT EXIST
# Bug#16418661 - CHANGING NAME IN FOR INNODB_DATA_FILE_PATH SHOULD NOT SUCCEED WITH LOG FILES
# Start mysqld without the possibility to create innodb_undo_tablespaces
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /\[ERROR\] InnoDB: Could not create undo tablespace '.*undo002'/ in mysqld.1.err
-# Remove undo001,undo002,ibdata1,ibdata2,ib_logfile1,ib_logfile2,ib_logfile101
+# Remove undo001,undo002,ibdata1,ibdata2,ib_logfile101
# Start mysqld with non existent innodb_log_group_home_dir
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend --innodb_log_group_home_dir=/path/to/non-existent/
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend --innodb_log_group_home_dir=/path/to/non-existent/
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
@@ -18,7 +18,7 @@ ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /File .path.to.non-existent.*ib_logfile101: 'create' returned OS error \d+/ in mysqld.1.err
# Remove ibdata1 & ibdata2
# Successfully let InnoDB create tablespaces
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES
WHERE engine='innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
@@ -26,15 +26,13 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
1
# Backup tmp/logfile/*
# 1. With ibdata2, Without ibdata1
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /The innodb_system data file 'ibdata1' was not found but one of the other data files 'ibdata2' exists/ in mysqld.1.err
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -42,14 +40,12 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata2
undo001
undo002
undo003
# 2. With ibdata1, without ibdata2
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
@@ -57,8 +53,6 @@ ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Tablespace size stored in header is \d+ pages, but the sum of data file sizes is \d+ pages/ in mysqld.1.err
FOUND 1 /InnoDB: Cannot start InnoDB. The tail of the system tablespace is missing/ in mysqld.1.err
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -66,8 +60,6 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata1
ibdata2
undo001
@@ -75,8 +67,6 @@ undo002
undo003
# 3. Without ibdata1 & ibdata2
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -84,20 +74,16 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
undo001
undo002
undo003
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: undo tablespace .*undo001.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\./ in mysqld.1.err
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -105,15 +91,11 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
undo001
undo002
undo003
# 4. Without ibdata*, ib_logfile* and with undo00*
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -123,14 +105,12 @@ ib_buffer_pool
undo001
undo002
undo003
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -142,8 +122,6 @@ undo002
undo003
# 5. Without ibdata*,ib_logfile* files & Without undo002
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -152,14 +130,12 @@ bak_undo003
ib_buffer_pool
undo001
undo003
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -170,8 +146,6 @@ undo001
undo003
# 6. Without ibdata*,ib_logfile* files & Without undo001, undo002
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -179,15 +153,13 @@ bak_undo002
bak_undo003
ib_buffer_pool
undo003
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /undo tablespace .*undo003.* exists\. Creating system tablespace with existing undo tablespaces is not supported\. Please delete all undo tablespaces before creating new system tablespace\./ in mysqld.1.err
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -197,8 +169,6 @@ ib_buffer_pool
undo003
# 7. With ibdata files & Without undo002
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -206,21 +176,17 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata1
ibdata2
undo001
undo003
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Expected to open innodb_undo_tablespaces=3 but was able to find only 1/ in mysqld.1.err
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -228,16 +194,12 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata1
ibdata2
undo001
undo003
# 8. With ibdata files & Without undo001, undo002
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -245,20 +207,16 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata1
ibdata2
undo003
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Expected to open innodb_undo_tablespaces=3 but was able to find only 0/ in mysqld.1.err
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -266,15 +224,11 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata1
ibdata2
undo003
-# 9. Without ibdata*, without undo*, Without ib_logfile1 and with ib_logfile2
+# 9. Without ibdata*, without undo*
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -282,17 +236,13 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile2
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
-InnoDB YES Supports transactions, row-level locking, foreign keys and encryption for tables YES YES YES
-NOT FOUND /redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log files is not recommended\. Please delete all redo log files before creating new system tablespace\./ in mysqld.1.err
+FOUND 1 /redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log file is not recommended\. Please delete redo log file before creating new system tablespace\./ in mysqld.1.err
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -300,23 +250,14 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
-ibdata1
-ibdata2
-undo001
-undo002
-undo003
# 10. With ibdata*, without ib_logfile0
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
InnoDB YES Supports transactions, row-level locking, foreign keys and encryption for tables YES YES YES
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -324,17 +265,13 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata1
ibdata2
undo001
undo002
undo003
-# 11. With ibdata*, without ib_logfile1
+# 11. With ibdata*
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -342,24 +279,21 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile2
ibdata1
ibdata2
undo001
undo002
undo003
-# restart: --innodb-log-files-in-group=3 --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
+# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-directory=MYSQLTEST_VARDIR/tmp/log_file --innodb-undo-logs=20 --innodb-undo-tablespaces=3 --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES
WHERE engine='innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
1
1
-FOUND 1 /Resizing redo log from 1\*\d+ to 3\*\d+ bytes; LSN=\d+/ in mysqld.1.err
+NOT FOUND /Resizing redo log from 1\*\d+ to 3\*\d+ bytes; LSN=\d+/ in mysqld.1.err
# restart
# Cleanup
bak_ib_logfile0
-bak_ib_logfile1
-bak_ib_logfile2
bak_ibdata1
bak_ibdata2
bak_undo001
@@ -367,8 +301,6 @@ bak_undo002
bak_undo003
ib_buffer_pool
ib_logfile0
-ib_logfile1
-ib_logfile2
ibdata1
ibdata2
undo001
diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result
index 4deef6f2785..102db617a64 100644
--- a/mysql-test/suite/innodb/r/log_file_name_debug.result
+++ b/mysql-test/suite/innodb/r/log_file_name_debug.result
@@ -5,14 +5,14 @@
SET GLOBAL DEBUG_DBUG='+d,fil_names_write_bogus';
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
# Kill the server
-# restart: --debug=d,innodb_log_abort_1 --innodb-log-files-in-group=2 --innodb-log-file-size=4M
+# restart: --debug=d,innodb_log_abort_1 --innodb-log-file-size=4194304
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: Tablespace 4294967280 was not found at .*, but there were no modifications either/ in mysqld.1.err
-# restart: --debug=d,innodb_log_abort_3,ib_log --innodb-log-files-in-group=2 --innodb-log-file-size=4M
+# restart: --debug=d,innodb_log_abort_3,ib_log --innodb-log-file-size=4194304
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 1 /srv_prepare_to_delete_redo_log_files: ib_log: FILE_CHECKPOINT.* written/ in mysqld.1.err
+FOUND 1 /srv_prepare_to_delete_redo_log_file: ib_log: FILE_CHECKPOINT.* written/ in mysqld.1.err
# restart
# restart
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/log_file_size.result b/mysql-test/suite/innodb/r/log_file_size.result
index 326e923ef12..3929747525e 100644
--- a/mysql-test/suite/innodb/r/log_file_size.result
+++ b/mysql-test/suite/innodb/r/log_file_size.result
@@ -1,12 +1,5 @@
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
# restart: --innodb-thread-concurrency=1 --innodb-log-file-size=2m
-SELECT * FROM INFORMATION_SCHEMA.ENGINES
-WHERE engine = 'innodb'
-AND support IN ('YES', 'DEFAULT', 'ENABLED');
-ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
-InnoDB YES Supports transactions, row-level locking, foreign keys and encryption for tables YES YES YES
-NOT FOUND /InnoDB: Log file .*ib_logfile1 is of different size .* bytes than other log files 0 bytes!/ in mysqld.1.err
-# restart: --innodb-thread-concurrency=1 --innodb-log-file-size=2m
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -19,7 +12,7 @@ a
INSERT INTO t1 VALUES (42);
BEGIN;
DELETE FROM t1;
-# restart: --innodb-log-files-in-group=3 --innodb-log-file-size=5M
+# restart: --innodb-log-file-size=5M
SELECT * FROM t1;
a
42
@@ -52,11 +45,11 @@ FOUND 1 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
# restart: --debug=d,innodb_log_abort_4
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 2 /redo log from 3\*[0-9]+ to 1\*[0-9]+ bytes/ in mysqld.1.err
+FOUND 5 /redo log from [0-9]+ to [0-9]+ bytes/ in mysqld.1.err
# restart: --debug=d,innodb_log_abort_5
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 3 /redo log from 3\*[0-9]+ to 1\*[0-9]+ bytes/ in mysqld.1.err
+FOUND 6 /redo log from [0-9]+ to [0-9]+ bytes/ in mysqld.1.err
# restart: --innodb-read-only
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
@@ -64,14 +57,14 @@ FOUND 2 /InnoDB: innodb_read_only prevents crash recovery/ in mysqld.1.err
# restart: --debug=d,innodb_log_abort_6
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 4 /redo log from 3\*[0-9]+ to 1\*[0-9]+ bytes/ in mysqld.1.err
+FOUND 7 /redo log from [0-9]+ to [0-9]+ bytes/ in mysqld.1.err
# restart: --debug=d,innodb_log_abort_7
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
# restart: --innodb-read-only
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 1 /InnoDB: Cannot create log files in read-only mode/ in mysqld.1.err
+FOUND 1 /InnoDB: Cannot create log file in read-only mode/ in mysqld.1.err
# restart: --debug=d,innodb_log_abort_8
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
@@ -86,8 +79,9 @@ ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of 512 bytes/ in mysqld.1.err
# restart: --debug=d,innodb_log_abort_9
SELECT * FROM t1;
-ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 1 /InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files/ in mysqld.1.err
+a
+42
+123
# restart: --debug=d,innodb_log_abort_10
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test
index 3bcc5d835e5..1a36dbef337 100644
--- a/mysql-test/suite/innodb/t/doublewrite.test
+++ b/mysql-test/suite/innodb/t/doublewrite.test
@@ -445,7 +445,7 @@ WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
--let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir
---let $ibd=$ibp --innodb-undo-tablespaces=0 --innodb-log-files-in-group=2
+--let $ibd=$ibp --innodb-undo-tablespaces=0
--let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
--let $restart_parameters= $ibp
diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test
index 80fc1f2d804..01b3da3f7ac 100644
--- a/mysql-test/suite/innodb/t/log_corruption.test
+++ b/mysql-test/suite/innodb/t/log_corruption.test
@@ -16,7 +16,7 @@ call mtr.add_suppression("InnoDB: Log scan aborted at LSN");
call mtr.add_suppression("InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42\\r?$");
call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 failed");
call mtr.add_suppression("InnoDB: Decrypting checkpoint failed");
-call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfiles to start up the database\\? Log sequence number in the ib_logfiles is 1213964,");
+call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfile0 to start up the database\\? Log sequence number in the ib_logfile0 is 1213964,");
call mtr.add_suppression("InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files 2097152 bytes!");
--enable_query_log
@@ -246,6 +246,8 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
--source include/shutdown_mysqld.inc
--let SEARCH_PATTERN=InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files 2097152 bytes!
--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported\\. The redo log was created with BogoDB 1\\.2\\.3\\.4, and it appears corrupted\\.
+--source include/search_pattern_in_file.inc
perl;
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1";
diff --git a/mysql-test/suite/innodb/t/log_file.test b/mysql-test/suite/innodb/t/log_file.test
index 5c2f44303da..76fb013fb8b 100644
--- a/mysql-test/suite/innodb/t/log_file.test
+++ b/mysql-test/suite/innodb/t/log_file.test
@@ -34,7 +34,7 @@ let $check_yes_innodb=SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES
WHERE engine='innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
---let $ibp=--innodb-log-files-in-group=3 --innodb-log-group-home-dir=$bugdir
+--let $ibp=--innodb-log-group-home-dir=$bugdir
--let $ibp=$ibp --innodb-data-home-dir=$bugdir --innodb-undo-directory=$bugdir
--let $ibp=$ibp --innodb-undo-logs=20 --innodb-undo-tablespaces=3
--let $ibp=$ibp --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend
@@ -49,13 +49,11 @@ eval $check_no_innodb;
let SEARCH_PATTERN=\[ERROR\] InnoDB: Could not create undo tablespace '.*undo002';
--source include/search_pattern_in_file.inc
---echo # Remove undo001,undo002,ibdata1,ibdata2,ib_logfile1,ib_logfile2,ib_logfile101
+--echo # Remove undo001,undo002,ibdata1,ibdata2,ib_logfile101
--remove_file $bugdir/undo001
--rmdir $bugdir/undo002
--remove_file $bugdir/ibdata1
--remove_file $bugdir/ibdata2
---remove_file $bugdir/ib_logfile1
---remove_file $bugdir/ib_logfile2
--remove_file $bugdir/ib_logfile101
--list_files $bugdir
@@ -82,8 +80,6 @@ eval $check_yes_innodb;
--copy_file $bugdir/ibdata1 $bugdir/bak_ibdata1
--copy_file $bugdir/ibdata2 $bugdir/bak_ibdata2
--copy_file $bugdir/ib_logfile0 $bugdir/bak_ib_logfile0
---copy_file $bugdir/ib_logfile1 $bugdir/bak_ib_logfile1
---copy_file $bugdir/ib_logfile2 $bugdir/bak_ib_logfile2
--copy_file $bugdir/undo001 $bugdir/bak_undo001
--copy_file $bugdir/undo002 $bugdir/bak_undo002
--copy_file $bugdir/undo003 $bugdir/bak_undo003
@@ -189,15 +185,14 @@ let SEARCH_PATTERN=InnoDB: Expected to open innodb_undo_tablespaces=3 but was ab
# clean up & Restore
--source ../include/log_file_cleanup.inc
---echo # 9. Without ibdata*, without undo*, Without ib_logfile1 and with ib_logfile2
+--echo # 9. Without ibdata*, without undo*
--remove_files_wildcard $bugdir ibdata*
--remove_files_wildcard $bugdir undo00*
---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=redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log files is not recommended\. Please delete all redo log files before creating new system tablespace\.;
+let SEARCH_PATTERN=redo log file .*ib_logfile0.* exists\. Creating system tablespace with existing redo log file is not recommended\. Please delete redo log file before creating new system tablespace\.;
--source include/search_pattern_in_file.inc
# clean up & Restore
@@ -212,8 +207,7 @@ eval $check_no_innodb;
--source ../include/log_file_cleanup.inc
---echo # 11. With ibdata*, without ib_logfile1
---remove_file $bugdir/ib_logfile1
+--echo # 11. With ibdata*
--list_files $bugdir
--source include/start_mysqld.inc
eval $check_yes_innodb;
diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test
index fac1a72fe45..8b56ccaa55f 100644
--- a/mysql-test/suite/innodb/t/log_file_name_debug.test
+++ b/mysql-test/suite/innodb/t/log_file_name_debug.test
@@ -16,8 +16,8 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile
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
+--let $change=`SELECT if(@@innodb_log_file_size = 4194304, 8388608, 4194304)`
+--let $resize= --innodb-log-file-size=$change
--source include/no_checkpoint_start.inc
@@ -39,7 +39,7 @@ SELECT * FROM t1;
--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: FILE_CHECKPOINT.* written
+--let SEARCH_PATTERN= srv_prepare_to_delete_redo_log_file: ib_log: FILE_CHECKPOINT.* written
--source include/search_pattern_in_file.inc
--let $restart_parameters=
diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test
index b54198ad388..4c0d377a826 100644
--- a/mysql-test/suite/innodb/t/log_file_size.test
+++ b/mysql-test/suite/innodb/t/log_file_size.test
@@ -12,17 +12,16 @@ if (`SELECT @@innodb_log_file_size = 1048576`) {
}
--disable_query_log
-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("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata file do not match the log sequence number [0-9]+ in the ib_logfile");
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|resize) log files in read-only mode");
+call mtr.add_suppression("InnoDB: Are you sure you are using the right ib_logfile");
+call mtr.add_suppression("InnoDB: Cannot (create|resize) log file in read-only mode");
call mtr.add_suppression("InnoDB: Can't initiate database recovery, running 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: Log file .*ib_logfile0.* size");
call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native AIO read support");
FLUSH TABLES;
--enable_query_log
@@ -40,14 +39,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
--let $restart_parameters= --innodb-thread-concurrency=1 --innodb-log-file-size=2m
--source include/start_mysqld.inc
-eval $check_no_innodb;
---remove_file $MYSQLD_DATADIR/ib_logfile0
---move_file $MYSQLD_DATADIR/ib_logfile.old $MYSQLD_DATADIR/ib_logfile.0
---source include/shutdown_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
-let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile1 is of different size .* bytes than other log files 0 bytes!;
---source include/search_pattern_in_file.inc
---source include/start_mysqld.inc
CHECK TABLE t1;
--let $restart_parameters= --innodb-thread-concurrency=100 --innodb-log-file-size=20M
@@ -66,7 +58,7 @@ INSERT INTO t1 VALUES (42);
BEGIN;
DELETE FROM t1;
-let $restart_parameters = --innodb-log-files-in-group=3 --innodb-log-file-size=5M;
+let $restart_parameters = --innodb-log-file-size=5M;
--source include/restart_mysqld.inc
let $shutdown_timeout=;
@@ -120,14 +112,14 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
-let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 1\*[0-9]+ bytes;
+let SEARCH_PATTERN= redo log from [0-9]+ to [0-9]+ bytes;
--source include/search_pattern_in_file.inc
--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= redo log from 3\*[0-9]+ to 1\*[0-9]+ bytes;
+let SEARCH_PATTERN= redo log from [0-9]+ to [0-9]+ bytes;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --innodb-read-only
@@ -142,7 +134,7 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery;
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
-let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 1\*[0-9]+ bytes;
+let SEARCH_PATTERN= redo log from [0-9]+ to [0-9]+ bytes;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --debug=d,innodb_log_abort_7
@@ -157,7 +149,7 @@ SELECT * FROM t1;
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
-let SEARCH_PATTERN= InnoDB: Cannot create log files in read-only mode;
+let SEARCH_PATTERN= InnoDB: Cannot create log file in read-only mode;
--source include/search_pattern_in_file.inc
--let $restart_parameters= --debug=d,innodb_log_abort_8
@@ -201,11 +193,8 @@ close(FILE);
EOF
--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 $MYSQLD_DATADIR/ib_logfile1
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
diff --git a/mysql-test/suite/mariabackup/huge_lsn.result b/mysql-test/suite/mariabackup/huge_lsn.result
index 82d743bbad4..e109fba6748 100644
--- a/mysql-test/suite/mariabackup/huge_lsn.result
+++ b/mysql-test/suite/mariabackup/huge_lsn.result
@@ -2,7 +2,7 @@
# MDEV-13416 mariabackup fails with EFAULT "Bad Address"
#
# restart
-FOUND 1 /InnoDB: New log files created, LSN=175964\d{8}/ in mysqld.1.err
+FOUND 1 /InnoDB: New log file created, LSN=175964\d{8}/ in mysqld.1.err
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
# xtrabackup backup
diff --git a/mysql-test/suite/mariabackup/huge_lsn.test b/mysql-test/suite/mariabackup/huge_lsn.test
index d41bb61a096..27d40f577ad 100644
--- a/mysql-test/suite/mariabackup/huge_lsn.test
+++ b/mysql-test/suite/mariabackup/huge_lsn.test
@@ -35,7 +35,7 @@ EOF
--source include/start_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
---let SEARCH_PATTERN= InnoDB: New log files created, LSN=175964\d{8}
+--let SEARCH_PATTERN= InnoDB: New log file created, LSN=175964\d{8}
--source include/search_pattern_in_file.inc
CREATE TABLE t(i INT) ENGINE INNODB;
diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
index 7111d384b40..95b88d038ee 100644
--- a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
+++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
@@ -1 +1 @@
---loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2
+--loose-innodb-log-file-size=2097152
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index d1b1fccc1b8..dcdafc8196d 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -1226,7 +1226,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE 1
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.
+VARIABLE_COMMENT Deprecated parameter with no effect.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 100
NUMERIC_BLOCK_SIZE 0
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 5b42501d45d..a36cc87a201 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -195,11 +195,6 @@ static char* innobase_reset_all_monitor_counter;
static ulong innodb_flush_method;
-/** Deprecated; no effect other than issuing a deprecation warning. */
-static char* innodb_file_format;
-/** Deprecated; no effect other than issuing a deprecation warning. */
-static char* innodb_large_prefix;
-
/* This variable can be set in the server configure file, specifying
stopword table to be used */
static char* innobase_server_stopword_table;
@@ -3417,33 +3412,42 @@ static void innodb_buffer_pool_size_init()
innobase_buffer_pool_size = srv_buf_pool_size;
}
+namespace deprecated {
+/** Deprecated; no effect other than issuing a deprecation warning. */
+char* innodb_file_format;
+/** Deprecated; no effect other than issuing a deprecation warning. */
+char* innodb_large_prefix;
+
/** Deprecated parameter with no effect */
static my_bool innodb_log_checksums;
/** Deprecation message for innodb_log_checksums */
-static const char* innodb_log_checksums_deprecated
+static const char* innodb_log_checksums_msg
= "The parameter innodb_log_checksums is deprecated and has no effect.";
/** Deprecated parameter with no effect */
static my_bool innodb_log_compressed_pages;
/** Deprecation message for innodb_log_compressed_pages */
-static const char* innodb_log_compressed_pages_deprecated
+static const char* innodb_log_compressed_pages_msg
= "The parameter innodb_log_compressed_pages is deprecated and has no effect.";
/** Deprecated parameter with no effect */
static my_bool innodb_log_optimize_ddl;
-static const char* innodb_log_optimize_ddl_deprecated
+static const char* innodb_log_optimize_ddl_msg
= "The parameter innodb_log_optimize_ddl is deprecated and has no effect.";
/** Deprecated parameter with no effect */
static ulong innodb_undo_logs;
/** Deprecation message for innodb_undo_logs */
-static const char* innodb_undo_logs_deprecated
+static const char* innodb_undo_logs_msg
= "The parameter innodb_undo_logs is deprecated and has no effect.";
/** Deprecated parameter with no effect */
static ulong innodb_buffer_pool_instances;
/** Deprecated parameter with no effect */
static ulong innodb_page_cleaners;
-static const char* innodb_page_cleaners_deprecated
+static const char* innodb_page_cleaners_msg
= "The parameter innodb_page_cleaners is deprecated and has no effect.";
+ulong srv_n_log_files;
+} // namespace deprecated
+
/** Initialize, validate and normalize the InnoDB startup parameters.
@return failure code
@retval 0 on success
@@ -3457,8 +3461,8 @@ static int innodb_init_params()
char *default_path;
ulong num_pll_degree;
- if (innodb_large_prefix || innodb_file_format) {
- const char* p = innodb_file_format
+ if (deprecated::innodb_large_prefix || deprecated::innodb_file_format) {
+ const char* p = deprecated::innodb_file_format
? "file_format"
: "large_prefix";
sql_print_warning("The parameter innodb_%s is deprecated"
@@ -3742,37 +3746,37 @@ static int innodb_init_params()
srv_buf_pool_size = ulint(innobase_buffer_pool_size);
- if (UNIV_UNLIKELY(!innodb_log_checksums)) {
- sql_print_warning(innodb_log_checksums_deprecated);
- innodb_log_checksums = TRUE;
+ if (UNIV_UNLIKELY(!deprecated::innodb_log_checksums)) {
+ sql_print_warning(deprecated::innodb_log_checksums_msg);
+ deprecated::innodb_log_checksums = TRUE;
}
- if (UNIV_UNLIKELY(!innodb_log_compressed_pages)) {
- sql_print_warning(innodb_log_compressed_pages_deprecated);
- innodb_log_compressed_pages = TRUE;
+ if (UNIV_UNLIKELY(!deprecated::innodb_log_compressed_pages)) {
+ sql_print_warning(deprecated::innodb_log_compressed_pages_msg);
+ deprecated::innodb_log_compressed_pages = TRUE;
}
- if (UNIV_UNLIKELY(innodb_log_optimize_ddl)) {
- sql_print_warning(innodb_log_optimize_ddl_deprecated);
- innodb_log_optimize_ddl = FALSE;
+ if (UNIV_UNLIKELY(deprecated::innodb_log_optimize_ddl)) {
+ sql_print_warning(deprecated::innodb_log_optimize_ddl_msg);
+ deprecated::innodb_log_optimize_ddl = FALSE;
}
- if (UNIV_UNLIKELY(innodb_buffer_pool_instances)) {
+ if (UNIV_UNLIKELY(deprecated::innodb_buffer_pool_instances)) {
sql_print_warning("The parameter innodb_buffer_pool_instances"
" is deprecated and has no effect.");
}
- if (UNIV_UNLIKELY(innodb_page_cleaners)) {
- sql_print_warning(innodb_page_cleaners_deprecated);
+ if (UNIV_UNLIKELY(deprecated::innodb_page_cleaners)) {
+ sql_print_warning(deprecated::innodb_page_cleaners_msg);
}
- innodb_buffer_pool_instances = 1;
+ deprecated::innodb_buffer_pool_instances = 1;
- innodb_page_cleaners = 1;
+ deprecated::innodb_page_cleaners = 1;
- if (UNIV_UNLIKELY(innodb_undo_logs != TRX_SYS_N_RSEGS)) {
- sql_print_warning(innodb_undo_logs_deprecated);
- innodb_undo_logs = TRX_SYS_N_RSEGS;
+ if (UNIV_UNLIKELY(deprecated::innodb_undo_logs != TRX_SYS_N_RSEGS)) {
+ sql_print_warning(deprecated::innodb_undo_logs_msg);
+ deprecated::innodb_undo_logs = TRX_SYS_N_RSEGS;
}
row_rollback_on_timeout = (ibool) innobase_rollback_on_timeout;
@@ -18860,7 +18864,7 @@ innodb_log_checksums_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
- innodb_log_checksums_deprecated);
+ deprecated::innodb_log_checksums_msg);
}
/** Issue a deprecation warning for SET GLOBAL innodb_log_compressed_pages.
@@ -18871,7 +18875,7 @@ innodb_log_compressed_pages_warn(THD* thd, st_mysql_sys_var*, void*,
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
- innodb_log_compressed_pages_deprecated);
+ deprecated::innodb_log_compressed_pages_msg);
}
/** Issue a deprecation warning for SET GLOBAL innodb_log_optimize_ddl.
@@ -18881,7 +18885,7 @@ innodb_log_optimize_ddl_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
- innodb_log_optimize_ddl_deprecated);
+ deprecated::innodb_log_optimize_ddl_msg);
}
/** Issue a deprecation warning for SET GLOBAL innodb_page_cleaners.
@@ -18891,7 +18895,7 @@ innodb_page_cleaners_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
- innodb_page_cleaners_deprecated);
+ deprecated::innodb_page_cleaners_msg);
}
/** Issue a deprecation warning for SET GLOBAL innodb_undo_logs.
@@ -18901,7 +18905,7 @@ innodb_undo_logs_warn(THD* thd, st_mysql_sys_var*, void*, const void*)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
- innodb_undo_logs_deprecated);
+ deprecated::innodb_undo_logs_msg);
}
static SHOW_VAR innodb_status_variables_export[]= {
@@ -19102,7 +19106,7 @@ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
static const char* innodb_deprecated_ignored
= "Deprecated parameter with no effect.";
-static MYSQL_SYSVAR_BOOL(log_checksums, innodb_log_checksums,
+static MYSQL_SYSVAR_BOOL(log_checksums, deprecated::innodb_log_checksums,
PLUGIN_VAR_RQCMDARG,
innodb_deprecated_ignored, NULL, innodb_log_checksums_warn, TRUE);
@@ -19246,10 +19250,10 @@ static MYSQL_SYSVAR_ENUM(flush_method, innodb_flush_method,
NULL, NULL, IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_FSYNC),
&innodb_flush_method_typelib);
-static MYSQL_SYSVAR_STR(file_format, innodb_file_format,
+static MYSQL_SYSVAR_STR(file_format, deprecated::innodb_file_format,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
innodb_deprecated_ignored, NULL, NULL, NULL);
-static MYSQL_SYSVAR_STR(large_prefix, innodb_large_prefix,
+static MYSQL_SYSVAR_STR(large_prefix, deprecated::innodb_large_prefix,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
innodb_deprecated_ignored, NULL, NULL, NULL);
@@ -19262,7 +19266,7 @@ static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to InnoDB log files.", NULL, NULL, NULL);
-static MYSQL_SYSVAR_ULONG(page_cleaners, innodb_page_cleaners,
+static MYSQL_SYSVAR_ULONG(page_cleaners, deprecated::innodb_page_cleaners,
PLUGIN_VAR_RQCMDARG,
innodb_deprecated_ignored, NULL, innodb_page_cleaners_warn, 0, 0, 64, 0);
@@ -19393,11 +19397,12 @@ static MYSQL_SYSVAR_UINT(compression_level, page_zip_level,
", 1 is fastest, 9 is best compression and default is 6.",
NULL, NULL, DEFAULT_COMPRESSION_LEVEL, 0, 9, 0);
-static MYSQL_SYSVAR_BOOL(log_compressed_pages, innodb_log_compressed_pages,
+static MYSQL_SYSVAR_BOOL(log_compressed_pages,
+ deprecated::innodb_log_compressed_pages,
PLUGIN_VAR_OPCMDARG,
innodb_deprecated_ignored, NULL, innodb_log_compressed_pages_warn, TRUE);
-static MYSQL_SYSVAR_BOOL(log_optimize_ddl, innodb_log_optimize_ddl,
+static MYSQL_SYSVAR_BOOL(log_optimize_ddl, deprecated::innodb_log_optimize_ddl,
PLUGIN_VAR_OPCMDARG,
innodb_deprecated_ignored, NULL, innodb_log_optimize_ddl_warn, FALSE);
@@ -19464,7 +19469,8 @@ static MYSQL_SYSVAR_ENUM(lock_schedule_algorithm, innodb_lock_schedule_algorithm
NULL, NULL, INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS,
&innodb_lock_schedule_algorithm_typelib);
-static MYSQL_SYSVAR_ULONG(buffer_pool_instances, innodb_buffer_pool_instances,
+static MYSQL_SYSVAR_ULONG(buffer_pool_instances,
+ deprecated::innodb_buffer_pool_instances,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
innodb_deprecated_ignored, NULL, NULL, 0, 0, 64, 0);
@@ -19705,10 +19711,9 @@ static MYSQL_SYSVAR_ULONGLONG(log_file_size, srv_log_file_size,
/* OS_FILE_LOG_BLOCK_SIZE would be more appropriate than UNIV_PAGE_SIZE_MAX,
but fil_space_t is being used for the redo log, and it uses data pages. */
-static MYSQL_SYSVAR_ULONG(log_files_in_group, srv_n_log_files,
+static MYSQL_SYSVAR_ULONG(log_files_in_group, deprecated::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, 1, 1, SRV_N_LOG_FILES_MAX, 0);
+ innodb_deprecated_ignored, NULL, NULL, 1, 1, 100, 0);
static MYSQL_SYSVAR_ULONG(log_write_ahead_size, srv_log_write_ahead_size,
PLUGIN_VAR_RQCMDARG,
@@ -19796,7 +19801,7 @@ static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces,
0L, /* Minimum value */
TRX_SYS_MAX_UNDO_SPACES, 0); /* Maximum value */
-static MYSQL_SYSVAR_ULONG(undo_logs, innodb_undo_logs,
+static MYSQL_SYSVAR_ULONG(undo_logs, deprecated::innodb_undo_logs,
PLUGIN_VAR_OPCMDARG,
innodb_deprecated_ignored, NULL, innodb_undo_logs_warn,
TRX_SYS_N_RSEGS, 0, TRX_SYS_N_RSEGS, 0);
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 5f5f3204a87..b57ad5cc1f5 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -863,8 +863,7 @@ fil_space_get(
MY_ATTRIBUTE((warn_unused_result));
/** The tablespace memory cache; also the totality of logs (the log
-data space) is stored here; below we talk about tablespaces, but also
-the ib_logfiles form a 'space' and it is handled here */
+data space) is stored here; below we talk about tablespaces */
struct fil_system_t {
/**
Constructor.
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
index bb55a4dab81..c2348e121a3 100644
--- a/storage/innobase/include/log0log.h
+++ b/storage/innobase/include/log0log.h
@@ -43,13 +43,10 @@ Created 12/9/1995 Heikki Tuuri
using st_::span;
-/** Maximum number of srv_n_log_files, or innodb_log_files_in_group */
-#define SRV_N_LOG_FILES_MAX 100
-
/** Magic value to use instead of log checksums when they are disabled */
#define LOG_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
-/* Margin for the free space in the smallest log group, before a new query
+/* Margin for the free space in the smallest log, before a new query
step which modifies the database, is started */
#define LOG_CHECKPOINT_FREE_PER_THREAD (4U << srv_page_size_shift)
@@ -57,6 +54,25 @@ step which modifies the database, is started */
typedef ulint (*log_checksum_func_t)(const byte* log_block);
+static const char LOG_FILE_NAME_PREFIX[] = "ib_logfile";
+static const char LOG_FILE_NAME[] = "ib_logfile0";
+
+/** Composes full path for a redo log file
+@param[in] filename name of the redo log file
+@return path with log file name*/
+std::string get_log_file_path(const char *filename= LOG_FILE_NAME);
+
+/** Returns paths for all existing log files */
+std::vector<std::string> get_existing_log_files_paths();
+
+/** Delete log file.
+@param[in] suffix suffix of the file name */
+static inline void delete_log_file(const char* suffix)
+{
+ auto path = get_log_file_path(LOG_FILE_NAME_PREFIX).append(suffix);
+ os_file_delete_if_exists(innodb_log_file_key, path.c_str(), nullptr);
+}
+
/** Append a string to the log.
@param[in] str string
@param[in] len string length
@@ -83,7 +99,7 @@ log_free_check(void);
void log_buffer_extend(ulong len);
/** Check margin not to overwrite transaction log from the last checkpoint.
-If would estimate the log write to exceed the log_group_capacity,
+If would estimate the log write to exceed the log_capacity,
waits for the checkpoint is done enough.
@param[in] len length of the data to be written */
@@ -132,14 +148,7 @@ UNIV_INLINE
ib_uint64_t
log_get_flush_lsn(void);
/*=============*/
-/****************************************************************
-Gets the log group capacity. It is OK to read the value without
-holding log_sys.mutex because it is constant.
-@return log group capacity */
-UNIV_INLINE
-lsn_t
-log_get_capacity(void);
-/*==================*/
+
/****************************************************************
Get log_sys::max_modified_age_async. It is OK to read the value without
holding log_sys::mutex because it is constant.
@@ -153,7 +162,7 @@ log_get_max_modified_age_async(void);
and lsn - buf_get_oldest_modification().
@param[in] file_size requested innodb_log_file_size
@retval true on success
-@retval false if the smallest log group is too small to
+@retval false if the smallest log is too small to
accommodate the number of OS threads in the database server */
bool
log_set_capacity(ulonglong file_size)
@@ -187,7 +196,7 @@ log_buffer_sync_in_background(
/** Make a checkpoint. Note that this function does not flush dirty
blocks from the buffer pool: it only checks what is lsn of the oldest
modification in the pool, and writes information about the lsn in
-log files. Use log_make_checkpoint() to flush also the pool.
+log file. Use log_make_checkpoint() to flush also the pool.
@return true if success, false if a checkpoint write was already running */
bool log_checkpoint();
@@ -198,7 +207,7 @@ void log_make_checkpoint();
Makes a checkpoint at the latest lsn and writes it to first page of each
data file in the database, so that we know that the file spaces contain
all modifications up to that lsn. This can only be called at database
-shutdown. This function also writes all log in log files to the log archive. */
+shutdown. This function also writes all log in log file to the log archive. */
void
logs_empty_and_mark_files_at_shutdown(void);
/*=======================================*/
@@ -414,7 +423,7 @@ because InnoDB never supported more than one copy of the redo log. */
LOG_FILE_START_LSN started here, 4 bytes earlier than LOG_HEADER_START_LSN,
which the LOG_FILE_START_LSN was renamed to.
Subformat 1 is for the fully redo-logged TRUNCATE
-(no MLOG_TRUNCATE records or extra log checkpoints or log files) */
+(no MLOG_TRUNCATE records or extra log checkpoints or log file) */
#define LOG_HEADER_SUBFORMAT 4
/** LSN of the start of data in this log file (with format version 1;
in format version 0, it was called LOG_FILE_START_LSN and at offset 4). */
@@ -439,7 +448,7 @@ or the MySQL version that created the redo log file. */
header; we write alternately to the
checkpoint fields when we make new
checkpoints; this field is only defined
- in the first log file of a log group */
+ in the first log file of a log */
#define LOG_CHECKPOINT_2 (3 * OS_FILE_LOG_BLOCK_SIZE)
/* second checkpoint field in the log
header */
@@ -603,10 +612,8 @@ struct log_t{
peeked at by log_free_check(), which
does not reserve the log mutex */
- /** Log files. Protected by mutex or write_mutex. */
- struct files {
- /** number of files */
- ulint n_files;
+ /** Log file stuff. Protected by mutex or write_mutex. */
+ struct file {
/** format of the redo log: e.g., FORMAT_10_5 */
uint32_t format;
/** redo log subformat: 0 with separately logged TRUNCATE,
@@ -619,31 +626,32 @@ struct log_t{
lsn_t lsn;
/** the byte offset of the above lsn */
lsn_t lsn_offset;
+ /** log file */
+ log_file_t fd;
public:
/** used only in recovery: recovery scan succeeded up to this
lsn in this log group */
lsn_t scanned_lsn;
- /** file descriptors for all log files */
- std::vector<log_file_t> files;
-
- /** opens log files which must be closed prior this call */
- void open_files(std::vector<std::string> paths);
- /** reads buffer from log files
- @param[in] total_offset offset in log files treated as a single file
+ /** opens log file which must be closed prior this call */
+ void open_file(std::string path);
+ /** opens log file which must be closed prior this call */
+ dberr_t rename(std::string path) { return fd.rename(path); }
+ /** reads buffer from log file
+ @param[in] offset offset in log file
@param[in] buf buffer where to read */
- void read(os_offset_t total_offset, span<byte> buf);
+ void read(os_offset_t offset, span<byte> buf);
/** Tells whether writes require calling flush_data_only() */
bool writes_are_durable() const noexcept;
- /** writes buffer to log files
- @param[in] total_offset offset in log files treated as a single file
+ /** writes buffer to log file
+ @param[in] offset offset in log file
@param[in] buf buffer from which to write */
- void write(os_offset_t total_offset, span<byte> buf);
- /** flushes OS page cache (excluding metadata!) for all log files */
+ void write(os_offset_t offset, span<byte> buf);
+ /** flushes OS page cache (excluding metadata!) for log file */
void flush_data_only();
- /** closes all log files */
- void close_files();
+ /** closes log file */
+ void close_file();
/** @return whether the redo log is encrypted */
bool is_encrypted() const { return format & FORMAT_ENCRYPTED; }
@@ -651,11 +659,12 @@ struct log_t{
bool is_physical() const
{ return (format & ~FORMAT_ENCRYPTED) == FORMAT_10_5; }
/** @return capacity in bytes */
- lsn_t capacity() const{ return (file_size - LOG_FILE_HDR_SIZE) * n_files; }
+ lsn_t capacity() const{ return file_size - LOG_FILE_HDR_SIZE; }
/** Calculate the offset of a log sequence number.
@param[in] lsn log sequence number
@return offset within the log */
inline lsn_t calc_lsn_offset(lsn_t lsn) const;
+ lsn_t calc_lsn_offset_old(lsn_t lsn) const;
/** Set the field values to correspond to a given lsn. */
void set_fields(lsn_t lsn)
@@ -672,16 +681,11 @@ struct log_t{
@return whether no invalid blocks (e.g checksum mismatch) were found */
bool read_log_seg(lsn_t* start_lsn, lsn_t end_lsn);
- /** Initialize the redo log buffer.
- @param[in] n_files number of files */
- void create(ulint n_files);
+ /** Initialize the redo log buffer. */
+ void create();
/** Close the redo log buffer. */
- void close()
- {
- n_files = 0;
- close_files();
- }
+ void close() { close_file(); }
void set_lsn(lsn_t a_lsn);
lsn_t get_lsn() const { return lsn; }
void set_lsn_offset(lsn_t a_lsn);
@@ -721,7 +725,7 @@ struct log_t{
/* @} */
/** Fields involved in checkpoints @{ */
- lsn_t log_group_capacity; /*!< capacity of the log group; if
+ lsn_t log_capacity; /*!< capacity of the log; if
the checkpoint age exceeds this, it is
a serious error because it is possible
we will then overwrite log and spoil
@@ -830,33 +834,38 @@ public:
/** Redo log system */
extern log_t log_sys;
+/** Gets the log capacity. It is OK to read the value without
+holding log_sys.mutex because it is constant.
+@return log capacity */
+inline lsn_t log_get_capacity(void) { return log_sys.log_capacity; }
+
/** Calculate the offset of a log sequence number.
@param[in] lsn log sequence number
@return offset within the log */
-inline lsn_t log_t::files::calc_lsn_offset(lsn_t lsn) const
+inline lsn_t log_t::file::calc_lsn_offset(lsn_t lsn) const
{
ut_ad(this == &log_sys.log);
/* The lsn parameters are updated while holding both the mutexes
and it is ok to have either of them while reading */
ut_ad(log_sys.mutex.is_owned() || log_sys.write_mutex.is_owned());
- const lsn_t group_size= capacity();
+ const lsn_t size = capacity();
lsn_t l= lsn - this->lsn;
if (longlong(l) < 0) {
- l= lsn_t(-longlong(l)) % group_size;
- l= group_size - l;
+ l = lsn_t(-longlong(l)) % size;
+ l = size - l;
}
l+= lsn_offset - LOG_FILE_HDR_SIZE * (1 + lsn_offset / file_size);
- l%= group_size;
+ l %= size;
return l + LOG_FILE_HDR_SIZE * (1 + l / (file_size - LOG_FILE_HDR_SIZE));
}
-inline void log_t::files::set_lsn(lsn_t a_lsn) {
+inline void log_t::file::set_lsn(lsn_t a_lsn) {
ut_ad(log_sys.mutex.is_owned() || log_sys.write_mutex.is_owned());
lsn = a_lsn;
}
-inline void log_t::files::set_lsn_offset(lsn_t a_lsn) {
+inline void log_t::file::set_lsn_offset(lsn_t a_lsn) {
ut_ad(log_sys.mutex.is_owned() || log_sys.write_mutex.is_owned());
ut_ad((lsn % OS_FILE_LOG_BLOCK_SIZE) == (a_lsn % OS_FILE_LOG_BLOCK_SIZE));
lsn_offset = a_lsn;
diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic
index 3f9039cd2b6..5c765ca618e 100644
--- a/storage/innobase/include/log0log.ic
+++ b/storage/innobase/include/log0log.ic
@@ -376,18 +376,6 @@ log_get_lsn_nowait(void)
}
/****************************************************************
-Gets the log group capacity. It is OK to read the value without
-holding log_sys.mutex because it is constant.
-@return log group capacity */
-UNIV_INLINE
-lsn_t
-log_get_capacity(void)
-/*==================*/
-{
- return(log_sys.log_group_capacity);
-}
-
-/****************************************************************
Get log_sys::max_modified_age_async. It is OK to read the value without
holding log_sys::mutex because it is constant.
@return max_modified_age_async */
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index a05f1f5352d..1e6a031d15f 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -296,7 +296,21 @@ struct recv_sys_t{
/** Last added LSN to pages. */
lsn_t last_stored_lsn;
+ /** After successful upgrade from multiple redo log files we'd like
+ to remove extra ones */
+ bool remove_extra_log_files{false};
+
+ void read(os_offset_t offset, span<byte> buf);
+ size_t files_size();
+ void close_files() { files.clear(); }
+
private:
+ /** All found log files (more that one is possible if we're upgrading
+ from older MariaDB version */
+ std::vector<log_file_t> files;
+
+ void open_log_files_if_needed();
+
/** Maximum number of buffer pool blocks to allocate for redo log records */
ulint max_log_blocks;
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 9096aa92a82..0ebd71b2bf5 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -327,7 +327,6 @@ constexpr ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES= (10U << 20) /
extern char* srv_log_group_home_dir;
-extern ulong srv_n_log_files;
/** The InnoDB redo log file size, or 0 when changing the redo log format
at startup (while disallowing writes to the redo log). */
extern ulonglong srv_log_file_size;
@@ -511,8 +510,8 @@ extern my_bool srv_purge_view_update_only_debug;
extern my_bool srv_master_thread_disabled_debug;
/** InnoDB system tablespace to set during recovery */
extern uint srv_sys_space_size_debug;
-/** whether redo log files have been created at startup */
-extern bool srv_log_files_created;
+/** whether redo log file has been created at startup */
+extern bool srv_log_file_created;
#endif /* UNIV_DEBUG */
extern ulint srv_dml_needed_delay;
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 22b800a8dad..734089b757e 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -204,7 +204,7 @@ log_calculate_actual_len(
}
/** Check margin not to overwrite transaction log from the last checkpoint.
-If would estimate the log write to exceed the log_group_capacity,
+If would estimate the log write to exceed the log_capacity,
waits for the checkpoint is done enough.
@param[in] len length of the data to be written */
@@ -216,7 +216,7 @@ log_margin_checkpoint_age(
ut_ad(log_mutex_own());
- if (margin > log_sys.log_group_capacity) {
+ if (margin > log_sys.log_capacity) {
/* return with warning output to avoid deadlock */
if (!log_has_printed_chkp_margine_warning
|| difftime(time(NULL),
@@ -224,11 +224,11 @@ log_margin_checkpoint_age(
log_has_printed_chkp_margine_warning = true;
log_last_margine_warning_time = time(NULL);
- ib::error() << "The transaction log files are too"
+ ib::error() << "The transaction log file is too"
" small for the single transaction log (size="
<< len << "). So, the last checkpoint age"
- " might exceed the log group capacity "
- << log_sys.log_group_capacity << ".";
+ " might exceed the log capacity "
+ << log_sys.log_capacity << ".";
}
return;
@@ -238,7 +238,7 @@ log_margin_checkpoint_age(
Try to do checkpoint once. We cannot keep waiting here as it might
result in hang in case the current mtr has latch on oldest lsn */
if (log_sys.lsn - log_sys.last_checkpoint_lsn + margin
- > log_sys.log_group_capacity) {
+ > log_sys.log_capacity) {
/* The log write of 'len' might overwrite the transaction log
after the last checkpoint. Makes checkpoint. */
@@ -246,7 +246,7 @@ log_margin_checkpoint_age(
if (log_sys.lsn - log_buf_pool_get_oldest_modification()
+ margin
- <= log_sys.log_group_capacity) {
+ <= log_sys.log_capacity) {
flushed_enough = true;
}
@@ -412,7 +412,7 @@ log_close(void)
checkpoint_age = lsn - log_sys.last_checkpoint_lsn;
- if (checkpoint_age >= log_sys.log_group_capacity) {
+ if (checkpoint_age >= log_sys.log_capacity) {
DBUG_EXECUTE_IF(
"print_all_chkp_warnings",
log_has_printed_chkp_warning = false;);
@@ -424,10 +424,9 @@ log_close(void)
log_last_warning_time = time(NULL);
ib::error() << "The age of the last checkpoint is "
- << checkpoint_age << ", which exceeds the log"
- " group capacity "
- << log_sys.log_group_capacity
- << ".";
+ << checkpoint_age
+ << ", which exceeds the log capacity "
+ << log_sys.log_capacity << ".";
}
}
@@ -459,8 +458,7 @@ log_set_capacity(ulonglong file_size)
lsn_t margin;
ulint free;
- lsn_t smallest_capacity = (file_size - LOG_FILE_HDR_SIZE)
- * srv_n_log_files;
+ lsn_t smallest_capacity = file_size - LOG_FILE_HDR_SIZE;
/* Add extra safety */
smallest_capacity -= smallest_capacity / 10;
@@ -472,12 +470,13 @@ log_set_capacity(ulonglong file_size)
free = LOG_CHECKPOINT_FREE_PER_THREAD * (10 + srv_thread_concurrency)
+ LOG_CHECKPOINT_EXTRA_FREE;
if (free >= smallest_capacity / 2) {
- ib::error() << "Cannot continue operation. ib_logfiles are too"
- " small for innodb_thread_concurrency="
- << srv_thread_concurrency << ". The combined size of"
- " ib_logfiles should be bigger than"
- " 200 kB * innodb_thread_concurrency. "
- << INNODB_PARAMETERS_MSG;
+ ib::error() << "Cannot continue operation. " << LOG_FILE_NAME
+ << " is too small for innodb_thread_concurrency="
+ << srv_thread_concurrency << ". The size of "
+ << LOG_FILE_NAME
+ << " should be bigger than 200 kB * "
+ "innodb_thread_concurrency. "
+ << INNODB_PARAMETERS_MSG;
return(false);
}
@@ -486,7 +485,7 @@ log_set_capacity(ulonglong file_size)
log_mutex_enter();
- log_sys.log_group_capacity = smallest_capacity;
+ log_sys.log_capacity = smallest_capacity;
log_sys.max_modified_age_async = margin
- margin / LOG_POOL_PREFLUSH_RATIO_ASYNC;
@@ -541,7 +540,7 @@ void log_t::create()
os_event_set(flush_event);
n_log_ios= 0;
n_log_ios_old= 0;
- log_group_capacity= 0;
+ log_capacity= 0;
max_modified_age_async= 0;
max_modified_age_sync= 0;
max_checkpoint_age_async= 0;
@@ -793,71 +792,54 @@ dberr_t log_file_t::flush_data_only() noexcept
return m_file->flush_data_only();
}
-void log_t::files::open_files(std::vector<std::string> paths)
+void log_t::file::open_file(std::string path)
{
- files.clear();
- files.reserve(paths.size());
- for (auto &&path : paths)
- {
- files.push_back(std::move(path));
- if (files.back().open() != DB_SUCCESS)
- ib::fatal() << "open(" << files.back().get_path() << ") failed";
- }
+ fd= log_file_t(std::move(path));
+ if (const dberr_t err= fd.open())
+ ib::fatal() << "open(" << fd.get_path() << ") returned " << err;
}
-void log_t::files::read(os_offset_t total_offset, span<byte> buf)
+void log_t::file::read(os_offset_t offset, span<byte> buf)
{
- auto &file= files[static_cast<size_t>(total_offset / file_size)];
- const os_offset_t offset= total_offset % file_size;
-
- if (const dberr_t err= file.read(offset, buf))
- ib::fatal() << "read(" << file.get_path() << ") returned " << err;
+ if (const dberr_t err= fd.read(offset, buf))
+ ib::fatal() << "read(" << fd.get_path() << ") returned "<< err;
}
-bool log_t::files::writes_are_durable() const noexcept
+bool log_t::file::writes_are_durable() const noexcept
{
- return files[0].writes_are_durable();
+ return fd.writes_are_durable();
}
-void log_t::files::write(os_offset_t total_offset, span<byte> buf)
+void log_t::file::write(os_offset_t offset, span<byte> buf)
{
- auto &file= files[static_cast<size_t>(total_offset / file_size)];
- const os_offset_t offset= total_offset % file_size;
-
- if (const dberr_t err= file.write(offset, buf))
- ib::fatal() << "write(" << file.get_path() << ") returned " << err;
+ if (const dberr_t err= fd.write(offset, buf))
+ ib::fatal() << "write(" << fd.get_path() << ") returned " << err;
}
-void log_t::files::flush_data_only()
+void log_t::file::flush_data_only()
{
log_sys.pending_flushes.fetch_add(1, std::memory_order_acquire);
- for (auto &file : files)
- {
- if (file.flush_data_only() != DB_SUCCESS)
- ib::fatal() << "flush_data_only(" << file.get_path() << ") failed";
- }
+ if (const dberr_t err= fd.flush_data_only())
+ ib::fatal() << "flush_data_only(" << fd.get_path() << ") returned " << err;
log_sys.pending_flushes.fetch_sub(1, std::memory_order_release);
log_sys.flushes.fetch_add(1, std::memory_order_release);
}
-void log_t::files::close_files()
+void log_t::file::close_file()
{
- for (auto &file : files)
- {
- if (file.is_opened() && file.close() != DB_SUCCESS)
- ib::fatal() << "close(" << file.get_path() << ") failed";
- }
+ if (!fd.is_opened())
+ return;
+
+ if (const dberr_t err= fd.close())
+ ib::fatal() << "close(" << fd.get_path() << ") returned " << err;
}
-/** Initialize the redo log.
-@param[in] n_files number of files */
-void log_t::files::create(ulint n_files)
+/** Initialize the redo log. */
+void log_t::file::create()
{
- ut_ad(n_files <= SRV_N_LOG_FILES_MAX);
ut_ad(this == &log_sys.log);
ut_ad(log_sys.is_initialised());
- this->n_files= n_files;
format= srv_encrypt_log ? log_t::FORMAT_ENC_10_5 : log_t::FORMAT_10_5;
subformat= 2;
file_size= srv_log_file_size;
@@ -876,16 +858,11 @@ Writes a log file header to a log file space. */
static
void
log_file_header_flush(
- ulint nth_file, /*!< in: header to the nth file in the
- log file space */
lsn_t start_lsn) /*!< in: log file data starts at this
lsn */
{
- lsn_t dest_offset;
-
ut_ad(log_write_mutex_own());
ut_ad(!recv_no_log_write);
- ut_a(nth_file < log_sys.log.n_files);
ut_ad(log_sys.log.format == log_t::FORMAT_10_5
|| log_sys.log.format == log_t::FORMAT_ENC_10_5);
@@ -902,17 +879,13 @@ log_file_header_flush(
>= sizeof LOG_HEADER_CREATOR_CURRENT);
log_block_store_checksum(buf);
- dest_offset = nth_file * log_sys.log.file_size;
-
- DBUG_PRINT("ib_log", ("write " LSN_PF
- " file " ULINTPF " header",
- start_lsn, nth_file));
+ DBUG_PRINT("ib_log", ("write " LSN_PF, start_lsn));
log_sys.n_log_ios++;
srv_stats.os_log_pending_writes.inc();
- log_sys.log.write(static_cast<size_t>(dest_offset), buf);
+ log_sys.log.write(0, buf);
srv_stats.os_log_pending_writes.dec();
}
@@ -960,8 +933,7 @@ loop:
ut_a(next_offset / log_sys.log.file_size <= ULINT_MAX);
- log_file_header_flush(
- ulint(next_offset / log_sys.log.file_size), start_lsn);
+ log_file_header_flush(start_lsn);
srv_stats.os_log_written.add(OS_FILE_LOG_BLOCK_SIZE);
srv_stats.log_writes.inc();
@@ -1106,7 +1078,7 @@ void log_write_up_to(lsn_t lsn, bool flush_to_disk, bool rotate_key)
ut_ad(!rotate_key || flush_to_disk);
if (recv_no_ibuf_operations) {
- /* Recovery is running and no operations on the log files are
+ /* Recovery is running and no operations on the log file are
allowed yet (the variable name .._no_ibuf_.. is misleading) */
return;
@@ -1120,7 +1092,7 @@ loop:
/* NOTE: Currently doesn't do dirty read for
(flush_to_disk == true) case, because the log_mutex
contention also works as the arbitrator for write-IO
- (fsync) bandwidth between log files and data files. */
+ (fsync) bandwidth between log file and data files. */
if (!flush_to_disk && log_sys.write_lsn >= lsn) {
return;
}
@@ -1252,7 +1224,7 @@ loop:
rotate_key ? LOG_ENCRYPT_ROTATE_KEY : LOG_ENCRYPT);
}
- /* Do the write to the log files */
+ /* Do the write to the log file */
log_write_buf(
write_buf + area_start, area_end - area_start + pad_size,
#ifdef UNIV_DEBUG
@@ -1510,7 +1482,7 @@ log_append_on_checkpoint(
/** Make a checkpoint. Note that this function does not flush dirty
blocks from the buffer pool: it only checks what is lsn of the oldest
modification in the pool, and writes information about the lsn in
-log files. Use log_make_checkpoint() to flush also the pool.
+log file. Use log_make_checkpoint() to flush also the pool.
@return true if success, false if a checkpoint write was already running */
bool log_checkpoint()
{
@@ -1727,7 +1699,7 @@ extern void buf_resize_shutdown();
Makes a checkpoint at the latest lsn and writes it to first page of each
data file in the database, so that we know that the file spaces contain
all modifications up to that lsn. This can only be called at database
-shutdown. This function also writes all log in log files to the log archive. */
+shutdown. This function also writes log in log file to the log archive. */
void
logs_empty_and_mark_files_at_shutdown(void)
/*=======================================*/
@@ -2093,7 +2065,7 @@ void log_t::close()
/******************************************************//**
Pads the current log block full with dummy log records. Used in producing
-consistent archived log files and scrubbing redo log. */
+consistent archived log file and scrubbing redo log. */
static
void
log_pad_current_log_block(void)
@@ -2182,3 +2154,41 @@ DECLARE_THREAD(log_scrub_thread)(void*)
OS_THREAD_DUMMY_RETURN;
}
+
+std::string get_log_file_path(const char *filename)
+{
+ const size_t size= strlen(srv_log_group_home_dir) + /* path separator */ 1 +
+ strlen(filename) + /* longest suffix */ 3;
+ std::string path;
+ path.reserve(size);
+ path.assign(srv_log_group_home_dir);
+
+ std::replace(path.begin(), path.end(), OS_PATH_SEPARATOR_ALT,
+ OS_PATH_SEPARATOR);
+
+ if (path.back() != OS_PATH_SEPARATOR)
+ path.push_back(OS_PATH_SEPARATOR);
+ path.append(filename);
+
+ return path;
+}
+
+std::vector<std::string> get_existing_log_files_paths() {
+ std::vector<std::string> result;
+
+ for (int i= 0; i < 101; i++) {
+ auto path= get_log_file_path(LOG_FILE_NAME_PREFIX)
+ .append(std::to_string(i));
+ os_file_stat_t stat;
+ dberr_t err= os_file_get_status(path.c_str(), &stat, false, true);
+ if (err)
+ break;
+
+ if (stat.type != OS_FILE_TYPE_FILE)
+ break;
+
+ result.push_back(std::move(path));
+ }
+
+ return result;
+}
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 090680a1746..ff2d0e3d3e1 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -86,7 +86,7 @@ to file pages already before the recovery is finished: in this case no
ibuf operations are allowed, as they could modify the pages read in the
buffer pool before the pages have been recovered to the up-to-date state.
-TRUE means that recovery is running and no operations on the log files
+true means that recovery is running and no operations on the log file
are allowed yet: the variable name is misleading. */
bool recv_no_ibuf_operations;
@@ -544,6 +544,34 @@ inline void recv_sys_t::trim(const page_id_t page_id, lsn_t lsn)
DBUG_VOID_RETURN;
}
+void recv_sys_t::open_log_files_if_needed()
+{
+ if (!recv_sys.files.empty())
+ return;
+
+ for (auto &&path : get_existing_log_files_paths())
+ {
+ recv_sys.files.emplace_back(std::move(path));
+ ut_a(recv_sys.files.back().open() == DB_SUCCESS);
+ }
+}
+
+void recv_sys_t::read(os_offset_t total_offset, span<byte> buf)
+{
+ open_log_files_if_needed();
+
+ size_t file_idx= static_cast<size_t>(total_offset / log_sys.log.file_size);
+ os_offset_t offset= total_offset % log_sys.log.file_size;
+ dberr_t err= recv_sys.files[file_idx].read(offset, buf);
+ ut_a(err == DB_SUCCESS);
+}
+
+size_t recv_sys_t::files_size()
+{
+ open_log_files_if_needed();
+ return files.size();
+}
+
/** Process a file name from a FILE_* record.
@param[in,out] name file name
@param[in] len length of the file name
@@ -708,6 +736,8 @@ void recv_sys_t::close()
recv_spaces.clear();
mlog_init.clear();
+
+ files.clear();
}
/************************************************************
@@ -951,7 +981,7 @@ inline void recv_sys_t::free(const void *data)
out: the last read valid lsn
@param[in] end_lsn read area end
@return whether no invalid blocks (e.g checksum mismatch) were found */
-bool log_t::files::read_log_seg(lsn_t* start_lsn, lsn_t end_lsn)
+bool log_t::file::read_log_seg(lsn_t* start_lsn, lsn_t end_lsn)
{
ulint len;
bool success = true;
@@ -960,7 +990,7 @@ bool log_t::files::read_log_seg(lsn_t* start_lsn, lsn_t end_lsn)
ut_ad(!(end_lsn % OS_FILE_LOG_BLOCK_SIZE));
byte* buf = log_sys.buf;
loop:
- lsn_t source_offset = calc_lsn_offset(*start_lsn);
+ lsn_t source_offset = calc_lsn_offset_old(*start_lsn);
ut_a(end_lsn - *start_lsn <= ULINT_MAX);
len = (ulint) (end_lsn - *start_lsn);
@@ -980,7 +1010,7 @@ loop:
ut_a((source_offset >> srv_page_size_shift) <= ULINT_MAX);
- log_sys.log.read(static_cast<size_t>(source_offset), {buf, len});
+ recv_sys.read(source_offset, {buf, len});
for (ulint l = 0; l < len; l += OS_FILE_LOG_BLOCK_SIZE,
buf += OS_FILE_LOG_BLOCK_SIZE,
@@ -1094,6 +1124,28 @@ recv_check_log_header_checksum(
== log_block_calc_checksum_crc32(buf));
}
+static bool redo_file_sizes_are_correct()
+{
+ auto paths= get_existing_log_files_paths();
+ auto get_size= [](const std::string &path) {
+ return os_file_get_size(path.c_str()).m_total_size;
+ };
+ os_offset_t size= get_size(paths[0]);
+
+ auto it=
+ std::find_if(paths.begin(), paths.end(), [&](const std::string &path) {
+ return get_size(path) != size;
+ });
+
+ if (it == paths.end())
+ return true;
+
+ ib::error() << "Log file " << *it << " is of different size "
+ << get_size(*it) << " bytes than other log files " << size
+ << " bytes!";
+ return false;
+}
+
/** Find the latest checkpoint in the format-0 log header.
@param[out] max_field LOG_CHECKPOINT_1 or LOG_CHECKPOINT_2
@return error code or DB_SUCCESS */
@@ -1105,6 +1157,10 @@ recv_find_max_checkpoint_0(ulint* max_field)
ib_uint64_t checkpoint_no;
byte* buf = log_sys.checkpoint_buf;
+ if (!redo_file_sizes_are_correct()) {
+ return DB_CORRUPTION;
+ }
+
ut_ad(log_sys.log.format == 0);
/** Offset of the first checkpoint checksum */
@@ -1172,6 +1228,44 @@ recv_find_max_checkpoint_0(ulint* max_field)
return(DB_ERROR);
}
+/** Return number of ib_logfile0..100 files */
+static size_t count_log_files()
+{
+ size_t counter= 0;
+ for (int i= 0; i < 101; i++)
+ {
+ auto path=
+ get_log_file_path(LOG_FILE_NAME_PREFIX).append(std::to_string(i));
+ os_file_stat_t stat;
+ dberr_t err= os_file_get_status(path.c_str(), &stat, false, true);
+ if (err)
+ break;
+
+ if (stat.type != OS_FILE_TYPE_FILE)
+ break;
+
+ counter++;
+ }
+ return counter;
+}
+
+/** Same as cals_lsn_offset() except that it supports multiple files */
+lsn_t log_t::file::calc_lsn_offset_old(lsn_t lsn) const
+{
+ ut_ad(log_sys.mutex.is_owned() || log_sys.write_mutex.is_owned());
+ const lsn_t size= capacity() * recv_sys.files_size();
+ lsn_t l= lsn - this->lsn;
+ if (longlong(l) < 0)
+ {
+ l= lsn_t(-longlong(l)) % size;
+ l= size - l;
+ }
+
+ l+= lsn_offset - LOG_FILE_HDR_SIZE * (1 + lsn_offset / file_size);
+ l%= size;
+ return l + LOG_FILE_HDR_SIZE * (1 + l / (file_size - LOG_FILE_HDR_SIZE));
+}
+
/** Determine if a pre-MySQL 5.7.9/MariaDB 10.2.2 redo log is clean.
@param[in] lsn checkpoint LSN
@param[in] crypt whether the log might be encrypted
@@ -1181,7 +1275,7 @@ recv_find_max_checkpoint_0(ulint* max_field)
static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
{
log_mutex_enter();
- const lsn_t source_offset = log_sys.log.calc_lsn_offset(lsn);
+ const lsn_t source_offset = log_sys.log.calc_lsn_offset_old(lsn);
log_mutex_exit();
byte* buf = log_sys.buf;
@@ -1189,8 +1283,8 @@ static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
"Upgrade after a crash is not supported."
" This redo log was created before MariaDB 10.2.2";
- log_sys.log.read(source_offset & ~(OS_FILE_LOG_BLOCK_SIZE - 1),
- {buf, OS_FILE_LOG_BLOCK_SIZE});
+ recv_sys.read(source_offset & ~(OS_FILE_LOG_BLOCK_SIZE - 1),
+ {buf, OS_FILE_LOG_BLOCK_SIZE});
if (log_block_calc_checksum_format_0(buf)
!= log_block_get_checksum(buf)
@@ -1222,6 +1316,7 @@ static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
= log_sys.current_flush_lsn = log_sys.flushed_to_disk_lsn
= lsn;
log_sys.next_checkpoint_no = 0;
+ recv_sys.remove_extra_log_files = true;
return(DB_SUCCESS);
}
@@ -1233,11 +1328,15 @@ static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
static dberr_t recv_log_recover_10_4()
{
const lsn_t lsn = log_sys.log.get_lsn();
- const lsn_t source_offset = log_sys.log.calc_lsn_offset(lsn);
+ const lsn_t source_offset = log_sys.log.calc_lsn_offset_old(lsn);
byte* buf = log_sys.buf;
- log_sys.log.read(source_offset & ~(OS_FILE_LOG_BLOCK_SIZE - 1),
- {buf, OS_FILE_LOG_BLOCK_SIZE});
+ if (!redo_file_sizes_are_correct()) {
+ return DB_CORRUPTION;
+ }
+
+ recv_sys.read(source_offset & ~(OS_FILE_LOG_BLOCK_SIZE - 1),
+ {buf, OS_FILE_LOG_BLOCK_SIZE});
ulint crc = log_block_calc_checksum_crc32(buf);
ulint cksum = log_block_get_checksum(buf);
@@ -1277,6 +1376,7 @@ static dberr_t recv_log_recover_10_4()
= log_sys.current_flush_lsn = log_sys.flushed_to_disk_lsn
= lsn;
log_sys.next_checkpoint_no = 0;
+ recv_sys.remove_extra_log_files = true;
return DB_SUCCESS;
}
@@ -1379,7 +1479,7 @@ recv_find_max_checkpoint(ulint* max_field)
if (*max_field == 0) {
/* Before 10.2.2, we could get here during database
- initialization if we created an ib_logfile0 file that
+ initialization if we created an LOG_FILE_NAME file that
was filled with zeroes, and were killed. After
10.2.2, we would reject such a file already earlier,
when checking the file header. */
@@ -2661,7 +2761,7 @@ static bool recv_scan_log_recs(
}
if (scanned_lsn > recv_sys.scanned_lsn) {
- ut_ad(!srv_log_files_created);
+ ut_ad(!srv_log_file_created);
if (!recv_needed_recovery) {
recv_needed_recovery = true;
@@ -3146,23 +3246,28 @@ completed:
&& recv_sys.mlog_checkpoint_lsn == checkpoint_lsn) {
/* The redo log is logically empty. */
} else if (checkpoint_lsn != flush_lsn) {
- ut_ad(!srv_log_files_created);
+ ut_ad(!srv_log_file_created);
if (checkpoint_lsn + sizeof_checkpoint < flush_lsn) {
- ib::warn() << "Are you sure you are using the"
- " right ib_logfiles to start up the database?"
- " Log sequence number in the ib_logfiles is "
- << checkpoint_lsn << ", less than the"
- " log sequence number in the first system"
- " tablespace file header, " << flush_lsn << ".";
+ ib::warn()
+ << "Are you sure you are using the right "
+ << LOG_FILE_NAME
+ << " to start up the database? Log sequence "
+ "number in the "
+ << LOG_FILE_NAME << " is " << checkpoint_lsn
+ << ", less than the log sequence number in "
+ "the first system tablespace file header, "
+ << flush_lsn << ".";
}
- if (log_sys.log.is_physical()
- && !recv_needed_recovery) {
- ib::info() << "The log sequence number " << flush_lsn
+ if (!recv_needed_recovery) {
+
+ ib::info()
+ << "The log sequence number " << flush_lsn
<< " in the system tablespace does not match"
- " the log sequence number " << checkpoint_lsn
- << " in the ib_logfiles!";
+ " the log sequence number "
+ << checkpoint_lsn << " in the "
+ << LOG_FILE_NAME << "!";
if (srv_read_only_mode) {
ib::error() << "innodb_read_only"
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 7cf1cbea60d..df7fce32ff2 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2136,8 +2136,8 @@ os_file_create_simple_func(
file = CreateFile(
(LPCTSTR) name, access,
- FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
- create_flag, attributes, NULL);
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ NULL, create_flag, attributes, NULL);
if (file == INVALID_HANDLE_VALUE) {
@@ -2404,9 +2404,8 @@ os_file_create_func(
);
DWORD create_flag;
- DWORD share_mode = srv_operation != SRV_OPERATION_NORMAL
- ? FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
- : FILE_SHARE_READ | FILE_SHARE_DELETE;
+ const DWORD share_mode =
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) {
WAIT_ALLOW_WRITES();
@@ -2426,12 +2425,6 @@ os_file_create_func(
create_flag = OPEN_EXISTING;
- /* On Windows Physical devices require admin privileges and
- have to have the write-share mode set. See the remarks
- section for the CreateFile() function documentation in MSDN. */
-
- share_mode |= FILE_SHARE_WRITE;
-
} else if (create_mode == OS_FILE_OPEN
|| create_mode == OS_FILE_OPEN_RETRY) {
@@ -2612,9 +2605,8 @@ os_file_create_simple_no_error_handling_func(
DWORD access;
DWORD create_flag;
DWORD attributes = 0;
- DWORD share_mode = srv_operation != SRV_OPERATION_NORMAL
- ? FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
- : FILE_SHARE_READ | FILE_SHARE_DELETE;
+ const DWORD share_mode =
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
ut_a(name);
@@ -2660,11 +2652,6 @@ os_file_create_simple_no_error_handling_func(
access = GENERIC_READ;
- /*!< A backup program has to give mysqld the maximum
- freedom to do what it likes with the file */
-
- share_mode |= FILE_SHARE_DELETE | FILE_SHARE_WRITE
- | FILE_SHARE_READ;
} else {
ib::error()
@@ -3911,7 +3898,7 @@ static bool is_linux_native_aio_supported()
{
File fd;
io_context_t io_ctx;
- char name[1000];
+ std::string log_file_path = get_log_file_path();
memset(&io_ctx, 0, sizeof(io_ctx));
if (io_setup(1, &io_ctx)) {
@@ -3939,31 +3926,14 @@ static bool is_linux_native_aio_supported()
}
}
else {
-
- os_normalize_path(srv_log_group_home_dir);
-
- ulint dirnamelen = strlen(srv_log_group_home_dir);
-
- ut_a(dirnamelen < (sizeof name) - 10 - sizeof "ib_logfile");
-
- memcpy(name, srv_log_group_home_dir, dirnamelen);
-
- /* Add a path separator if needed. */
- if (dirnamelen && name[dirnamelen - 1] != OS_PATH_SEPARATOR) {
-
- name[dirnamelen++] = OS_PATH_SEPARATOR;
- }
-
- strcpy(name + dirnamelen, "ib_logfile0");
-
- fd = my_open(name, O_RDONLY | O_CLOEXEC, MYF(0));
+ fd = my_open(log_file_path.c_str(), O_RDONLY | O_CLOEXEC,
+ MYF(0));
if (fd == -1) {
- ib::warn()
- << "Unable to open"
- << " \"" << name << "\" to check native"
- << " AIO read support.";
+ ib::warn() << "Unable to open \"" << log_file_path
+ << "\" to check native"
+ << " AIO read support.";
int ret = io_destroy(io_ctx);
ut_a(ret != EINVAL);
@@ -4024,7 +3994,7 @@ static bool is_linux_native_aio_supported()
ib::error()
<< "Linux Native AIO not supported. You can either"
" move "
- << (srv_read_only_mode ? name : "tmpdir")
+ << (srv_read_only_mode ? log_file_path : "tmpdir")
<< " to a file system that supports native"
" AIO or you can set innodb_use_native_aio to"
" FALSE to avoid this message.";
@@ -4033,7 +4003,7 @@ static bool is_linux_native_aio_supported()
default:
ib::error()
<< "Linux Native AIO check on "
- << (srv_read_only_mode ? name : "tmpdir")
+ << (srv_read_only_mode ? log_file_path : "tmpdir")
<< "returned error[" << -err << "]";
}
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 1e3e223e94e..aa12391f0d5 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -162,7 +162,6 @@ static os_event_t srv_master_thread_disabled_event;
/*------------------------- LOG FILES ------------------------ */
char* srv_log_group_home_dir;
-ulong srv_n_log_files;
/** The InnoDB redo log file size, or 0 when changing the redo log format
at startup (while disallowing writes to the redo log). */
ulonglong srv_log_file_size;
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index d8378d271ec..eb139a59845 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -136,8 +136,8 @@ UNIV_INTERN bool srv_undo_sources;
#ifdef UNIV_DEBUG
/** InnoDB system tablespace to set during recovery */
UNIV_INTERN uint srv_sys_space_size_debug;
-/** whether redo log files have been created at startup */
-UNIV_INTERN bool srv_log_files_created;
+/** whether redo log file have been created at startup */
+UNIV_INTERN bool srv_log_file_created;
#endif /* UNIV_DEBUG */
/** Bit flags for tracking background thread creation. They are used to
@@ -247,133 +247,76 @@ srv_file_check_mode(
return(true);
}
+/** Initial number of the redo log file */
+static const char INIT_LOG_FILE0[]= "101";
-/** Creates a log file.
-@param[in] name log file name
-@return DB_SUCCESS or error code */
-static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t
- create_log_file(const char* name)
-{
- bool ret;
-
- pfs_os_file_t file = os_file_create(
- innodb_log_file_key, name,
- OS_FILE_CREATE|OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_NORMAL,
- OS_LOG_FILE, srv_read_only_mode, &ret);
-
- if (!ret) {
- ib::error() << "Cannot create " << name;
- return(DB_ERROR);
- }
-
- ib::info() << "Setting log file " << name << " size to "
- << srv_log_file_size << " bytes";
-
- ret = os_file_set_size(name, file, srv_log_file_size);
- if (!ret) {
- os_file_close(file);
- ib::error() << "Cannot set log file " << name << " size to "
- << srv_log_file_size << " bytes";
- return(DB_ERROR);
- }
-
- ret = os_file_close(file);
- ut_a(ret);
-
- return(DB_SUCCESS);
-}
-
-/** Initial number of the first redo log file */
-#define INIT_LOG_FILE0 (SRV_N_LOG_FILES_MAX + 1)
-
-/** Delete all log files.
-@param[in,out] logfilename buffer for log file name
-@param[in] dirnamelen length of the directory path
-@param[in] n_files number of files to delete
-@param[in] i first file to delete */
-static
-void
-delete_log_files(char* logfilename, size_t dirnamelen, uint n_files, uint i=0)
-{
- /* Remove any old log files. */
- for (; i < n_files; i++) {
- sprintf(logfilename + dirnamelen, "ib_logfile%u", i);
-
- /* Ignore errors about non-existent files or files
- that cannot be removed. The create_log_file() will
- return an error when the file exists. */
-#ifdef _WIN32
- DeleteFile((LPCTSTR) logfilename);
-#else
- unlink(logfilename);
-#endif
- }
-}
-
-/*********************************************************************//**
-Creates all log files.
+/** Creates log file.
+@param[in] lsn FIL_PAGE_FILE_FLUSH_LSN value
+@param[out] logfile0 name of the log file
@return DB_SUCCESS or error code */
-static
-dberr_t
-create_log_files(
-/*=============*/
- char* logfilename, /*!< in/out: buffer for log file name */
- size_t dirnamelen, /*!< in: length of the directory path */
- lsn_t lsn, /*!< in: FIL_PAGE_FILE_FLUSH_LSN value */
- std::string& logfile0) /*!< out: name of the first log file */
+static dberr_t create_log_file(lsn_t lsn, std::string& logfile0)
{
- dberr_t err;
-
if (srv_read_only_mode) {
- ib::error() << "Cannot create log files in read-only mode";
- return(DB_READ_ONLY);
+ ib::error() << "Cannot create log file in read-only mode";
+ return DB_READ_ONLY;
}
/* Crashing after deleting the first file should be
recoverable. The buffer pool was clean, and we can simply
- create all log files from the scratch. */
- DBUG_EXECUTE_IF("innodb_log_abort_6",
- delete_log_files(logfilename, dirnamelen, 1);
- return(DB_ERROR););
+ create log file from the scratch. */
+ DBUG_EXECUTE_IF("innodb_log_abort_6", delete_log_file("0");
+ return DB_ERROR;);
- delete_log_files(logfilename, dirnamelen, INIT_LOG_FILE0 + 1);
+ delete_log_file("0");
+ delete_log_file(INIT_LOG_FILE0);
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_EXECUTE_IF("innodb_log_abort_7", return DB_ERROR;);
DBUG_PRINT("ib_log", ("After innodb_log_abort_7"));
- std::vector<std::string> file_names;
+ logfile0 = get_log_file_path(LOG_FILE_NAME_PREFIX)
+ .append(INIT_LOG_FILE0);
- for (unsigned i = 0; i < srv_n_log_files; i++) {
- sprintf(logfilename + dirnamelen,
- "ib_logfile%u", i ? i : INIT_LOG_FILE0);
+ bool ret;
+ pfs_os_file_t file = os_file_create(
+ innodb_log_file_key, logfile0.c_str(),
+ OS_FILE_CREATE|OS_FILE_ON_ERROR_NO_EXIT, OS_FILE_NORMAL,
+ OS_LOG_FILE, srv_read_only_mode, &ret);
- err = create_log_file(logfilename);
+ if (!ret) {
+ ib::error() << "Cannot create " << logfile0;
+ return DB_ERROR;
+ }
- if (err != DB_SUCCESS) {
- return(err);
- }
+ ib::info() << "Setting log file " << logfile0 << " size to "
+ << srv_log_file_size << " bytes";
- file_names.emplace_back(logfilename);
+ ret = os_file_set_size(logfile0.c_str(), file, srv_log_file_size);
+ if (!ret) {
+ os_file_close(file);
+ ib::error() << "Cannot set log file " << logfile0
+ << " size to " << srv_log_file_size << " bytes";
+ return DB_ERROR;
}
- logfile0 = file_names[0];
+ ret = os_file_close(file);
+ ut_a(ret);
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
- has been completed and renamed. */
+ /* We did not create the first log file initially as LOG_FILE_NAME, so
+ that crash recovery cannot find it until it has been completed and
+ renamed. */
- log_sys.log.create(srv_n_log_files);
+ log_sys.log.create();
if (!log_set_capacity(srv_log_file_size_requested)) {
- return(DB_ERROR);
+ return DB_ERROR;
}
- log_sys.log.open_files(std::move(file_names));
+ log_sys.log.open_file(logfile0);
fil_open_system_tablespace_files();
/* Create a log checkpoint. */
@@ -406,44 +349,39 @@ create_log_files(
log_make_checkpoint();
- return(DB_SUCCESS);
+ return DB_SUCCESS;
}
/** 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 dberr_t create_log_files_rename(char *logfilename, size_t dirnamelen,
- lsn_t lsn, std::string &logfile0)
+static dberr_t create_log_file_rename(lsn_t lsn, std::string &logfile0)
{
- ut_ad(!srv_log_files_created);
- ut_d(srv_log_files_created= true);
+ ut_ad(!srv_log_file_created);
+ ut_d(srv_log_file_created= true);
DBUG_EXECUTE_IF("innodb_log_abort_9", return (DB_ERROR););
DBUG_PRINT("ib_log", ("After innodb_log_abort_9"));
- /* Rename the first log file, now that a log
- checkpoint has been created. */
- sprintf(logfilename + dirnamelen, "ib_logfile%u", 0);
+ /* Rename the first log file, now that a log checkpoint has been created. */
+ auto new_name = get_log_file_path();
- ib::info() << "Renaming log file " << logfile0 << " to " << logfilename;
+ ib::info() << "Renaming log file " << logfile0 << " to " << new_name;
log_mutex_enter();
- ut_ad(logfile0.size() == 2 + strlen(logfilename));
- dberr_t err= log_sys.log.files[0].rename(logfilename);
+ ut_ad(logfile0.size() == 2 + new_name.size());
+ logfile0= new_name;
+ dberr_t err= log_sys.log.rename(std::move(new_name));
- /* Replace the first file with ib_logfile0. */
- logfile0= logfilename;
log_mutex_exit();
DBUG_EXECUTE_IF("innodb_log_abort_10", err= DB_ERROR;);
if (err == DB_SUCCESS)
- ib::info() << "New log files created, LSN=" << lsn;
+ ib::info() << "New log file created, LSN=" << lsn;
return err;
}
@@ -707,34 +645,23 @@ srv_check_undo_redo_logs_exists()
}
}
- /* Check if any redo log files exist */
- char logfilename[OS_FILE_MAX_PATH];
- size_t dirnamelen = strlen(srv_log_group_home_dir);
- memcpy(logfilename, srv_log_group_home_dir, dirnamelen);
+ /* Check if redo log file exists */
+ auto logfilename = get_log_file_path();
- for (unsigned i = 0; i < srv_n_log_files; i++) {
- sprintf(logfilename + dirnamelen,
- "ib_logfile%u", i);
-
- fh = os_file_create(
- innodb_log_file_key, logfilename,
- OS_FILE_OPEN_RETRY
- | OS_FILE_ON_ERROR_NO_EXIT
- | OS_FILE_ON_ERROR_SILENT,
- OS_FILE_NORMAL,
- OS_LOG_FILE,
- srv_read_only_mode,
- &ret);
+ fh = os_file_create(innodb_log_file_key, logfilename.c_str(),
+ OS_FILE_OPEN_RETRY | OS_FILE_ON_ERROR_NO_EXIT
+ | OS_FILE_ON_ERROR_SILENT,
+ OS_FILE_NORMAL, OS_LOG_FILE, srv_read_only_mode,
+ &ret);
- if (ret) {
- os_file_close(fh);
- ib::error() << "redo log file '" << logfilename
- << "' exists. Creating system tablespace with"
- " existing redo log files is not recommended."
- " Please delete all redo log files before"
- " creating new system tablespace.";
- return(DB_ERROR);
- }
+ if (ret) {
+ os_file_close(fh);
+ ib::error() << "redo log file '" << logfilename
+ << "' exists. Creating system tablespace with"
+ " existing redo log file is not recommended."
+ " Please delete redo log file before"
+ " creating new system tablespace.";
+ return DB_ERROR;
}
return(DB_SUCCESS);
@@ -1047,16 +974,13 @@ srv_init_abort_low(
return(err);
}
-/** Prepare to delete the redo log files. Flush the dirty pages from all the
+/** Prepare to delete the redo log file. Flush the dirty pages from all the
buffer pools. Flush the redo log buffer to the redo log file.
-@param[in] n_files number of old redo log files
+@param[in] old_exists old redo log file exists
@return lsn upto which data pages have been flushed. */
-static
-lsn_t
-srv_prepare_to_delete_redo_log_files(
- ulint n_files)
+static lsn_t srv_prepare_to_delete_redo_log_file(bool old_exists)
{
- DBUG_ENTER("srv_prepare_to_delete_redo_log_files");
+ DBUG_ENTER("srv_prepare_to_delete_redo_log_file");
lsn_t flushed_lsn;
ulint pending_io = 0;
@@ -1085,7 +1009,7 @@ srv_prepare_to_delete_redo_log_files(
|| (log_sys.log.format & ~log_t::FORMAT_ENCRYPTED)
!= log_t::FORMAT_10_5) {
info << "Upgrading redo log: ";
- } else if (n_files != srv_n_log_files
+ } else if (!old_exists
|| srv_log_file_size
!= srv_log_file_size_requested) {
if (srv_encrypt_log
@@ -1100,21 +1024,20 @@ srv_prepare_to_delete_redo_log_files(
" and resizing";
}
- info << " redo log from " << n_files
- << "*" << srv_log_file_size << " to ";
+ info << " redo log from " << srv_log_file_size
+ << " to ";
} else if (srv_encrypt_log) {
info << "Encrypting redo log: ";
} else {
info << "Removing redo log encryption: ";
}
- info << srv_n_log_files << "*"
- << srv_log_file_size_requested
+ info << srv_log_file_size_requested
<< " bytes; LSN=" << flushed_lsn;
}
srv_start_lsn = flushed_lsn;
- /* Flush the old log files. */
+ /* Flush the old log file. */
log_mutex_exit();
log_write_up_to(flushed_lsn, true);
@@ -1145,6 +1068,70 @@ srv_prepare_to_delete_redo_log_files(
DBUG_RETURN(flushed_lsn);
}
+/** Tries to locate LOG_FILE_NAME and check it's size, etc
+@param[out] log_file_found returns true here if correct file was found
+@return dberr_t with DB_SUCCESS or some error */
+static dberr_t find_and_check_log_file(bool &log_file_found)
+{
+ log_file_found= false;
+
+ auto logfile0= get_log_file_path();
+ os_file_stat_t stat_info;
+ const dberr_t err= os_file_get_status(logfile0.c_str(), &stat_info, false,
+ srv_read_only_mode);
+
+ auto is_operation_restore= []() -> bool {
+ return srv_operation == SRV_OPERATION_RESTORE ||
+ srv_operation == SRV_OPERATION_RESTORE_EXPORT;
+ };
+
+ if (err == DB_NOT_FOUND)
+ {
+ if (is_operation_restore())
+ return DB_NOT_FOUND;
+
+ return DB_SUCCESS;
+ }
+
+ if (stat_info.type != OS_FILE_TYPE_FILE)
+ return DB_SUCCESS;
+
+ if (!srv_file_check_mode(logfile0.c_str()))
+ return DB_ERROR;
+
+ const os_offset_t size= stat_info.size;
+ ut_a(size != (os_offset_t) -1);
+
+ if (size % OS_FILE_LOG_BLOCK_SIZE)
+ {
+ ib::error() << "Log file " << logfile0 << " size " << size
+ << " is not a multiple of " << OS_FILE_LOG_BLOCK_SIZE
+ << " bytes";
+ return DB_ERROR;
+ }
+
+ if (size == 0 && is_operation_restore())
+ {
+ /* Tolerate an empty LOG_FILE_NAME from a previous run of
+ mariabackup --prepare. */
+ return DB_NOT_FOUND;
+ }
+ /* The first log file must consist of at least the following 512-byte pages:
+ header, checkpoint page 1, empty, checkpoint page 2, redo log page(s).
+
+ Mariabackup --prepare would create an empty LOG_FILE_NAME. Tolerate it. */
+ if (size != 0 && size <= OS_FILE_LOG_BLOCK_SIZE * 4)
+ {
+ ib::error() << "Log file " << logfile0 << " size " << size
+ << " is too small";
+ return DB_ERROR;
+ }
+ srv_log_file_size= size;
+
+ log_file_found= true;
+ return DB_SUCCESS;
+}
+
/** Start InnoDB.
@param[in] create_new_db whether to create a new database
@return DB_SUCCESS or error code */
@@ -1152,9 +1139,8 @@ dberr_t srv_start(bool create_new_db)
{
lsn_t flushed_lsn;
dberr_t err = DB_SUCCESS;
- ulint srv_n_log_files_found = srv_n_log_files;
+ bool srv_log_file_found = true;
mtr_t mtr;
- unsigned i = 0;
ut_ad(srv_operation == SRV_OPERATION_NORMAL
|| srv_operation == SRV_OPERATION_RESTORE
@@ -1403,16 +1389,6 @@ dberr_t srv_start(bool create_new_db)
return(srv_init_abort(err));
}
- char logfilename[10000];
- size_t dirnamelen = strlen(srv_log_group_home_dir);
- ut_a(dirnamelen < (sizeof logfilename) - 10 - sizeof "ib_logfile");
- memcpy(logfilename, srv_log_group_home_dir, dirnamelen);
-
- /* Add a path separator if needed. */
- if (dirnamelen && logfilename[dirnamelen - 1] != OS_PATH_SEPARATOR) {
- logfilename[dirnamelen++] = OS_PATH_SEPARATOR;
- }
-
srv_log_file_size_requested = srv_log_file_size;
if (innodb_encrypt_temporary_tables && !log_crypt_init()) {
@@ -1426,8 +1402,7 @@ dberr_t srv_start(bool create_new_db)
flushed_lsn = log_get_lsn();
- err = create_log_files(
- logfilename, dirnamelen, flushed_lsn, logfile0);
+ err = create_log_file(flushed_lsn, logfile0);
if (err != DB_SUCCESS) {
return(srv_init_abort(err));
@@ -1435,107 +1410,31 @@ dberr_t srv_start(bool create_new_db)
} else {
srv_log_file_size = 0;
- for (i = 0; i < SRV_N_LOG_FILES_MAX; i++) {
- os_file_stat_t stat_info;
-
- sprintf(logfilename + dirnamelen,
- "ib_logfile%u", i);
-
- err = os_file_get_status(
- logfilename, &stat_info, false,
- srv_read_only_mode);
-
+ bool log_file_found;
+ if (dberr_t err = find_and_check_log_file(log_file_found)) {
if (err == DB_NOT_FOUND) {
- if (i == 0) {
- if (srv_operation
- == SRV_OPERATION_RESTORE
- || srv_operation
- == SRV_OPERATION_RESTORE_EXPORT) {
- return(DB_SUCCESS);
- }
- }
-
- /* opened all files */
- break;
- }
-
- if (stat_info.type != OS_FILE_TYPE_FILE) {
- break;
- }
-
- if (!srv_file_check_mode(logfilename)) {
- return(srv_init_abort(DB_ERROR));
- }
-
- const os_offset_t size = stat_info.size;
- ut_a(size != (os_offset_t) -1);
-
- if (size & (OS_FILE_LOG_BLOCK_SIZE - 1)) {
-
- ib::error() << "Log file " << logfilename
- << " size " << size << " is not a"
- " multiple of 512 bytes";
- return(srv_init_abort(DB_ERROR));
- }
-
- if (i == 0) {
- if (size == 0
- && (srv_operation
- == SRV_OPERATION_RESTORE
- || srv_operation
- == SRV_OPERATION_RESTORE_EXPORT)) {
- /* Tolerate an empty ib_logfile0
- from a previous run of
- mariabackup --prepare. */
- return(DB_SUCCESS);
- }
- /* The first log file must consist of
- at least the following 512-byte pages:
- header, checkpoint page 1, empty,
- checkpoint page 2, redo log page(s).
-
- Mariabackup --prepare would create an
- empty ib_logfile0. Tolerate it if there
- are no other ib_logfile* files. */
- if ((size != 0 || i != 0)
- && size <= OS_FILE_LOG_BLOCK_SIZE * 4) {
- ib::error() << "Log file "
- << logfilename << " size "
- << size << " is too small";
- return(srv_init_abort(DB_ERROR));
- }
- srv_log_file_size = size;
- } else if (size != srv_log_file_size) {
-
- ib::error() << "Log file " << logfilename
- << " is of different size " << size
- << " bytes than other log files "
- << srv_log_file_size << " bytes!";
- return(srv_init_abort(DB_ERROR));
+ return DB_SUCCESS;
}
+ return srv_init_abort(err);
}
if (srv_log_file_size == 0) {
if (flushed_lsn < lsn_t(1000)) {
ib::error()
- << "Cannot create log files because"
+ << "Cannot create log file because"
" data files are corrupt or the"
" database was not shut down cleanly"
" after creating the data files.";
return srv_init_abort(DB_ERROR);
}
- strcpy(logfilename + dirnamelen, "ib_logfile0");
srv_log_file_size = srv_log_file_size_requested;
- err = create_log_files(
- logfilename, dirnamelen,
- flushed_lsn, logfile0);
+ err = create_log_file(flushed_lsn, logfile0);
if (err == DB_SUCCESS) {
- err = create_log_files_rename(
- logfilename, dirnamelen,
- flushed_lsn, logfile0);
+ err = create_log_file_rename(flushed_lsn,
+ logfile0);
}
if (err != DB_SUCCESS) {
@@ -1545,32 +1444,23 @@ dberr_t srv_start(bool create_new_db)
/* Suppress the message about
crash recovery. */
flushed_lsn = log_get_lsn();
- goto files_checked;
+ goto file_checked;
}
- srv_n_log_files_found = i;
+ srv_log_file_found = log_file_found;
- std::vector<std::string> file_names;
+ log_sys.log.open_file(get_log_file_path());
- for (unsigned j = 0; j < srv_n_log_files_found; j++) {
- sprintf(logfilename + dirnamelen, "ib_logfile%u", j);
-
- file_names.emplace_back(logfilename);
- }
-
- log_sys.log.open_files(std::move(file_names));
-
- log_sys.log.create(srv_n_log_files_found);
+ log_sys.log.create();
if (!log_set_capacity(srv_log_file_size_requested)) {
return(srv_init_abort(DB_ERROR));
}
}
-files_checked:
- /* Open all log files and data files in the system
- tablespace: we keep them open until database
- shutdown */
+file_checked:
+ /* Open log file and data files in the systemtablespace: we keep
+ them open until database shutdown */
fil_open_system_tablespace_files();
ut_d(fil_system.sys_space->recv_size = srv_sys_space_size_debug);
@@ -1635,9 +1525,7 @@ files_checked:
err = fil_write_flushed_lsn(flushed_lsn);
if (err == DB_SUCCESS) {
- err = create_log_files_rename(
- logfilename, dirnamelen,
- flushed_lsn, logfile0);
+ err = create_log_file_rename(flushed_lsn, logfile0);
}
if (err != DB_SUCCESS) {
@@ -1648,6 +1536,16 @@ files_checked:
been shut down normally: this is the normal startup path */
err = recv_recovery_from_checkpoint_start(flushed_lsn);
+ recv_sys.close_files();
+
+ if (recv_sys.remove_extra_log_files) {
+ auto log_files_found = recv_sys.files_size();
+ recv_sys.close_files();
+ for (size_t i = 1; i < log_files_found; i++) {
+ delete_log_file(std::to_string(i).c_str());
+ }
+ recv_sys.remove_extra_log_files = false;
+ }
recv_sys.dblwr.pages.clear();
@@ -1794,24 +1692,20 @@ files_checked:
Unless --export is specified, no further change to
InnoDB files is needed. */
ut_ad(!srv_force_recovery);
- ut_ad(srv_n_log_files_found <= 1);
ut_ad(recv_no_log_write);
buf_flush_sync();
err = fil_write_flushed_lsn(log_get_lsn());
ut_ad(!buf_pool_check_no_pending_io());
- log_sys.log.close_files();
+ log_sys.log.close_file();
if (err == DB_SUCCESS) {
bool trunc = srv_operation
== SRV_OPERATION_RESTORE;
- /* Delete subsequent log files. */
- delete_log_files(logfilename, dirnamelen,
- (uint)srv_n_log_files_found, trunc);
- if (trunc) {
+ if (!trunc) {
+ delete_log_file("0");
+ } else {
+ auto logfile0 = get_log_file_path();
/* Truncate the first log file. */
- strcpy(logfilename + dirnamelen,
- "ib_logfile0");
- FILE* f = fopen(logfilename, "w");
- fclose(f);
+ fclose(fopen(logfile0.c_str(), "w"));
}
}
return(err);
@@ -1819,14 +1713,14 @@ files_checked:
/* Upgrade or resize or rebuild the redo logs before
generating any dirty pages, so that the old redo log
- files will not be written to. */
+ file will not be written to. */
if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
/* Completely ignore the redo log. */
} else if (srv_read_only_mode) {
/* Leave the redo log alone. */
} else if (srv_log_file_size_requested == srv_log_file_size
- && srv_n_log_files_found == srv_n_log_files
+ && srv_log_file_found
&& log_sys.log.format
== (srv_encrypt_log
? log_t::FORMAT_ENC_10_5
@@ -1835,14 +1729,15 @@ files_checked:
/* No need to add or remove encryption,
upgrade, downgrade, or resize. */
} else {
- /* Prepare to delete the old redo log files */
- flushed_lsn = srv_prepare_to_delete_redo_log_files(i);
+ /* Prepare to delete the old redo log file */
+ flushed_lsn = srv_prepare_to_delete_redo_log_file(
+ srv_log_file_found);
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(). */
+ end of create_log_file(). */
ut_d(recv_no_log_write = true);
ut_ad(!buf_pool_check_no_pending_io());
@@ -1860,27 +1755,23 @@ files_checked:
return(srv_init_abort(err));
}
- /* Close and free the redo log files, so that
- we can replace them. */
- log_sys.log.close_files();
+ /* Close the redo log file, so that we can replace it */
+ log_sys.log.close_file();
DBUG_EXECUTE_IF("innodb_log_abort_5",
return(srv_init_abort(DB_ERROR)););
DBUG_PRINT("ib_log", ("After innodb_log_abort_5"));
- ib::info() << "Starting to delete and rewrite log"
- " files.";
+ ib::info()
+ << "Starting to delete and rewrite log file.";
srv_log_file_size = srv_log_file_size_requested;
- err = create_log_files(
- logfilename, dirnamelen, flushed_lsn,
- logfile0);
+ err = create_log_file(flushed_lsn, logfile0);
if (err == DB_SUCCESS) {
- err = create_log_files_rename(
- logfilename, dirnamelen, flushed_lsn,
- logfile0);
+ err = create_log_file_rename(flushed_lsn,
+ logfile0);
}
if (err != DB_SUCCESS) {