diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-25 10:43:38 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-25 10:43:38 +0200 |
commit | 00b70bbb51b9f2a3646c1ceedc6a27eeb1bdd6ac (patch) | |
tree | 69d6515f2f36a7774e4b8b06c2173dffa0ec6e6d /extra/mariabackup/xtrabackup.cc | |
parent | 7ab3db142bffa733587f6788c13b7d057a1bc13e (diff) | |
parent | a3da3c8a0b1113d941f837cce0615673b95fb9f2 (diff) | |
download | mariadb-git-00b70bbb51b9f2a3646c1ceedc6a27eeb1bdd6ac.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'extra/mariabackup/xtrabackup.cc')
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 80 |
1 files changed, 69 insertions, 11 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 8e2526d826e..70542a35514 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -238,7 +238,8 @@ long innobase_read_io_threads = 4; long innobase_write_io_threads = 4; longlong innobase_page_size = (1LL << 14); /* 16KB */ -char* innobase_buffer_pool_filename = NULL; +char *innobase_buffer_pool_filename = NULL; +char *buffer_pool_filename = NULL; /* The default values for the following char* start-up parameters are determined in innobase_init below: */ @@ -347,6 +348,7 @@ uint opt_lock_wait_timeout = 0; uint opt_lock_wait_threshold = 0; uint opt_debug_sleep_before_unlock = 0; uint opt_safe_slave_backup_timeout = 0; +uint opt_max_binlogs = UINT_MAX; const char *opt_history = NULL; @@ -1047,7 +1049,8 @@ enum options_xtrabackup OPT_BACKUP_ROCKSDB, OPT_XTRA_CHECK_PRIVILEGES, OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION, - OPT_INNODB_FORCE_RECOVERY + OPT_INNODB_FORCE_RECOVERY, + OPT_MAX_BINLOGS }; struct my_option xb_client_options[]= { @@ -1450,6 +1453,17 @@ struct my_option xb_client_options[]= { &opt_log_innodb_page_corruption, &opt_log_innodb_page_corruption, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sst_max_binlogs", OPT_MAX_BINLOGS, + "Number of recent binary logs to be included in the backup. " + "Setting this parameter to zero normally disables transmission " + "of binary logs to the joiner nodes during SST using Galera. " + "But sometimes a single current binlog can still be transmitted " + "to the joiner even with sst_max_binlogs=0, because it is " + "required for Galera to work properly with GTIDs support.", + (G_PTR *) &opt_max_binlogs, + (G_PTR *) &opt_max_binlogs, 0, GET_UINT, OPT_ARG, + UINT_MAX, 0, UINT_MAX, 0, 1, 0}, + #define MYSQL_CLIENT #include "sslopt-longopts.h" #undef MYSQL_CLIENT @@ -1499,14 +1513,14 @@ struct my_option xb_server_options[] = (G_PTR*)&opt_encrypted_backup, 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0}, - {"log", OPT_LOG, "Ignored option for MySQL option compatibility", + {"log", OPT_LOG, "Ignored option for MySQL option compatibility", (G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"log_bin", OPT_LOG, "Base name for the log sequence", + {"log_bin", OPT_LOG, "Base name for the log sequence", &opt_log_bin, &opt_log_bin, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"innodb", OPT_INNODB, "Ignored option for MySQL option compatibility", + {"innodb", OPT_INNODB, "Ignored option for MySQL option compatibility", (G_PTR*) &innobase_ignored_opt, (G_PTR*) &innobase_ignored_opt, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #ifdef BTR_CUR_HASH_ADAPT @@ -1628,10 +1642,10 @@ struct my_option xb_server_options[] = 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"plugin-dir", OPT_PLUGIN_DIR, - "Server plugin directory. Used to load encryption plugin during 'prepare' phase." - "Has no effect in the 'backup' phase (plugin directory during backup is the same as server's)", - &xb_plugin_dir, &xb_plugin_dir, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, + "Server plugin directory. Used to load encryption plugin during 'prepare' phase." + "Has no effect in the 'backup' phase (plugin directory during backup is the same as server's)", + &xb_plugin_dir, &xb_plugin_dir, + 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, {"innodb-log-checksums", OPT_INNODB_LOG_CHECKSUMS, "Whether to require checksums for InnoDB redo log blocks", @@ -1653,12 +1667,12 @@ struct my_option xb_server_options[] = &xb_rocksdb_datadir, &xb_rocksdb_datadir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - { "rocksdb-backup", OPT_BACKUP_ROCKSDB, "Backup rocksdb data, if rocksdb plugin is installed." + {"rocksdb-backup", OPT_BACKUP_ROCKSDB, "Backup rocksdb data, if rocksdb plugin is installed." "Used only with --backup option. Can be useful for partial backups, to exclude all rocksdb data", &xb_backup_rocksdb, &xb_backup_rocksdb, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, - {"check-privileges", OPT_XTRA_CHECK_PRIVILEGES, "Check database user " + {"check-privileges", OPT_XTRA_CHECK_PRIVILEGES, "Check database user " "privileges fro the backup user", &opt_check_privileges, &opt_check_privileges, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, @@ -6208,6 +6222,44 @@ check_all_privileges() } } +static +void +xb_init_buffer_pool(const char * filename) +{ + if (filename && +#ifdef _WIN32 + (filename[0] == '/' || + filename[0] == '\\' || + strchr(filename, ':'))) +#else + filename[0] == FN_LIBCHAR) +#endif + { + buffer_pool_filename = strdup(filename); + } else { + char filepath[FN_REFLEN]; + char *dst_dir = + (innobase_data_home_dir && *innobase_data_home_dir) ? + innobase_data_home_dir : mysql_data_home; + size_t dir_length; + if (dst_dir && *dst_dir) { + dir_length = strlen(dst_dir); + while (IS_TRAILING_SLASH(dst_dir, dir_length)) { + dir_length--; + } + memcpy(filepath, dst_dir, dir_length); + } + else { + filepath[0] = '.'; + dir_length = 1; + } + snprintf(filepath + dir_length, + sizeof(filepath) - dir_length, "%c%s", FN_LIBCHAR, + filename ? filename : "ib_buffer_pool"); + buffer_pool_filename = strdup(filepath); + } +} + bool xb_init() { @@ -6272,11 +6324,15 @@ xb_init() if (!get_mysql_vars(mysql_connection)) { return(false); } + xb_init_buffer_pool(buffer_pool_filename); + if (opt_check_privileges) { check_all_privileges(); } history_start_time = time(NULL); + } else { + xb_init_buffer_pool(innobase_buffer_pool_filename); } return(true); @@ -6570,6 +6626,8 @@ int main(int argc, char **argv) free_error_messages(); mysql_mutex_destroy(&LOCK_error_log); + free(buffer_pool_filename); + if (status == EXIT_SUCCESS) { msg("completed OK!"); } |