diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-01 18:15:00 +0000 |
commit | a2a2e32c02643a0cec111511220227703fda1cd5 (patch) | |
tree | 69cc2b631234c2a8e026b9cd4d72676c61c594df /extra/mariabackup | |
parent | Releasing progress-linux version 1:10.11.8-1~progress7.99u1. (diff) | |
download | mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.tar.xz mariadb-a2a2e32c02643a0cec111511220227703fda1cd5.zip |
Merging upstream version 1:11.4.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'extra/mariabackup')
-rw-r--r-- | extra/mariabackup/CMakeLists.txt | 4 | ||||
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 26 | ||||
-rw-r--r-- | extra/mariabackup/backup_copy.h | 10 | ||||
-rw-r--r-- | extra/mariabackup/backup_mysql.cc | 18 | ||||
-rw-r--r-- | extra/mariabackup/backup_wsrep.h | 2 | ||||
-rw-r--r-- | extra/mariabackup/innobackupex.cc | 8 | ||||
-rw-r--r-- | extra/mariabackup/wsrep.cc | 22 | ||||
-rw-r--r-- | extra/mariabackup/xbstream.cc | 11 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 150 |
9 files changed, 136 insertions, 115 deletions
diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index 63ac8cf3..fbc415ce 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -76,7 +76,7 @@ MYSQL_ADD_EXECUTABLE(mariadb-backup common_engine.cc ${PROJECT_SOURCE_DIR}/sql/net_serv.cc ${PROJECT_SOURCE_DIR}/libmysqld/libmysql.c - COMPONENT backup + COMPONENT Backup ) # Export all symbols on Unix, for better crash callstacks @@ -100,7 +100,7 @@ MYSQL_ADD_EXECUTABLE(mbstream xbstream.cc xbstream_read.cc xbstream_write.cc - COMPONENT backup + COMPONENT Backup ) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 198da01a..83ed8e4e 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1402,7 +1402,7 @@ bool backup_finish(ds_ctxt *ds_data) return(false); } - if (!write_xtrabackup_info(ds_data, mysql_connection, XTRABACKUP_INFO, + if (!write_xtrabackup_info(ds_data, mysql_connection, MB_INFO, opt_history != 0, true)) { return(false); } @@ -1458,11 +1458,15 @@ ibx_copy_incremental_over_full() const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI", "MRG", "TRG", "TRN", "ARM", "ARZ", "CSM", "CSV", "opt", "par", NULL}; - const char *sup_files[] = {"xtrabackup_binlog_info", - "xtrabackup_galera_info", - "donor_galera_info", - "xtrabackup_slave_info", - "xtrabackup_info", + const char *sup_files[] = {MB_BINLOG_INFO, + MB_GALERA_INFO, + XTRABACKUP_DONOR_GALERA_INFO, + MB_SLAVE_INFO, + MB_INFO, + XTRABACKUP_BINLOG_INFO, + XTRABACKUP_GALERA_INFO, + XTRABACKUP_SLAVE_INFO, + XTRABACKUP_INFO, "ib_lru_dump", NULL}; datadir_iter_t *it = NULL; @@ -1800,8 +1804,12 @@ copy_back() while (datadir_iter_next(it, &node)) { const char *ext_list[] = {"backup-my.cnf", - "xtrabackup_binary", "xtrabackup_binlog_info", - "xtrabackup_checkpoints", ".qp", ".pmap", ".tmp", + "xtrabackup_binary", + MB_BINLOG_INFO, + MB_METADATA_FILENAME, + XTRABACKUP_BINLOG_INFO, + XTRABACKUP_METADATA_FILENAME, + ".qp", ".pmap", ".tmp", NULL}; const char *filename; char c_tmp; @@ -2124,7 +2132,7 @@ ds_ctxt_t::make_hardlink(const char *from_path, const char *to_path) } else { - strncpy(to_path_full, to_path, sizeof(to_path_full)-1); + strmake(to_path_full, to_path, sizeof(to_path_full)-1); } #ifdef _WIN32 return CreateHardLink(to_path_full, from_path, NULL); diff --git a/extra/mariabackup/backup_copy.h b/extra/mariabackup/backup_copy.h index 409e7839..869bfff1 100644 --- a/extra/mariabackup/backup_copy.h +++ b/extra/mariabackup/backup_copy.h @@ -7,12 +7,20 @@ #include <mysql.h> #include "datasink.h" -/* special files */ +/* special files, backward compatibility */ #define XTRABACKUP_SLAVE_INFO "xtrabackup_slave_info" #define XTRABACKUP_GALERA_INFO "xtrabackup_galera_info" #define XTRABACKUP_DONOR_GALERA_INFO "donor_galera_info" #define XTRABACKUP_BINLOG_INFO "xtrabackup_binlog_info" #define XTRABACKUP_INFO "xtrabackup_info" +#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" + +/* special files */ +#define MB_SLAVE_INFO "mariadb_backup_slave_info" +#define MB_GALERA_INFO "mariadb_backup_galera_info" +#define MB_BINLOG_INFO "mariadb_backup_binlog_info" +#define MB_INFO "mariadb_backup_info" +#define MB_METADATA_FILENAME "mariadb_backup_checkpoints" extern bool binlog_locked; diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 2aad6004..33d6b0a9 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -181,7 +181,7 @@ xb_mysql_connect() opt_socket ? opt_socket : "not set"); #ifdef HAVE_OPENSSL - if (opt_use_ssl && opt_protocol <= MYSQL_PROTOCOL_SOCKET) + if (opt_use_ssl) { mysql_ssl_set(connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, opt_ssl_capath, @@ -190,6 +190,8 @@ xb_mysql_connect() mysql_options(connection, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); } + else + opt_ssl_verify_server_cert= 0; mysql_options(connection,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); #endif @@ -1411,7 +1413,7 @@ write_slave_info(ds_ctxt *datasink, MYSQL *connection) } mysql_slave_position= strdup(comment.c_ptr()); - return datasink->backup_file_print_buf(XTRABACKUP_SLAVE_INFO, + return datasink->backup_file_print_buf(MB_SLAVE_INFO, sql.ptr(), sql.length()); } @@ -1488,7 +1490,7 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection) goto cleanup; } - result= datasink->backup_file_printf(XTRABACKUP_GALERA_INFO, + result= datasink->backup_file_printf(MB_GALERA_INFO, "%s:%s %s\n", state_uuid ? state_uuid : state_uuid55, last_committed ? last_committed : last_committed55, domain_id ? domain_id : domain_id55); @@ -1634,7 +1636,7 @@ write_binlog_info(ds_ctxt *datasink, MYSQL *connection) read_mysql_variables(connection, "SHOW VARIABLES", vars, true); if (filename == NULL || position == NULL) { - /* Do not create xtrabackup_binlog_info if binary + /* Do not create MB_BINLOG_INFO if binary log is disabled */ result = true; goto cleanup; @@ -1650,14 +1652,14 @@ write_binlog_info(ds_ctxt *datasink, MYSQL *connection) "filename '%s', position '%s', " "GTID of the last change '%s'", filename, position, gtid) != -1); - result = datasink->backup_file_printf(XTRABACKUP_BINLOG_INFO, + result = datasink->backup_file_printf(MB_BINLOG_INFO, "%s\t%s\t%s\n", filename, position, gtid); } else { ut_a(asprintf(&mysql_binlog_position, "filename '%s', position '%s'", filename, position) != -1); - result = datasink->backup_file_printf(XTRABACKUP_BINLOG_INFO, + result = datasink->backup_file_printf(MB_BINLOG_INFO, "%s\t%s\n", filename, position); } @@ -1692,7 +1694,7 @@ operator<<(std::ostream& s, const escape_and_quote& eq) } /*********************************************************************//** -Writes xtrabackup_info file and if backup_history is enable creates +Writes MB_INFO file and if backup_history is enable creates mysql.mariabackup_history and writes a new history record to the table containing all the history info particular to the just completed backup. */ @@ -1769,7 +1771,7 @@ write_xtrabackup_info(ds_ctxt *datasink, xb_stream_name[xtrabackup_stream_fmt], /* format */ xtrabackup_compress ? "compressed" : "N"); /* compressed */ if (buf_len < 0) { - msg("Error: cannot generate xtrabackup_info"); + msg("Error: cannot generate " MB_INFO); result = false; goto cleanup; } diff --git a/extra/mariabackup/backup_wsrep.h b/extra/mariabackup/backup_wsrep.h index 50a8a3a5..d992d925 100644 --- a/extra/mariabackup/backup_wsrep.h +++ b/extra/mariabackup/backup_wsrep.h @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA #define BACKUP_WSREP_H /*********************************************************************** -Store Galera checkpoint info in the 'xtrabackup_galera_info' file, if that +Store Galera checkpoint info in the MB_GALERA_INFO file, if that information is present in the trx system header. Otherwise, do nothing. */ void xb_write_galera_info(bool incremental_prepare); diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 2de57a14..60c38546 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -240,7 +240,7 @@ static struct my_option ibx_long_options[] = 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 " + MB_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.", @@ -250,10 +250,10 @@ static struct my_option ibx_long_options[] = {"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. " + "the \"" MB_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.", + "binary log position saved in the \"" MB_SLAVE_INFO "\" file.", (uchar *) &opt_ibx_slave_info, (uchar *) &opt_ibx_slave_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -504,7 +504,7 @@ static struct my_option ibx_long_options[] = {"extra-lsndir", OPT_EXTRA_LSNDIR, "This option specifies the " "directory in which to save an extra copy of the " - "\"xtrabackup_checkpoints\" file. The option accepts a string " + "\"" MB_METADATA_FILENAME "\" file. The option accepts a string " "argument.", (uchar*) &ibx_xtrabackup_extra_lsndir, (uchar*) &ibx_xtrabackup_extra_lsndir, diff --git a/extra/mariabackup/wsrep.cc b/extra/mariabackup/wsrep.cc index 15463a85..0a2cb874 100644 --- a/extra/mariabackup/wsrep.cc +++ b/extra/mariabackup/wsrep.cc @@ -52,14 +52,14 @@ permission notice: #include <wsrep_api.h> /*! Name of file where Galera info is stored on recovery */ -#define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info" +#define MB_GALERA_INFO_FILENAME "mariadb_backup_galera_info" #define XB_GALERA_DONOR_INFO_FILENAME "donor_galera_info" /* backup copy of galera info file as sent by donor */ -#define XB_GALERA_INFO_FILENAME_SST "xtrabackup_galera_info_SST" +#define MB_GALERA_INFO_FILENAME_SST "mariadb_backup_galera_info_SST" /*********************************************************************** -Store Galera checkpoint info in the 'xtrabackup_galera_info' file, if that +Store Galera checkpoint info in the MB_GALERA_INFO_FILENAME file, if that information is present in the trx system header. Otherwise, do nothing. */ void xb_write_galera_info(bool incremental_prepare) @@ -87,9 +87,9 @@ xb_write_galera_info(bool incremental_prepare) /* if SST brought in galera info file, copy it as *_SST file this will not be used, saved just for future reference */ - if (my_stat(XB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL) { - FILE* fp_in = fopen(XB_GALERA_INFO_FILENAME, "r"); - FILE* fp_out = fopen(XB_GALERA_INFO_FILENAME_SST, "w"); + if (my_stat(MB_GALERA_INFO_FILENAME, &statinfo, MYF(0))) { + FILE* fp_in = fopen(MB_GALERA_INFO_FILENAME, "r"); + FILE* fp_out = fopen(MB_GALERA_INFO_FILENAME_SST, "w"); char buf[BUFSIZ] = {'\0'}; size_t size; @@ -97,14 +97,14 @@ xb_write_galera_info(bool incremental_prepare) if (fwrite(buf, 1, size, fp_out) != strlen(buf)) { die( "could not write to " - XB_GALERA_INFO_FILENAME_SST + MB_GALERA_INFO_FILENAME_SST ", errno = %d\n", errno); } } if (!feof(fp_in)) { die( - XB_GALERA_INFO_FILENAME_SST + MB_GALERA_INFO_FILENAME_SST " not fully copied\n" ); } @@ -119,11 +119,11 @@ xb_write_galera_info(bool incremental_prepare) return; } - fp = fopen(XB_GALERA_INFO_FILENAME, "w"); + fp = fopen(MB_GALERA_INFO_FILENAME, "w"); if (fp == NULL) { die( - "could not create " XB_GALERA_INFO_FILENAME + "could not create " MB_GALERA_INFO_FILENAME ", errno = %d\n", errno); } @@ -137,7 +137,7 @@ xb_write_galera_info(bool incremental_prepare) (long long)wsrep_get_domain_id()) < 0) { die( - "could not write to " XB_GALERA_INFO_FILENAME + "could not write to " MB_GALERA_INFO_FILENAME ", errno = %d\n", errno);; } diff --git a/extra/mariabackup/xbstream.cc b/extra/mariabackup/xbstream.cc index d69a0029..5a54cace 100644 --- a/extra/mariabackup/xbstream.cc +++ b/extra/mariabackup/xbstream.cc @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA *******************************************************/ +#define VER "1.0" #include <my_global.h> #include <my_base.h> #include <my_getopt.h> @@ -26,8 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA #include "common.h" #include "xbstream.h" #include "datasink.h" +#include <welcome_copyright_notice.h> -#define XBSTREAM_VERSION "1.0" #define XBSTREAM_BUFFER_SIZE (10 * 1024 * 1024UL) #define START_FILE_HASH_SIZE 16 @@ -148,14 +149,6 @@ get_options(int *argc, char ***argv) static void -print_version(void) -{ - printf("%s Ver %s for %s (%s)\n", my_progname, XBSTREAM_VERSION, - SYSTEM_TYPE, MACHINE_TYPE); -} - -static -void usage(void) { print_version(); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 5979bbd3..c4cb0fa3 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -134,7 +134,7 @@ extern const char* fts_common_tables[]; extern const fts_index_selector_t fts_index_selector[]; /* === xtrabackup specific options === */ -#define DEFAULT_TARGET_DIR "./xtrabackup_backupfiles/" +#define DEFAULT_TARGET_DIR "./mariadb_backup_files/" char xtrabackup_real_target_dir[FN_REFLEN] = DEFAULT_TARGET_DIR; char *xtrabackup_target_dir= xtrabackup_real_target_dir; static my_bool xtrabackup_version; @@ -225,15 +225,14 @@ static ulong max_buf_pool_modified_pct; /* Ignored option (--log) for MySQL option compatibility */ static char* log_ignored_opt; - extern my_bool opt_use_ssl; extern char *opt_tls_version; my_bool opt_ssl_verify_server_cert; +char *opt_ssl_fp, *opt_ssl_fplist; my_bool opt_extended_validation; my_bool opt_encrypted_backup; /* === metadata of backup === */ -#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" char metadata_type[30] = ""; /*[full-backuped|log-applied|incremental]*/ static lsn_t metadata_from_lsn; lsn_t metadata_to_lsn; @@ -380,8 +379,10 @@ static my_bool opt_check_privileges; extern const char *innodb_checksum_algorithm_names[]; extern TYPELIB innodb_checksum_algorithm_typelib; -extern const char *innodb_flush_method_names[]; extern TYPELIB innodb_flush_method_typelib; +extern TYPELIB innodb_doublewrite_typelib; +/** Ignored option */ +static ulong innodb_flush_method; static const char *binlog_info_values[] = {"off", "lockless", "on", "auto", NullS}; @@ -1332,6 +1333,8 @@ enum options_xtrabackup #if defined __linux__ || defined _WIN32 OPT_INNODB_LOG_FILE_BUFFERING, #endif + OPT_INNODB_DATA_FILE_BUFFERING, + OPT_INNODB_DATA_FILE_WRITE_THROUGH, OPT_INNODB_LOG_FILE_SIZE, OPT_INNODB_LOG_FILES_IN_GROUP, OPT_INNODB_OPEN_FILES, @@ -1428,8 +1431,8 @@ struct my_option xb_client_options[]= { (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.", + "(for --backup): save an extra copy of the " MB_METADATA_FILENAME + " 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, @@ -1546,7 +1549,7 @@ struct my_option xb_client_options[]= { {"galera-info", OPT_GALERA_INFO, "This options creates the " - "xtrabackup_galera_info file which contains the local node state at " + MB_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.", @@ -1557,10 +1560,10 @@ struct my_option xb_client_options[]= { "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. " + "the \"" MB_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.", + "binary log position saved in the \"" MB_SLAVE_INFO "\" file.", (uchar *) &opt_slave_info, (uchar *) &opt_slave_info, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1855,8 +1858,8 @@ struct my_option xb_server_options[] = &innobase_data_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_doublewrite", OPT_INNODB_DOUBLEWRITE, "Enable InnoDB doublewrite buffer during --prepare.", - (G_PTR*) &srv_use_doublewrite_buf, - (G_PTR*) &srv_use_doublewrite_buf, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + (G_PTR*) &buf_dblwr.use, (G_PTR*) &buf_dblwr.use, + &innodb_doublewrite_typelib, GET_ENUM, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"innodb_io_capacity", OPT_INNODB_IO_CAPACITY, "Number of IOPs the server can do. Tunes the background IO rate", (G_PTR*) &srv_io_capacity, (G_PTR*) &srv_io_capacity, @@ -1880,10 +1883,10 @@ struct my_option xb_server_options[] = FALSE, 0, 0, 0, 0, 0}, {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, - "With which method to flush data.", - &srv_file_flush_method, &srv_file_flush_method, + "Ignored parameter with no effect", + &innodb_flush_method, &innodb_flush_method, &innodb_flush_method_typelib, GET_ENUM, REQUIRED_ARG, - IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT), 0, 0, 0, 0, 0}, + 4/* O_DIRECT */, 0, 0, 0, 0, 0}, {"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE, "Redo log buffer size in bytes.", @@ -1897,6 +1900,16 @@ struct my_option xb_server_options[] = (G_PTR*) &log_sys.log_buffered, 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0}, #endif + {"innodb_data_file_buffering", OPT_INNODB_DATA_FILE_BUFFERING, + "Whether the file system cache for data files is enabled during --backup", + (G_PTR*) &fil_system.buffered, + (G_PTR*) &fil_system.buffered, 0, GET_BOOL, NO_ARG, + FALSE, 0, 0, 0, 0, 0}, + {"innodb_data_file_write_through", OPT_INNODB_DATA_FILE_WRITE_THROUGH, + "Whether each write to data files writes through", + (G_PTR*) &fil_system.write_through, + (G_PTR*) &fil_system.write_through, 0, GET_BOOL, NO_ARG, + FALSE, 0, 0, 0, 0, 0}, {"innodb_log_file_size", OPT_INNODB_LOG_FILE_SIZE, "Ignored for mysqld option compatibility", (G_PTR*) &srv_log_file_size, (G_PTR*) &srv_log_file_size, 0, @@ -1953,7 +1966,7 @@ struct my_option xb_server_options[] = {"innodb_undo_tablespaces", OPT_INNODB_UNDO_TABLESPACES, "Number of undo tablespaces to use.", (G_PTR*)&srv_undo_tablespaces, (G_PTR*)&srv_undo_tablespaces, - 0, GET_UINT, REQUIRED_ARG, 0, 0, 126, 0, 1, 0}, + 0, GET_UINT, REQUIRED_ARG, 3, 0, 126, 0, 1, 0}, {"innodb_compression_level", OPT_INNODB_COMPRESSION_LEVEL, "Compression level used for zlib compression.", @@ -2233,27 +2246,6 @@ xb_get_one_option(const struct my_option *opt, ADD_PRINT_PARAM_OPT(srv_log_group_home_dir); break; - case OPT_INNODB_LOG_FILES_IN_GROUP: - case OPT_INNODB_LOG_FILE_SIZE: - break; - - case OPT_INNODB_FLUSH_METHOD: -#ifdef _WIN32 - /* From: storage/innobase/handler/ha_innodb.cc:innodb_init_params */ - switch (srv_file_flush_method) { - case SRV_ALL_O_DIRECT_FSYNC + 1 /* "async_unbuffered"="unbuffered" */: - srv_file_flush_method= SRV_ALL_O_DIRECT_FSYNC; - break; - case SRV_ALL_O_DIRECT_FSYNC + 2 /* "normal"="fsync" */: - srv_file_flush_method= SRV_FSYNC; - break; - } -#endif - ut_a(srv_file_flush_method - <= IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT_NO_FSYNC)); - ADD_PRINT_PARAM_OPT(innodb_flush_method_names[srv_file_flush_method]); - break; - case OPT_INNODB_PAGE_SIZE: ADD_PRINT_PARAM_OPT(innobase_page_size); @@ -2501,12 +2493,6 @@ static bool innodb_init_param() srv_print_verbose_log = verbose ? 2 : 1; - /* Store the default charset-collation number of this MySQL - installation */ - - /* We cannot treat characterset here for now!! */ - data_mysql_default_charset_coll = (ulint)default_charset_info->number; - ut_ad(DATA_MYSQL_BINARY_CHARSET_COLL == my_charset_bin.number); #ifdef _WIN32 @@ -2654,7 +2640,7 @@ static bool innodb_init() #else OS_DATA_FILE, #endif - false, &ret); + false, &ret); if (!ret) { invalid_log: @@ -2736,6 +2722,37 @@ end: return(r); } + +/* +Read backup meta info. +@return TRUE on success, FALSE on failure. */ +static +my_bool +mb_read_metadata(const char *dir, const char *name) +{ + char filename[FN_REFLEN]; + snprintf(filename, sizeof(filename), "%s/%s", dir, name); + if (!xtrabackup_read_metadata(filename)) { + msg("mariabackup: error: failed to read metadata from " + "%s", filename); + return false; + } + return true; +} + + +/* +Read backup meta info from the given directory +with backward compatibility. */ +static +my_bool +mb_read_metadata_from_dir(const char *dir) +{ + return mb_read_metadata(dir, MB_METADATA_FILENAME) || + mb_read_metadata(dir, XTRABACKUP_METADATA_FILENAME); +} + + /*********************************************************************** Print backup meta info to a specified buffer. */ static @@ -2777,9 +2794,12 @@ xtrabackup_stream_metadata(ds_ctxt_t *ds_ctxt) mystat.st_size = len; mystat.st_mtime = my_time(0); - stream = ds_open(ds_ctxt, XTRABACKUP_METADATA_FILENAME, &mystat); + stream = ds_open(ds_ctxt, MB_METADATA_FILENAME, &mystat); + if (stream == NULL) { + stream = ds_open(ds_ctxt, XTRABACKUP_METADATA_FILENAME, &mystat); + } if (stream == NULL) { - msg("Error: cannot open output stream for %s", XTRABACKUP_METADATA_FILENAME); + msg("Error: cannot open output stream for %s", MB_METADATA_FILENAME); return(FALSE); } @@ -4775,14 +4795,14 @@ bool Backup_datasinks::backup_low() char filename[FN_REFLEN]; sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, - XTRABACKUP_METADATA_FILENAME); + MB_METADATA_FILENAME); if (!xtrabackup_write_metadata(filename)) { msg("Error: failed to write metadata " "to '%s'.", filename); return false; } sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, - XTRABACKUP_INFO); + MB_INFO); if (!write_xtrabackup_info(m_data, mysql_connection, filename, false, false)) { msg("Error: failed to write info " @@ -6559,7 +6579,6 @@ store_binlog_info(const char *filename, const char* name, ulonglong pos) static bool xtrabackup_prepare_func(char** argv) { CorruptedPages corrupted_pages; - char metadata_path[FN_REFLEN]; /* cd to target-dir */ @@ -6610,12 +6629,7 @@ static bool xtrabackup_prepare_func(char** argv) /* read metadata of target */ - sprintf(metadata_path, "%s/%s", xtrabackup_target_dir, - XTRABACKUP_METADATA_FILENAME); - - if (!xtrabackup_read_metadata(metadata_path)) { - msg("Error: failed to read metadata from '%s'\n", - metadata_path); + if (!mb_read_metadata_from_dir(xtrabackup_target_dir)) { return(false); } @@ -6789,14 +6803,14 @@ error: metadata_last_lsn = incremental_last_lsn; } - sprintf(filename, "%s/%s", xtrabackup_target_dir, XTRABACKUP_METADATA_FILENAME); + sprintf(filename, "%s/%s", xtrabackup_target_dir, MB_METADATA_FILENAME); if (!xtrabackup_write_metadata(filename)) { msg("mariabackup: Error: failed to write metadata " "to '%s'", filename); ok = false; } else if (xtrabackup_extra_lsndir) { - sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_METADATA_FILENAME); + sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, MB_METADATA_FILENAME); if (!xtrabackup_write_metadata(filename)) { msg("mariabackup: Error: failed to write " "metadata to '%s'", filename); @@ -7384,6 +7398,12 @@ int main(int argc, char **argv) } if(strcmp(argv[1], "--innobackupex") == 0) { + /* + my_init() prints a "Deprecated program name" + warning if argv[0] does not start with "mariadb". + So pass the original argv[0] as the new argv[0]. + */ + argv[1]= argv[0]; argv++; argc--; innobackupex_mode = true; @@ -7459,6 +7479,8 @@ int main(int argc, char **argv) static int main_low(char** argv) { if (innobackupex_mode) { + msg(ER_DEFAULT(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT), + "--innobackupex"); if (!ibx_init()) { return(EXIT_FAILURE); } @@ -7543,26 +7565,14 @@ static int main_low(char** argv) return(EXIT_FAILURE); } } else if (xtrabackup_backup && xtrabackup_incremental_basedir) { - char filename[FN_REFLEN]; - - sprintf(filename, "%s/%s", xtrabackup_incremental_basedir, XTRABACKUP_METADATA_FILENAME); - - if (!xtrabackup_read_metadata(filename)) { - msg("mariabackup: error: failed to read metadata from " - "%s", filename); + if (!mb_read_metadata_from_dir(xtrabackup_incremental_basedir)) { return(EXIT_FAILURE); } incremental_lsn = metadata_to_lsn; xtrabackup_incremental = xtrabackup_incremental_basedir; //dummy } else if (xtrabackup_prepare && xtrabackup_incremental_dir) { - char filename[FN_REFLEN]; - - sprintf(filename, "%s/%s", xtrabackup_incremental_dir, XTRABACKUP_METADATA_FILENAME); - - if (!xtrabackup_read_metadata(filename)) { - msg("mariabackup: error: failed to read metadata from " - "%s", filename); + if (!mb_read_metadata_from_dir(xtrabackup_incremental_dir)) { return(EXIT_FAILURE); } |