diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-25 21:57:52 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-25 21:57:52 +0300 |
commit | fbe2712705d464bf8488df249c36115e2c1f63f7 (patch) | |
tree | 274e728c719611769288afcb10f79549f6e11f8c /extra | |
parent | 62903434eb009cb0bcd5003b0a45914bd4c09886 (diff) | |
parent | a19782522b1eac52d72f5e787b5d96f1fd1a2cb7 (diff) | |
download | mariadb-git-fbe2712705d464bf8488df249c36115e2c1f63f7.tar.gz |
Merge 10.4 into 10.5
The functional changes of commit 5836191c8f0658d5d75484766fdcc3d838b0a5c1
(MDEV-21168) are omitted due to MDEV-742 having addressed the issue.
Diffstat (limited to 'extra')
-rw-r--r-- | extra/crc32-vpmsum/clang_workaround.h | 15 | ||||
-rw-r--r-- | extra/mariabackup/backup_mysql.cc | 332 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 785 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.h | 10 | ||||
-rw-r--r-- | extra/resolve_stack_dump.c | 45 |
5 files changed, 636 insertions, 551 deletions
diff --git a/extra/crc32-vpmsum/clang_workaround.h b/extra/crc32-vpmsum/clang_workaround.h index b5e7dae011c..915f7e5282f 100644 --- a/extra/crc32-vpmsum/clang_workaround.h +++ b/extra/crc32-vpmsum/clang_workaround.h @@ -39,7 +39,12 @@ __vector unsigned long long __builtin_pack_vector (unsigned long __a, return __v; } -#ifndef vec_xxpermdi +/* + * Clang 7 changed the behavior of vec_xxpermdi in order to provide the same + * behavior of GCC. That means code adapted to Clang >= 7 does not work on + * Clang <= 6. So, fallback to __builtin_unpack_vector() on Clang <= 6. + */ +#if !defined vec_xxpermdi || __clang_major__ <= 6 static inline unsigned long __builtin_unpack_vector (__vector unsigned long long __v, @@ -62,9 +67,9 @@ static inline unsigned long __builtin_unpack_vector_0 (__vector unsigned long long __v) { #if defined(__BIG_ENDIAN__) - return vec_xxpermdi(__v, __v, 0x0)[1]; - #else return vec_xxpermdi(__v, __v, 0x0)[0]; + #else + return vec_xxpermdi(__v, __v, 0x3)[0]; #endif } @@ -72,9 +77,9 @@ static inline unsigned long __builtin_unpack_vector_1 (__vector unsigned long long __v) { #if defined(__BIG_ENDIAN__) - return vec_xxpermdi(__v, __v, 0x3)[1]; - #else return vec_xxpermdi(__v, __v, 0x3)[0]; + #else + return vec_xxpermdi(__v, __v, 0x0)[0]; #endif } #endif /* vec_xxpermdi */ diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 6c13079a8fc..a3bd111745c 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -327,193 +327,203 @@ check_server_version(unsigned long version_number, /*********************************************************************//** Receive options important for XtraBackup from MySQL server. @return true on success. */ -bool -get_mysql_vars(MYSQL *connection) +bool get_mysql_vars(MYSQL *connection) { - char *gtid_mode_var = NULL; - char *version_var = NULL; - char *version_comment_var = NULL; - char *innodb_version_var = NULL; - char *have_backup_locks_var = NULL; - char *log_bin_var = NULL; - char *lock_wait_timeout_var= NULL; - char *wsrep_on_var = NULL; - char *slave_parallel_workers_var = NULL; - char *gtid_slave_pos_var = NULL; - char *innodb_buffer_pool_filename_var = NULL; - char *datadir_var = NULL; - char *innodb_log_group_home_dir_var = NULL; - char *innodb_log_file_size_var = NULL; - char *innodb_log_files_in_group_var = NULL; - char *innodb_data_file_path_var = NULL; - char *innodb_data_home_dir_var = NULL; - char *innodb_undo_directory_var = NULL; - char *innodb_page_size_var = NULL; - char *innodb_undo_tablespaces_var = NULL; - char *page_zip_level_var = NULL; - char *endptr; - unsigned long server_version = mysql_get_server_version(connection); - - bool ret = true; - - mysql_variable mysql_vars[] = { - {"have_backup_locks", &have_backup_locks_var}, - {"log_bin", &log_bin_var}, - {"lock_wait_timeout", &lock_wait_timeout_var}, - {"gtid_mode", >id_mode_var}, - {"version", &version_var}, - {"version_comment", &version_comment_var}, - {"innodb_version", &innodb_version_var}, - {"wsrep_on", &wsrep_on_var}, - {"slave_parallel_workers", &slave_parallel_workers_var}, - {"gtid_slave_pos", >id_slave_pos_var}, - {"innodb_buffer_pool_filename", - &innodb_buffer_pool_filename_var}, - {"datadir", &datadir_var}, - {"innodb_log_group_home_dir", &innodb_log_group_home_dir_var}, - {"innodb_log_file_size", &innodb_log_file_size_var}, - {"innodb_log_files_in_group", &innodb_log_files_in_group_var}, - {"innodb_data_file_path", &innodb_data_file_path_var}, - {"innodb_data_home_dir", &innodb_data_home_dir_var}, - {"innodb_undo_directory", &innodb_undo_directory_var}, - {"innodb_page_size", &innodb_page_size_var}, - {"innodb_undo_tablespaces", &innodb_undo_tablespaces_var}, - {"innodb_compression_level", &page_zip_level_var}, - {NULL, NULL} - }; - - read_mysql_variables(connection, "SHOW VARIABLES", - mysql_vars, true); - - if (have_backup_locks_var != NULL && !opt_no_backup_locks) { - have_backup_locks = true; - } + char *gtid_mode_var= NULL; + char *version_var= NULL; + char *version_comment_var= NULL; + char *innodb_version_var= NULL; + char *have_backup_locks_var= NULL; + char *log_bin_var= NULL; + char *lock_wait_timeout_var= NULL; + char *wsrep_on_var= NULL; + char *slave_parallel_workers_var= NULL; + char *gtid_slave_pos_var= NULL; + char *innodb_buffer_pool_filename_var= NULL; + char *datadir_var= NULL; + char *innodb_log_group_home_dir_var= NULL; + char *innodb_log_file_size_var= NULL; + char *innodb_log_files_in_group_var= NULL; + char *innodb_data_file_path_var= NULL; + char *innodb_data_home_dir_var= NULL; + char *innodb_undo_directory_var= NULL; + char *innodb_page_size_var= NULL; + char *innodb_undo_tablespaces_var= NULL; + char *page_zip_level_var= NULL; + char *ignore_db_dirs= NULL; + char *endptr; + unsigned long server_version= mysql_get_server_version(connection); + + bool ret= true; + + mysql_variable mysql_vars[]= { + {"have_backup_locks", &have_backup_locks_var}, + {"log_bin", &log_bin_var}, + {"lock_wait_timeout", &lock_wait_timeout_var}, + {"gtid_mode", >id_mode_var}, + {"version", &version_var}, + {"version_comment", &version_comment_var}, + {"innodb_version", &innodb_version_var}, + {"wsrep_on", &wsrep_on_var}, + {"slave_parallel_workers", &slave_parallel_workers_var}, + {"gtid_slave_pos", >id_slave_pos_var}, + {"innodb_buffer_pool_filename", &innodb_buffer_pool_filename_var}, + {"datadir", &datadir_var}, + {"innodb_log_group_home_dir", &innodb_log_group_home_dir_var}, + {"innodb_log_file_size", &innodb_log_file_size_var}, + {"innodb_log_files_in_group", &innodb_log_files_in_group_var}, + {"innodb_data_file_path", &innodb_data_file_path_var}, + {"innodb_data_home_dir", &innodb_data_home_dir_var}, + {"innodb_undo_directory", &innodb_undo_directory_var}, + {"innodb_page_size", &innodb_page_size_var}, + {"innodb_undo_tablespaces", &innodb_undo_tablespaces_var}, + {"innodb_compression_level", &page_zip_level_var}, + {"ignore_db_dirs", &ignore_db_dirs}, + {NULL, NULL}}; + + read_mysql_variables(connection, "SHOW VARIABLES", mysql_vars, true); + + if (have_backup_locks_var != NULL && !opt_no_backup_locks) + { + have_backup_locks= true; + } - if (opt_binlog_info == BINLOG_INFO_AUTO) { - if (log_bin_var != NULL && !strcmp(log_bin_var, "ON")) - opt_binlog_info = BINLOG_INFO_ON; - else - opt_binlog_info = BINLOG_INFO_OFF; - } + if (opt_binlog_info == BINLOG_INFO_AUTO) + { + if (log_bin_var != NULL && !strcmp(log_bin_var, "ON")) + opt_binlog_info= BINLOG_INFO_ON; + else + opt_binlog_info= BINLOG_INFO_OFF; + } - if (lock_wait_timeout_var != NULL) { - have_lock_wait_timeout = true; - } + if (lock_wait_timeout_var != NULL) + { + have_lock_wait_timeout= true; + } - if (wsrep_on_var != NULL) { - have_galera_enabled = true; - } + if (wsrep_on_var != NULL) + { + have_galera_enabled= true; + } - /* Check server version compatibility and detect server flavor */ + /* Check server version compatibility and detect server flavor */ - if (!(ret = check_server_version(server_version, version_var, - version_comment_var, - innodb_version_var))) { - goto out; - } + if (!(ret= check_server_version(server_version, version_var, + version_comment_var, innodb_version_var))) + { + goto out; + } - if (server_version > 50500) { - have_flush_engine_logs = true; - } + if (server_version > 50500) + { + have_flush_engine_logs= true; + } - if (slave_parallel_workers_var != NULL - && atoi(slave_parallel_workers_var) > 0) { - have_multi_threaded_slave = true; - } + if (slave_parallel_workers_var != NULL && + atoi(slave_parallel_workers_var) > 0) + { + have_multi_threaded_slave= true; + } - if (innodb_buffer_pool_filename_var != NULL) { - buffer_pool_filename = strdup(innodb_buffer_pool_filename_var); - } + if (innodb_buffer_pool_filename_var != NULL) + { + buffer_pool_filename= strdup(innodb_buffer_pool_filename_var); + } - if ((gtid_mode_var && strcmp(gtid_mode_var, "ON") == 0) || - (gtid_slave_pos_var && *gtid_slave_pos_var)) { - have_gtid_slave = true; - } + if ((gtid_mode_var && strcmp(gtid_mode_var, "ON") == 0) || + (gtid_slave_pos_var && *gtid_slave_pos_var)) + { + have_gtid_slave= true; + } - msg("Using server version %s", version_var); + msg("Using server version %s", version_var); - if (!(ret = detect_mysql_capabilities_for_backup())) { - goto out; - } + if (!(ret= detect_mysql_capabilities_for_backup())) + { + goto out; + } - /* make sure datadir value is the same in configuration file */ - if (check_if_param_set("datadir")) { - if (!directory_exists(mysql_data_home, false)) { - msg("Warning: option 'datadir' points to " - "nonexistent directory '%s'", mysql_data_home); - } - if (!directory_exists(datadir_var, false)) { - msg("Warning: MySQL variable 'datadir' points to " - "nonexistent directory '%s'", datadir_var); - } - if (!equal_paths(mysql_data_home, datadir_var)) { - msg("Warning: option 'datadir' has different " - "values:\n" - " '%s' in defaults file\n" - " '%s' in SHOW VARIABLES", - mysql_data_home, datadir_var); - } - } + /* make sure datadir value is the same in configuration file */ + if (check_if_param_set("datadir")) + { + if (!directory_exists(mysql_data_home, false)) + { + msg("Warning: option 'datadir' points to " + "nonexistent directory '%s'", + mysql_data_home); + } + if (!directory_exists(datadir_var, false)) + { + msg("Warning: MySQL variable 'datadir' points to " + "nonexistent directory '%s'", + datadir_var); + } + if (!equal_paths(mysql_data_home, datadir_var)) + { + msg("Warning: option 'datadir' has different " + "values:\n" + " '%s' in defaults file\n" + " '%s' in SHOW VARIABLES", + mysql_data_home, datadir_var); + } + } - /* get some default values is they are missing from my.cnf */ - if (datadir_var && *datadir_var) { - strmake(mysql_real_data_home, datadir_var, FN_REFLEN - 1); - mysql_data_home= mysql_real_data_home; - } + /* get some default values is they are missing from my.cnf */ + if (datadir_var && *datadir_var) + { + strmake(mysql_real_data_home, datadir_var, FN_REFLEN - 1); + mysql_data_home= mysql_real_data_home; + } - if (innodb_data_file_path_var && *innodb_data_file_path_var) { - innobase_data_file_path = my_strdup(PSI_NOT_INSTRUMENTED, - innodb_data_file_path_var, MYF(MY_FAE)); - } + if (innodb_data_file_path_var && *innodb_data_file_path_var) + innobase_data_file_path= my_strdup(PSI_NOT_INSTRUMENTED, + innodb_data_file_path_var, MYF(MY_FAE)); - if (innodb_data_home_dir_var) { - innobase_data_home_dir = my_strdup(PSI_NOT_INSTRUMENTED, - innodb_data_home_dir_var, MYF(MY_FAE)); - } + if (innodb_data_home_dir_var) + innobase_data_home_dir= my_strdup(PSI_NOT_INSTRUMENTED, + innodb_data_home_dir_var, MYF(MY_FAE)); - if (innodb_log_group_home_dir_var - && *innodb_log_group_home_dir_var) { - srv_log_group_home_dir = my_strdup(PSI_NOT_INSTRUMENTED, - innodb_log_group_home_dir_var, MYF(MY_FAE)); - } + if (innodb_log_group_home_dir_var && *innodb_log_group_home_dir_var) + srv_log_group_home_dir= my_strdup(PSI_NOT_INSTRUMENTED, + innodb_log_group_home_dir_var, + MYF(MY_FAE)); - if (innodb_undo_directory_var && *innodb_undo_directory_var) { - srv_undo_dir = my_strdup(PSI_NOT_INSTRUMENTED, - innodb_undo_directory_var, MYF(MY_FAE)); - } + if (innodb_undo_directory_var && *innodb_undo_directory_var) + srv_undo_dir= my_strdup(PSI_NOT_INSTRUMENTED, innodb_undo_directory_var, + MYF(MY_FAE)); - if (innodb_log_files_in_group_var) { - // deprecated - } + if (innodb_log_file_size_var) + { + srv_log_file_size= strtoll(innodb_log_file_size_var, &endptr, 10); + ut_ad(*endptr == 0); + } - if (innodb_log_file_size_var) { - srv_log_file_size = strtoll( - innodb_log_file_size_var, &endptr, 10); - ut_ad(*endptr == 0); - } + if (innodb_page_size_var) + { + innobase_page_size= strtoll(innodb_page_size_var, &endptr, 10); + ut_ad(*endptr == 0); + } - if (innodb_page_size_var) { - innobase_page_size = strtoll( - innodb_page_size_var, &endptr, 10); - ut_ad(*endptr == 0); - } + if (innodb_undo_tablespaces_var) + { + srv_undo_tablespaces= strtoul(innodb_undo_tablespaces_var, &endptr, 10); + ut_ad(*endptr == 0); + } - if (innodb_undo_tablespaces_var) { - srv_undo_tablespaces = strtoul(innodb_undo_tablespaces_var, - &endptr, 10); - ut_ad(*endptr == 0); - } + if (page_zip_level_var != NULL) + { + page_zip_level= static_cast<uint>(strtoul(page_zip_level_var, &endptr, + 10)); + ut_ad(*endptr == 0); + } - if (page_zip_level_var != NULL) { - page_zip_level = static_cast<uint>(strtoul(page_zip_level_var, - &endptr, 10)); - ut_ad(*endptr == 0); - } + if (ignore_db_dirs) + xb_load_list_string(ignore_db_dirs, ",", register_ignore_db_dirs_filter); out: - free_mysql_variables(mysql_vars); + free_mysql_variables(mysql_vars); - return(ret); + return (ret); } /*********************************************************************//** diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 23d9ae11de7..1cc13d89036 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -72,6 +72,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include <srv0start.h> #include "trx0sys.h" #include <buf0dblwr.h> +#include "ha_innodb.h" #include <list> #include <sstream> @@ -703,8 +704,8 @@ typedef struct { enum options_xtrabackup { - OPT_XTRA_TARGET_DIR = 1000, /* make sure it is larger - than OPT_MAX_CLIENT_OPTION */ + OPT_XTRA_TARGET_DIR= 1000, /* make sure it is larger + than OPT_MAX_CLIENT_OPTION */ OPT_XTRA_BACKUP, OPT_XTRA_PREPARE, OPT_XTRA_EXPORT, @@ -800,359 +801,399 @@ enum options_xtrabackup OPT_XTRA_CHECK_PRIVILEGES }; - -struct my_option xb_client_options[] = -{ - {"verbose", 'V', "display verbose output", - (G_PTR*) &verbose, (G_PTR*) &verbose, 0, GET_BOOL, NO_ARG, - FALSE, 0, 0, 0, 0, 0}, - {"version", 'v', "print xtrabackup version information", - (G_PTR *) &xtrabackup_version, (G_PTR *) &xtrabackup_version, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, - {"target-dir", OPT_XTRA_TARGET_DIR, "destination directory", (G_PTR*) &xtrabackup_target_dir, - (G_PTR*) &xtrabackup_target_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"backup", OPT_XTRA_BACKUP, "take backup to target-dir", - (G_PTR*) &xtrabackup_backup, (G_PTR*) &xtrabackup_backup, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"prepare", OPT_XTRA_PREPARE, "prepare a backup for starting mysql server on the backup.", - (G_PTR*) &xtrabackup_prepare, (G_PTR*) &xtrabackup_prepare, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"export", OPT_XTRA_EXPORT, "create files to import to another database when prepare.", - (G_PTR*) &xtrabackup_export, (G_PTR*) &xtrabackup_export, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"print-param", OPT_XTRA_PRINT_PARAM, "print parameter of mysqld needed for copyback.", - (G_PTR*) &xtrabackup_print_param, (G_PTR*) &xtrabackup_print_param, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"use-memory", OPT_XTRA_USE_MEMORY, "The value is used instead of buffer_pool_size", - (G_PTR*) &xtrabackup_use_memory, (G_PTR*) &xtrabackup_use_memory, - 0, GET_LL, REQUIRED_ARG, 100*1024*1024L, 1024*1024L, LONGLONG_MAX, 0, - 1024*1024L, 0}, - {"throttle", OPT_XTRA_THROTTLE, "limit count of IO operations (pairs of read&write) per second to IOS values (for '--backup')", - (G_PTR*) &xtrabackup_throttle, (G_PTR*) &xtrabackup_throttle, - 0, GET_LONG, REQUIRED_ARG, 0, 0, LONG_MAX, 0, 1, 0}, - {"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-copy-interval", OPT_XTRA_LOG_COPY_INTERVAL, "time interval between checks done by log copying thread in milliseconds (default is 1 second).", - (G_PTR*) &xtrabackup_log_copy_interval, (G_PTR*) &xtrabackup_log_copy_interval, - 0, GET_LONG, REQUIRED_ARG, 1000, 0, LONG_MAX, 0, 1, 0}, - {"extra-lsndir", OPT_XTRA_EXTRA_LSNDIR, "(for --backup): save an extra copy of the xtrabackup_checkpoints file in this directory.", - (G_PTR*) &xtrabackup_extra_lsndir, (G_PTR*) &xtrabackup_extra_lsndir, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"incremental-lsn", OPT_XTRA_INCREMENTAL, "(for --backup): copy only .ibd pages newer than specified LSN 'high:low'. ##ATTENTION##: If a wrong LSN value is specified, it is impossible to diagnose this, causing the backup to be unusable. Be careful!", - (G_PTR*) &xtrabackup_incremental, (G_PTR*) &xtrabackup_incremental, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"incremental-basedir", OPT_XTRA_INCREMENTAL_BASEDIR, "(for --backup): copy only .ibd pages newer than backup at specified directory.", - (G_PTR*) &xtrabackup_incremental_basedir, (G_PTR*) &xtrabackup_incremental_basedir, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"incremental-dir", OPT_XTRA_INCREMENTAL_DIR, "(for --prepare): apply .delta files and logfile in the specified directory.", - (G_PTR*) &xtrabackup_incremental_dir, (G_PTR*) &xtrabackup_incremental_dir, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"tables", OPT_XTRA_TABLES, "filtering by regexp for table names.", - (G_PTR*) &xtrabackup_tables, (G_PTR*) &xtrabackup_tables, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"tables_file", OPT_XTRA_TABLES_FILE, "filtering by list of the exact database.table name in the file.", - (G_PTR*) &xtrabackup_tables_file, (G_PTR*) &xtrabackup_tables_file, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"databases", OPT_XTRA_DATABASES, "filtering by list of databases.", - (G_PTR*) &xtrabackup_databases, (G_PTR*) &xtrabackup_databases, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"databases_file", OPT_XTRA_DATABASES_FILE, - "filtering by list of databases in the file.", - (G_PTR*) &xtrabackup_databases_file, (G_PTR*) &xtrabackup_databases_file, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"tables-exclude", OPT_XTRA_TABLES_EXCLUDE, "filtering by regexp for table names. " - "Operates the same way as --tables, but matched names are excluded from backup. " - "Note that this option has a higher priority than --tables.", - (G_PTR*) &xtrabackup_tables_exclude, (G_PTR*) &xtrabackup_tables_exclude, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"databases-exclude", OPT_XTRA_DATABASES_EXCLUDE, "Excluding databases based on name, " - "Operates the same way as --databases, but matched names are excluded from backup. " - "Note that this option has a higher priority than --databases.", - (G_PTR*) &xtrabackup_databases_exclude, (G_PTR*) &xtrabackup_databases_exclude, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"stream", OPT_XTRA_STREAM, "Stream all backup files to the standard output " - "in the specified format." - "Supported format is 'mbstream' or 'xbstream'." - , - (G_PTR*) &xtrabackup_stream_str, (G_PTR*) &xtrabackup_stream_str, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"compress", OPT_XTRA_COMPRESS, "Compress individual backup files using the " - "specified compression algorithm. Currently the only supported algorithm " - "is 'quicklz'. It is also the default algorithm, i.e. the one used when " - "--compress is used without an argument.", - (G_PTR*) &xtrabackup_compress_alg, (G_PTR*) &xtrabackup_compress_alg, 0, - GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - - {"compress-threads", OPT_XTRA_COMPRESS_THREADS, - "Number of threads for parallel data compression. The default value is 1.", - (G_PTR*) &xtrabackup_compress_threads, (G_PTR*) &xtrabackup_compress_threads, - 0, GET_UINT, REQUIRED_ARG, 1, 1, UINT_MAX, 0, 0, 0}, - - {"compress-chunk-size", OPT_XTRA_COMPRESS_CHUNK_SIZE, - "Size of working buffer(s) for compression threads in bytes. The default value is 64K.", - (G_PTR*) &xtrabackup_compress_chunk_size, (G_PTR*) &xtrabackup_compress_chunk_size, - 0, GET_ULL, REQUIRED_ARG, (1 << 16), 1024, ULONGLONG_MAX, 0, 0, 0}, - - {"incremental-force-scan", OPT_XTRA_INCREMENTAL_FORCE_SCAN, - "Perform a full-scan incremental backup even in the presence of changed " - "page bitmap data", - (G_PTR*)&xtrabackup_incremental_force_scan, - (G_PTR*)&xtrabackup_incremental_force_scan, 0, GET_BOOL, NO_ARG, - 0, 0, 0, 0, 0, 0}, - - - {"close_files", OPT_CLOSE_FILES, "do not keep files opened. Use at your own " - "risk.", (G_PTR*) &xb_close_files, (G_PTR*) &xb_close_files, 0, GET_BOOL, - NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"core-file", OPT_CORE_FILE, "Write core on fatal signals", 0, 0, 0, - GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - - - {"copy-back", OPT_COPY_BACK, "Copy all the files in a previously made " - "backup from the backup directory to their original locations.", - (uchar *) &xtrabackup_copy_back, (uchar *) &xtrabackup_copy_back, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"move-back", OPT_MOVE_BACK, "Move all the files in a previously made " - "backup from the backup directory to the actual datadir location. " - "Use with caution, as it removes backup files.", - (uchar *) &xtrabackup_move_back, (uchar *) &xtrabackup_move_back, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"galera-info", OPT_GALERA_INFO, "This options creates the " - "xtrabackup_galera_info file which contains the local node state at " - "the time of the backup. Option should be used when performing the " - "backup of MariaDB Galera Cluster. Has no effect when backup locks " - "are used to create the backup.", - (uchar *) &opt_galera_info, (uchar *) &opt_galera_info, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"slave-info", OPT_SLAVE_INFO, "This option is useful when backing " - "up a replication slave server. It prints the binary log position " - "and name of the master server. It also writes this information to " - "the \"xtrabackup_slave_info\" file as a \"CHANGE MASTER\" command. " - "A new slave for this master can be set up by starting a slave server " - "on this backup and issuing a \"CHANGE MASTER\" command with the " - "binary log position saved in the \"xtrabackup_slave_info\" file.", - (uchar *) &opt_slave_info, (uchar *) &opt_slave_info, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"no-lock", OPT_NO_LOCK, "Use this option to disable table lock " - "with \"FLUSH TABLES WITH READ LOCK\". Use it only if ALL your " - "tables are InnoDB and you DO NOT CARE about the binary log " - "position of the backup. This option shouldn't be used if there " - "are any DDL statements being executed or if any updates are " - "happening on non-InnoDB tables (this includes the system MyISAM " - "tables in the mysql database), otherwise it could lead to an " - "inconsistent backup. If you are considering to use --no-lock " - "because your backups are failing to acquire the lock, this could " - "be because of incoming replication events preventing the lock " - "from succeeding. Please try using --safe-slave-backup to " - "momentarily stop the replication slave thread, this may help " - "the backup to succeed and you then don't need to resort to " - "using this option.", - (uchar *) &opt_no_lock, (uchar *) &opt_no_lock, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"safe-slave-backup", OPT_SAFE_SLAVE_BACKUP, "Stop slave SQL thread " - "and wait to start backup until Slave_open_temp_tables in " - "\"SHOW STATUS\" is zero. If there are no open temporary tables, " - "the backup will take place, otherwise the SQL thread will be " - "started and stopped until there are no open temporary tables. " - "The backup will fail if Slave_open_temp_tables does not become " - "zero after --safe-slave-backup-timeout seconds. The slave SQL " - "thread will be restarted when the backup finishes.", - (uchar *) &opt_safe_slave_backup, - (uchar *) &opt_safe_slave_backup, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"rsync", OPT_RSYNC, "Uses the rsync utility to optimize local file " - "transfers. When this option is specified, innobackupex uses rsync " - "to copy all non-InnoDB files instead of spawning a separate cp for " - "each file, which can be much faster for servers with a large number " - "of databases or tables. This option cannot be used together with " - "--stream.", - (uchar *) &opt_rsync, (uchar *) &opt_rsync, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"force-non-empty-directories", OPT_FORCE_NON_EMPTY_DIRS, "This " - "option, when specified, makes --copy-back or --move-back transfer " - "files to non-empty directories. Note that no existing files will be " - "overwritten. If --copy-back or --nove-back has to copy a file from " - "the backup directory which already exists in the destination " - "directory, it will still fail with an error.", - (uchar *) &opt_force_non_empty_dirs, - (uchar *) &opt_force_non_empty_dirs, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"no-version-check", OPT_NO_VERSION_CHECK, "This option disables the " - "version check which is enabled by the --version-check option.", - (uchar *) &opt_noversioncheck, - (uchar *) &opt_noversioncheck, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"no-backup-locks", OPT_NO_BACKUP_LOCKS, "This option controls if " - "backup locks should be used instead of FLUSH TABLES WITH READ LOCK " - "on the backup stage. The option has no effect when backup locks are " - "not supported by the server. This option is enabled by default, " - "disable with --no-backup-locks.", - (uchar *) &opt_no_backup_locks, - (uchar *) &opt_no_backup_locks, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"decompress", OPT_DECOMPRESS, "Decompresses all files with the .qp " - "extension in a backup previously made with the --compress option.", - (uchar *) &opt_decompress, - (uchar *) &opt_decompress, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"user", 'u', "This option specifies the MySQL username used " - "when connecting to the server, if that's not the current user. " - "The option accepts a string argument. See mysql --help for details.", - (uchar*) &opt_user, (uchar*) &opt_user, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"host", 'H', "This option specifies the host to use when " - "connecting to the database server with TCP/IP. The option accepts " - "a string argument. See mysql --help for details.", - (uchar*) &opt_host, (uchar*) &opt_host, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"port", 'P', "This option specifies the port to use when " - "connecting to the database server with TCP/IP. The option accepts " - "a string argument. See mysql --help for details.", - &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, - - {"password", 'p', "This option specifies the password to use " - "when connecting to the database. It accepts a string argument. " - "See mysql --help for details.", - 0, 0, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"protocol", OPT_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe, memory).", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"socket", 'S', "This option specifies the socket to use when " - "connecting to the local database server with a UNIX domain socket. " - "The option accepts a string argument. See mysql --help for details.", - (uchar*) &opt_socket, (uchar*) &opt_socket, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"incremental-history-name", OPT_INCREMENTAL_HISTORY_NAME, - "This option specifies the name of the backup series stored in the " - "PERCONA_SCHEMA.xtrabackup_history history record to base an " - "incremental backup on. Xtrabackup will search the history table " - "looking for the most recent (highest innodb_to_lsn), successful " - "backup in the series and take the to_lsn value to use as the " - "starting lsn for the incremental backup. This will be mutually " - "exclusive with --incremental-history-uuid, --incremental-basedir " - "and --incremental-lsn. If no valid lsn can be found (no series by " - "that name, no successful backups by that name) xtrabackup will " - "return with an error. It is used with the --incremental option.", - (uchar*) &opt_incremental_history_name, - (uchar*) &opt_incremental_history_name, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"incremental-history-uuid", OPT_INCREMENTAL_HISTORY_UUID, - "This option specifies the UUID of the specific history record " - "stored in the PERCONA_SCHEMA.xtrabackup_history to base an " - "incremental backup on. --incremental-history-name, " - "--incremental-basedir and --incremental-lsn. If no valid lsn can be " - "found (no success record with that uuid) xtrabackup will return " - "with an error. It is used with the --incremental option.", - (uchar*) &opt_incremental_history_uuid, - (uchar*) &opt_incremental_history_uuid, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"remove-original", OPT_REMOVE_ORIGINAL, "Remove .qp files after decompression.", - (uchar *) &opt_remove_original, - (uchar *) &opt_remove_original, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - - {"ftwrl-wait-query-type", OPT_LOCK_WAIT_QUERY_TYPE, - "This option specifies which types of queries are allowed to complete " - "before innobackupex will issue the global lock. Default is all.", - (uchar*) &opt_lock_wait_query_type, - (uchar*) &opt_lock_wait_query_type, &query_type_typelib, - GET_ENUM, REQUIRED_ARG, QUERY_TYPE_ALL, 0, 0, 0, 0, 0}, - - {"kill-long-query-type", OPT_KILL_LONG_QUERY_TYPE, - "This option specifies which types of queries should be killed to " - "unblock the global lock. Default is \"all\".", - (uchar*) &opt_kill_long_query_type, - (uchar*) &opt_kill_long_query_type, &query_type_typelib, - GET_ENUM, REQUIRED_ARG, QUERY_TYPE_SELECT, 0, 0, 0, 0, 0}, - - {"history", OPT_HISTORY, - "This option enables the tracking of backup history in the " - "PERCONA_SCHEMA.xtrabackup_history table. An optional history " - "series name may be specified that will be placed with the history " - "record for the current backup being taken.", - NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - - {"kill-long-queries-timeout", OPT_KILL_LONG_QUERIES_TIMEOUT, - "This option specifies the number of seconds innobackupex waits " - "between starting FLUSH TABLES WITH READ LOCK and killing those " - "queries that block it. Default is 0 seconds, which means " - "innobackupex will not attempt to kill any queries.", - (uchar*) &opt_kill_long_queries_timeout, - (uchar*) &opt_kill_long_queries_timeout, 0, GET_UINT, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"ftwrl-wait-timeout", OPT_LOCK_WAIT_TIMEOUT, - "This option specifies time in seconds that innobackupex should wait " - "for queries that would block FTWRL before running it. If there are " - "still such queries when the timeout expires, innobackupex terminates " - "with an error. Default is 0, in which case innobackupex does not " - "wait for queries to complete and starts FTWRL immediately.", - (uchar*) &opt_lock_wait_timeout, - (uchar*) &opt_lock_wait_timeout, 0, GET_UINT, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"ftwrl-wait-threshold", OPT_LOCK_WAIT_THRESHOLD, - "This option specifies the query run time threshold which is used by " - "innobackupex to detect long-running queries with a non-zero value " - "of --ftwrl-wait-timeout. FTWRL is not started until such " - "long-running queries exist. This option has no effect if " - "--ftwrl-wait-timeout is 0. Default value is 60 seconds.", - (uchar*) &opt_lock_wait_threshold, - (uchar*) &opt_lock_wait_threshold, 0, GET_UINT, - REQUIRED_ARG, 60, 0, 0, 0, 0, 0}, - - {"debug-sleep-before-unlock", OPT_DEBUG_SLEEP_BEFORE_UNLOCK, - "This is a debug-only option used by the XtraBackup test suite.", - (uchar*) &opt_debug_sleep_before_unlock, - (uchar*) &opt_debug_sleep_before_unlock, 0, GET_UINT, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - - {"safe-slave-backup-timeout", OPT_SAFE_SLAVE_BACKUP_TIMEOUT, - "How many seconds --safe-slave-backup should wait for " - "Slave_open_temp_tables to become zero. (default 300)", - (uchar*) &opt_safe_slave_backup_timeout, - (uchar*) &opt_safe_slave_backup_timeout, 0, GET_UINT, - REQUIRED_ARG, 300, 0, 0, 0, 0, 0}, - - {"binlog-info", OPT_BINLOG_INFO, - "This option controls how XtraBackup should retrieve server's binary log " - "coordinates corresponding to the backup. Possible values are OFF, ON, " - "LOCKLESS and AUTO. See the XtraBackup manual for more information", - &opt_binlog_info, &opt_binlog_info, - &binlog_info_typelib, GET_ENUM, OPT_ARG, BINLOG_INFO_AUTO, 0, 0, 0, 0, 0}, - - {"secure-auth", OPT_XB_SECURE_AUTH, "Refuse client connecting to server if it" - " uses old (pre-4.1.1) protocol.", &opt_secure_auth, - &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, +struct my_option xb_client_options[]= { + {"verbose", 'V', "display verbose output", (G_PTR *) &verbose, + (G_PTR *) &verbose, 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0}, + {"version", 'v', "print xtrabackup version information", + (G_PTR *) &xtrabackup_version, (G_PTR *) &xtrabackup_version, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"target-dir", OPT_XTRA_TARGET_DIR, "destination directory", + (G_PTR *) &xtrabackup_target_dir, (G_PTR *) &xtrabackup_target_dir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"backup", OPT_XTRA_BACKUP, "take backup to target-dir", + (G_PTR *) &xtrabackup_backup, (G_PTR *) &xtrabackup_backup, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"prepare", OPT_XTRA_PREPARE, + "prepare a backup for starting mysql server on the backup.", + (G_PTR *) &xtrabackup_prepare, (G_PTR *) &xtrabackup_prepare, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"export", OPT_XTRA_EXPORT, + "create files to import to another database when prepare.", + (G_PTR *) &xtrabackup_export, (G_PTR *) &xtrabackup_export, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + {"print-param", OPT_XTRA_PRINT_PARAM, + "print parameter of mysqld needed for copyback.", + (G_PTR *) &xtrabackup_print_param, (G_PTR *) &xtrabackup_print_param, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"use-memory", OPT_XTRA_USE_MEMORY, + "The value is used instead of buffer_pool_size", + (G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0, + GET_LL, REQUIRED_ARG, 100 * 1024 * 1024L, 1024 * 1024L, LONGLONG_MAX, 0, + 1024 * 1024L, 0}, + {"throttle", OPT_XTRA_THROTTLE, + "limit count of IO operations (pairs of read&write) per second to IOS " + "values (for '--backup')", + (G_PTR *) &xtrabackup_throttle, (G_PTR *) &xtrabackup_throttle, 0, + GET_LONG, REQUIRED_ARG, 0, 0, LONG_MAX, 0, 1, 0}, + {"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-copy-interval", OPT_XTRA_LOG_COPY_INTERVAL, + "time interval between checks done by log copying thread in milliseconds " + "(default is 1 second).", + (G_PTR *) &xtrabackup_log_copy_interval, + (G_PTR *) &xtrabackup_log_copy_interval, 0, GET_LONG, REQUIRED_ARG, 1000, + 0, LONG_MAX, 0, 1, 0}, + {"extra-lsndir", OPT_XTRA_EXTRA_LSNDIR, + "(for --backup): save an extra copy of the xtrabackup_checkpoints file " + "in this directory.", + (G_PTR *) &xtrabackup_extra_lsndir, (G_PTR *) &xtrabackup_extra_lsndir, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"incremental-lsn", OPT_XTRA_INCREMENTAL, + "(for --backup): copy only .ibd pages newer than specified LSN " + "'high:low'. ##ATTENTION##: If a wrong LSN value is specified, it is " + "impossible to diagnose this, causing the backup to be unusable. Be " + "careful!", + (G_PTR *) &xtrabackup_incremental, (G_PTR *) &xtrabackup_incremental, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"incremental-basedir", OPT_XTRA_INCREMENTAL_BASEDIR, + "(for --backup): copy only .ibd pages newer than backup at specified " + "directory.", + (G_PTR *) &xtrabackup_incremental_basedir, + (G_PTR *) &xtrabackup_incremental_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + {"incremental-dir", OPT_XTRA_INCREMENTAL_DIR, + "(for --prepare): apply .delta files and logfile in the specified " + "directory.", + (G_PTR *) &xtrabackup_incremental_dir, + (G_PTR *) &xtrabackup_incremental_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"tables", OPT_XTRA_TABLES, "filtering by regexp for table names.", + (G_PTR *) &xtrabackup_tables, (G_PTR *) &xtrabackup_tables, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"tables_file", OPT_XTRA_TABLES_FILE, + "filtering by list of the exact database.table name in the file.", + (G_PTR *) &xtrabackup_tables_file, (G_PTR *) &xtrabackup_tables_file, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"databases", OPT_XTRA_DATABASES, "filtering by list of databases.", + (G_PTR *) &xtrabackup_databases, (G_PTR *) &xtrabackup_databases, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"databases_file", OPT_XTRA_DATABASES_FILE, + "filtering by list of databases in the file.", + (G_PTR *) &xtrabackup_databases_file, + (G_PTR *) &xtrabackup_databases_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"tables-exclude", OPT_XTRA_TABLES_EXCLUDE, + "filtering by regexp for table names. " + "Operates the same way as --tables, but matched names are excluded from " + "backup. " + "Note that this option has a higher priority than --tables.", + (G_PTR *) &xtrabackup_tables_exclude, + (G_PTR *) &xtrabackup_tables_exclude, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, + 0, 0, 0}, + {"databases-exclude", OPT_XTRA_DATABASES_EXCLUDE, + "Excluding databases based on name, " + "Operates the same way as --databases, but matched names are excluded " + "from backup. " + "Note that this option has a higher priority than --databases.", + (G_PTR *) &xtrabackup_databases_exclude, + (G_PTR *) &xtrabackup_databases_exclude, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + + {"stream", OPT_XTRA_STREAM, + "Stream all backup files to the standard output " + "in the specified format." + "Supported format is 'mbstream' or 'xbstream'.", + (G_PTR *) &xtrabackup_stream_str, (G_PTR *) &xtrabackup_stream_str, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + + {"compress", OPT_XTRA_COMPRESS, + "Compress individual backup files using the " + "specified compression algorithm. Currently the only supported algorithm " + "is 'quicklz'. It is also the default algorithm, i.e. the one used when " + "--compress is used without an argument.", + (G_PTR *) &xtrabackup_compress_alg, (G_PTR *) &xtrabackup_compress_alg, 0, + GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + + {"compress-threads", OPT_XTRA_COMPRESS_THREADS, + "Number of threads for parallel data compression. The default value is " + "1.", + (G_PTR *) &xtrabackup_compress_threads, + (G_PTR *) &xtrabackup_compress_threads, 0, GET_UINT, REQUIRED_ARG, 1, 1, + UINT_MAX, 0, 0, 0}, + + {"compress-chunk-size", OPT_XTRA_COMPRESS_CHUNK_SIZE, + "Size of working buffer(s) for compression threads in bytes. The default " + "value is 64K.", + (G_PTR *) &xtrabackup_compress_chunk_size, + (G_PTR *) &xtrabackup_compress_chunk_size, 0, GET_ULL, REQUIRED_ARG, + (1 << 16), 1024, ULONGLONG_MAX, 0, 0, 0}, + + {"incremental-force-scan", OPT_XTRA_INCREMENTAL_FORCE_SCAN, + "Perform a full-scan incremental backup even in the presence of changed " + "page bitmap data", + (G_PTR *) &xtrabackup_incremental_force_scan, + (G_PTR *) &xtrabackup_incremental_force_scan, 0, GET_BOOL, NO_ARG, 0, 0, + 0, 0, 0, 0}, + + {"close_files", OPT_CLOSE_FILES, + "do not keep files opened. Use at your own " + "risk.", + (G_PTR *) &xb_close_files, (G_PTR *) &xb_close_files, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, + + {"core-file", OPT_CORE_FILE, "Write core on fatal signals", 0, 0, 0, + GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"copy-back", OPT_COPY_BACK, + "Copy all the files in a previously made " + "backup from the backup directory to their original locations.", + (uchar *) &xtrabackup_copy_back, (uchar *) &xtrabackup_copy_back, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"move-back", OPT_MOVE_BACK, + "Move all the files in a previously made " + "backup from the backup directory to the actual datadir location. " + "Use with caution, as it removes backup files.", + (uchar *) &xtrabackup_move_back, (uchar *) &xtrabackup_move_back, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"galera-info", OPT_GALERA_INFO, + "This options creates the " + "xtrabackup_galera_info file which contains the local node state at " + "the time of the backup. Option should be used when performing the " + "backup of MariaDB Galera Cluster. Has no effect when backup locks " + "are used to create the backup.", + (uchar *) &opt_galera_info, (uchar *) &opt_galera_info, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"slave-info", OPT_SLAVE_INFO, + "This option is useful when backing " + "up a replication slave server. It prints the binary log position " + "and name of the master server. It also writes this information to " + "the \"xtrabackup_slave_info\" file as a \"CHANGE MASTER\" command. " + "A new slave for this master can be set up by starting a slave server " + "on this backup and issuing a \"CHANGE MASTER\" command with the " + "binary log position saved in the \"xtrabackup_slave_info\" file.", + (uchar *) &opt_slave_info, (uchar *) &opt_slave_info, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, + + {"no-lock", OPT_NO_LOCK, + "Use this option to disable table lock " + "with \"FLUSH TABLES WITH READ LOCK\". Use it only if ALL your " + "tables are InnoDB and you DO NOT CARE about the binary log " + "position of the backup. This option shouldn't be used if there " + "are any DDL statements being executed or if any updates are " + "happening on non-InnoDB tables (this includes the system MyISAM " + "tables in the mysql database), otherwise it could lead to an " + "inconsistent backup. If you are considering to use --no-lock " + "because your backups are failing to acquire the lock, this could " + "be because of incoming replication events preventing the lock " + "from succeeding. Please try using --safe-slave-backup to " + "momentarily stop the replication slave thread, this may help " + "the backup to succeed and you then don't need to resort to " + "using this option.", + (uchar *) &opt_no_lock, (uchar *) &opt_no_lock, 0, GET_BOOL, NO_ARG, 0, 0, + 0, 0, 0, 0}, + + {"safe-slave-backup", OPT_SAFE_SLAVE_BACKUP, + "Stop slave SQL thread " + "and wait to start backup until Slave_open_temp_tables in " + "\"SHOW STATUS\" is zero. If there are no open temporary tables, " + "the backup will take place, otherwise the SQL thread will be " + "started and stopped until there are no open temporary tables. " + "The backup will fail if Slave_open_temp_tables does not become " + "zero after --safe-slave-backup-timeout seconds. The slave SQL " + "thread will be restarted when the backup finishes.", + (uchar *) &opt_safe_slave_backup, (uchar *) &opt_safe_slave_backup, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"rsync", OPT_RSYNC, + "Uses the rsync utility to optimize local file " + "transfers. When this option is specified, innobackupex uses rsync " + "to copy all non-InnoDB files instead of spawning a separate cp for " + "each file, which can be much faster for servers with a large number " + "of databases or tables. This option cannot be used together with " + "--stream.", + (uchar *) &opt_rsync, (uchar *) &opt_rsync, 0, GET_BOOL, NO_ARG, 0, 0, 0, + 0, 0, 0}, + + {"force-non-empty-directories", OPT_FORCE_NON_EMPTY_DIRS, + "This " + "option, when specified, makes --copy-back or --move-back transfer " + "files to non-empty directories. Note that no existing files will be " + "overwritten. If --copy-back or --nove-back has to copy a file from " + "the backup directory which already exists in the destination " + "directory, it will still fail with an error.", + (uchar *) &opt_force_non_empty_dirs, (uchar *) &opt_force_non_empty_dirs, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"no-version-check", OPT_NO_VERSION_CHECK, + "This option disables the " + "version check which is enabled by the --version-check option.", + (uchar *) &opt_noversioncheck, (uchar *) &opt_noversioncheck, 0, GET_BOOL, + NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"no-backup-locks", OPT_NO_BACKUP_LOCKS, + "This option controls if " + "backup locks should be used instead of FLUSH TABLES WITH READ LOCK " + "on the backup stage. The option has no effect when backup locks are " + "not supported by the server. This option is enabled by default, " + "disable with --no-backup-locks.", + (uchar *) &opt_no_backup_locks, (uchar *) &opt_no_backup_locks, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"decompress", OPT_DECOMPRESS, + "Decompresses all files with the .qp " + "extension in a backup previously made with the --compress option.", + (uchar *) &opt_decompress, (uchar *) &opt_decompress, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, + + {"user", 'u', + "This option specifies the MySQL username used " + "when connecting to the server, if that's not the current user. " + "The option accepts a string argument. See mysql --help for details.", + (uchar *) &opt_user, (uchar *) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + + {"host", 'H', + "This option specifies the host to use when " + "connecting to the database server with TCP/IP. The option accepts " + "a string argument. See mysql --help for details.", + (uchar *) &opt_host, (uchar *) &opt_host, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + + {"port", 'P', + "This option specifies the port to use when " + "connecting to the database server with TCP/IP. The option accepts " + "a string argument. See mysql --help for details.", + &opt_port, &opt_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + + {"password", 'p', + "This option specifies the password to use " + "when connecting to the database. It accepts a string argument. " + "See mysql --help for details.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + + {"protocol", OPT_PROTOCOL, + "The protocol to use for connection (tcp, socket, pipe, memory).", 0, 0, + 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + + {"socket", 'S', + "This option specifies the socket to use when " + "connecting to the local database server with a UNIX domain socket. " + "The option accepts a string argument. See mysql --help for details.", + (uchar *) &opt_socket, (uchar *) &opt_socket, 0, GET_STR, REQUIRED_ARG, 0, + 0, 0, 0, 0, 0}, + + {"incremental-history-name", OPT_INCREMENTAL_HISTORY_NAME, + "This option specifies the name of the backup series stored in the " + "PERCONA_SCHEMA.xtrabackup_history history record to base an " + "incremental backup on. Xtrabackup will search the history table " + "looking for the most recent (highest innodb_to_lsn), successful " + "backup in the series and take the to_lsn value to use as the " + "starting lsn for the incremental backup. This will be mutually " + "exclusive with --incremental-history-uuid, --incremental-basedir " + "and --incremental-lsn. If no valid lsn can be found (no series by " + "that name, no successful backups by that name) xtrabackup will " + "return with an error. It is used with the --incremental option.", + (uchar *) &opt_incremental_history_name, + (uchar *) &opt_incremental_history_name, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + + {"incremental-history-uuid", OPT_INCREMENTAL_HISTORY_UUID, + "This option specifies the UUID of the specific history record " + "stored in the PERCONA_SCHEMA.xtrabackup_history to base an " + "incremental backup on. --incremental-history-name, " + "--incremental-basedir and --incremental-lsn. If no valid lsn can be " + "found (no success record with that uuid) xtrabackup will return " + "with an error. It is used with the --incremental option.", + (uchar *) &opt_incremental_history_uuid, + (uchar *) &opt_incremental_history_uuid, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + + {"remove-original", OPT_REMOVE_ORIGINAL, + "Remove .qp files after decompression.", (uchar *) &opt_remove_original, + (uchar *) &opt_remove_original, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + + {"ftwrl-wait-query-type", OPT_LOCK_WAIT_QUERY_TYPE, + "This option specifies which types of queries are allowed to complete " + "before innobackupex will issue the global lock. Default is all.", + (uchar *) &opt_lock_wait_query_type, (uchar *) &opt_lock_wait_query_type, + &query_type_typelib, GET_ENUM, REQUIRED_ARG, QUERY_TYPE_ALL, 0, 0, 0, 0, + 0}, + + {"kill-long-query-type", OPT_KILL_LONG_QUERY_TYPE, + "This option specifies which types of queries should be killed to " + "unblock the global lock. Default is \"all\".", + (uchar *) &opt_kill_long_query_type, (uchar *) &opt_kill_long_query_type, + &query_type_typelib, GET_ENUM, REQUIRED_ARG, QUERY_TYPE_SELECT, 0, 0, 0, + 0, 0}, + + {"history", OPT_HISTORY, + "This option enables the tracking of backup history in the " + "PERCONA_SCHEMA.xtrabackup_history table. An optional history " + "series name may be specified that will be placed with the history " + "record for the current backup being taken.", + NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + + {"kill-long-queries-timeout", OPT_KILL_LONG_QUERIES_TIMEOUT, + "This option specifies the number of seconds innobackupex waits " + "between starting FLUSH TABLES WITH READ LOCK and killing those " + "queries that block it. Default is 0 seconds, which means " + "innobackupex will not attempt to kill any queries.", + (uchar *) &opt_kill_long_queries_timeout, + (uchar *) &opt_kill_long_queries_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + + {"ftwrl-wait-timeout", OPT_LOCK_WAIT_TIMEOUT, + "This option specifies time in seconds that innobackupex should wait " + "for queries that would block FTWRL before running it. If there are " + "still such queries when the timeout expires, innobackupex terminates " + "with an error. Default is 0, in which case innobackupex does not " + "wait for queries to complete and starts FTWRL immediately.", + (uchar *) &opt_lock_wait_timeout, (uchar *) &opt_lock_wait_timeout, 0, + GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + + {"ftwrl-wait-threshold", OPT_LOCK_WAIT_THRESHOLD, + "This option specifies the query run time threshold which is used by " + "innobackupex to detect long-running queries with a non-zero value " + "of --ftwrl-wait-timeout. FTWRL is not started until such " + "long-running queries exist. This option has no effect if " + "--ftwrl-wait-timeout is 0. Default value is 60 seconds.", + (uchar *) &opt_lock_wait_threshold, (uchar *) &opt_lock_wait_threshold, 0, + GET_UINT, REQUIRED_ARG, 60, 0, 0, 0, 0, 0}, + + {"debug-sleep-before-unlock", OPT_DEBUG_SLEEP_BEFORE_UNLOCK, + "This is a debug-only option used by the XtraBackup test suite.", + (uchar *) &opt_debug_sleep_before_unlock, + (uchar *) &opt_debug_sleep_before_unlock, 0, GET_UINT, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + + {"safe-slave-backup-timeout", OPT_SAFE_SLAVE_BACKUP_TIMEOUT, + "How many seconds --safe-slave-backup should wait for " + "Slave_open_temp_tables to become zero. (default 300)", + (uchar *) &opt_safe_slave_backup_timeout, + (uchar *) &opt_safe_slave_backup_timeout, 0, GET_UINT, REQUIRED_ARG, 300, + 0, 0, 0, 0, 0}, + + {"binlog-info", OPT_BINLOG_INFO, + "This option controls how XtraBackup should retrieve server's binary log " + "coordinates corresponding to the backup. Possible values are OFF, ON, " + "LOCKLESS and AUTO. See the XtraBackup manual for more information", + &opt_binlog_info, &opt_binlog_info, &binlog_info_typelib, GET_ENUM, + OPT_ARG, BINLOG_INFO_AUTO, 0, 0, 0, 0, 0}, + + {"secure-auth", OPT_XB_SECURE_AUTH, + "Refuse client connecting to server if it" + " uses old (pre-4.1.1) protocol.", + &opt_secure_auth, &opt_secure_auth, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, + 0}, #define MYSQL_CLIENT #include "sslopt-longopts.h" #undef MYSQL_CLIENT - { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} -}; + {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}}; uint xb_client_options_count = array_elements(xb_client_options); @@ -3539,6 +3580,11 @@ xb_register_exclude_filter_entry( &tables_exclude_hash); } +void register_ignore_db_dirs_filter(const char *name) +{ + xb_add_filter(name, &databases_exclude_hash); +} + /*********************************************************************** Register new table for the filter. */ static @@ -3601,26 +3647,24 @@ xb_register_exclude_regex( typedef void (*insert_entry_func_t)(const char*); -/*********************************************************************** -Scan string and load filter entries from it. */ -static -void -xb_load_list_string( -/*================*/ - char* list, /*!< in: string representing a list */ - const char* delimiters, /*!< in: delimiters of entries */ - insert_entry_func_t ins) /*!< in: callback to add entry */ +/* Scan string and load filter entries from it. +@param[in] list string representing a list +@param[in] delimiters delimiters of entries +@param[in] ins callback to add entry */ +void xb_load_list_string(char *list, const char *delimiters, + insert_entry_func_t ins) { - char* p; - char* saveptr; + char *p; + char *saveptr; - p = strtok_r(list, delimiters, &saveptr); - while (p) { + p= strtok_r(list, delimiters, &saveptr); + while (p) + { - ins(p); + ins(p); - p = strtok_r(NULL, delimiters, &saveptr); - } + p= strtok_r(NULL, delimiters, &saveptr); + } } /*********************************************************************** @@ -5429,7 +5473,7 @@ static bool xtrabackup_prepare_func(char** argv) srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; } - if (innodb_init()) { + if (innodb_init()) { goto error_cleanup; } @@ -5451,8 +5495,9 @@ static bool xtrabackup_prepare_func(char** argv) else if (ok) xb_write_galera_info(xtrabackup_incremental); #endif - innodb_shutdown(); - innodb_free_param(); + innodb_shutdown(); + + innodb_free_param(); /* output to metadata file */ if (ok) { diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 803cc644733..f18d79aea55 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -195,4 +195,14 @@ void mdl_lock_init(); void mdl_lock_table(ulint space_id); void mdl_unlock_all(); bool ends_with(const char *str, const char *suffix); + +typedef void (*insert_entry_func_t)(const char*); + +/* Scan string and load filter entries from it. +@param[in] list string representing a list +@param[in] delimiters delimiters of entries +@param[in] ins callback to add entry */ +void xb_load_list_string(char *list, const char *delimiters, + insert_entry_func_t ins); +void register_ignore_db_dirs_filter(const char *name); #endif /* XB_XTRABACKUP_H */ diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 195ad73a927..c4ed2a9ccd7 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -53,7 +53,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"symbols-file", 's', "Use specified symbols file.", &sym_fname, + {"symbols-file", 's', "Use specified symbols file", &sym_fname, &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"numeric-dump-file", 'n', "Read the dump from specified file.", &dump_fname, &dump_fname, 0, GET_STR, REQUIRED_ARG, @@ -63,7 +63,7 @@ static struct my_option my_long_options[] = static void verify_sort(); - +static void clean_up(); static void print_version(void) { @@ -97,9 +97,18 @@ static void die(const char* fmt, ...) vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); va_end(args); + clean_up(); + my_end(0); exit(1); } +void local_exit(int error) +{ + clean_up(); + my_end(0); + exit(error); +} + static my_bool get_one_option(const struct my_option *opt, @@ -109,10 +118,12 @@ get_one_option(const struct my_option *opt, switch(opt->id) { case 'V': print_version(); - exit(0); + local_exit(0); + break; case '?': usage(); - exit(0); + local_exit(0); + break; } return 0; } @@ -123,7 +134,7 @@ static int parse_args(int argc, char **argv) int ho_error; if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) - exit(ho_error); + local_exit(ho_error); /* The following code is to make the command compatible with the old @@ -144,13 +155,13 @@ static int parse_args(int argc, char **argv) else { usage(); - exit(1); + local_exit(1); } } else if (argc != 0 || !sym_fname) { usage(); - exit(1); + local_exit(1); } return 0; } @@ -243,6 +254,10 @@ static void init_sym_table() static void clean_up() { delete_dynamic(&sym_table); + if (fp_dump && fp_dump != stdin) + my_fclose(fp_dump, MYF(0)); + if (fp_sym) + my_fclose(fp_sym, MYF(0)); } static void verify_sort() @@ -284,7 +299,7 @@ static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se) /* - Resolve anything that starts with [0x or (+0x or start of line and 0x + Resolve anything that starts with [0x or (+0x or 0x Skip '_end' as this is an indication of a wrong symbol (stack?) */ @@ -300,9 +315,7 @@ static void do_resolve() found= 3; if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x') found= 4; - - /* For stdin */ - if (p == buf && p[0] == '0' && p[1] == 'x') + if (p[0] == '0' && p[1] == 'x') found= 2; if (found) @@ -313,14 +326,15 @@ static void do_resolve() addr= (uchar*)read_addr(&tmp); if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end")) { - fprintf(fp_out, "%c%p %s + %d", *p, addr, se.symbol, - (int) (addr - se.addr)); + found-= 2; /* Don't print 0x as it's added by %p */ + while (found--) + fputc(*p++, stdout); + fprintf(fp_out, "%p %s + %d", addr, + se.symbol, (int) (addr - se.addr)); p= tmp-1; } else - { fputc(*p, stdout); - } } else fputc(*p, stdout); @@ -337,5 +351,6 @@ int main(int argc, char** argv) init_sym_table(); do_resolve(); clean_up(); + my_end(0); return 0; } |