summaryrefslogtreecommitdiff
path: root/extra
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 /extra
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
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/backup_copy.cc21
-rw-r--r--extra/mariabackup/backup_mysql.cc6
-rw-r--r--extra/mariabackup/xtrabackup.cc57
3 files changed, 24 insertions, 60 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)