diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-04-23 09:49:58 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-04-23 09:49:58 +0300 |
commit | c6ba758d1d41c11466b8f9b61b4546efc95aa689 (patch) | |
tree | 2f97d6bd28253b8ee60c2948050599fd6d96da74 /extra | |
parent | 6426b52ed43876ccc0142fc31f98dd6d42292388 (diff) | |
parent | 619dc2b24f26aea29345dc3f3289bed406738025 (diff) | |
download | mariadb-git-c6ba758d1d41c11466b8f9b61b4546efc95aa689.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'extra')
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 6 | ||||
-rw-r--r-- | extra/mariabackup/backup_mysql.cc | 42 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 11 |
3 files changed, 51 insertions, 8 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index b15887fee4c..2ea34406a6b 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -966,6 +966,9 @@ copy_file(ds_ctxt_t *datasink, ds_file_t *dstfile = NULL; datafile_cur_t cursor; xb_fil_cur_result_t res; + const char *dst_path = + (xtrabackup_copy_back || xtrabackup_move_back)? + dst_file_path : trim_dotslash(dst_file_path); if (!datafile_open(src_file_path, &cursor, thread_n)) { goto error_close; @@ -973,8 +976,7 @@ copy_file(ds_ctxt_t *datasink, strncpy(dst_name, cursor.rel_path, sizeof(dst_name)); - dstfile = ds_open(datasink, trim_dotslash(dst_file_path), - &cursor.statinfo); + dstfile = ds_open(datasink, dst_path, &cursor.statinfo); if (dstfile == NULL) { msg("[%02u] error: " "cannot open the destination stream for %s\n", diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 59569fc625d..c50e401859b 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -480,7 +480,7 @@ get_mysql_vars(MYSQL *connection) innodb_data_file_path_var, MYF(MY_FAE)); } - if (innodb_data_home_dir_var && *innodb_data_home_dir_var) { + if (innodb_data_home_dir_var) { innobase_data_home_dir = my_strdup( innodb_data_home_dir_var, MYF(MY_FAE)); } @@ -1607,6 +1607,44 @@ cleanup: extern const char *innodb_checksum_algorithm_names[]; +#ifdef _WIN32 +#include <algorithm> +#endif + +static std::string make_local_paths(const char *data_file_path) +{ + if (strchr(data_file_path, '/') == 0 +#ifdef _WIN32 + && strchr(data_file_path, '\\') == 0 +#endif + ){ + return std::string(data_file_path); + } + + std::ostringstream buf; + + char *dup = strdup(innobase_data_file_path); + ut_a(dup); + char *p; + char * token = strtok_r(dup, ";", &p); + while (token) { + if (buf.tellp()) + buf << ";"; + + char *fname = strrchr(token, '/'); +#ifdef _WIN32 + fname = std::max(fname,strrchr(token, '\\')); +#endif + if (fname) + buf << fname + 1; + else + buf << token; + token = strtok_r(NULL, ";", &p); + } + free(dup); + return buf.str(); +} + bool write_backup_config_file() { int rc= backup_file_printf("backup-my.cnf", @@ -1623,7 +1661,7 @@ bool write_backup_config_file() "%s%s\n" "%s\n", innodb_checksum_algorithm_names[srv_checksum_algorithm], - innobase_data_file_path, + make_local_paths(innobase_data_file_path).c_str(), srv_n_log_files, srv_log_file_size, srv_page_size, diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 1774f8473bb..654d62a6cb5 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4562,8 +4562,6 @@ xtrabackup_apply_delta( posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL); - os_file_set_nocache(src_file, src_path, "OPEN"); - dst_file = xb_delta_open_matching_space( dbname, space_name, info, dst_path, sizeof(dst_path), &success); @@ -4574,8 +4572,6 @@ xtrabackup_apply_delta( posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED); - os_file_set_nocache(dst_file, dst_path, "OPEN"); - /* allocate buffer for incremental backup (4096 pages) */ incremental_buffer_base = static_cast<byte *> (malloc((page_size / 4 + 1) * page_size)); @@ -4681,6 +4677,13 @@ xtrabackup_apply_delta( } } + /* Free file system buffer cache after the batch was written. */ +#ifdef __linux__ + os_file_flush_func(dst_file); +#endif + posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED); + + incremental_buffers++; } |