diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-04-21 11:58:32 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-04-21 11:58:32 +0300 |
commit | ea94717983903860a1ffadbe96aba69b5555545e (patch) | |
tree | 4347472e159abe2919e55cfb61dff60db25e4e3f /extra | |
parent | 0c02c91bc144a79c77fc5d5f0d28184c90f34933 (diff) | |
parent | 3d1ad2a5e85284b5ec4bb28f744b93b0b73e3934 (diff) | |
download | mariadb-git-ea94717983903860a1ffadbe96aba69b5555545e.tar.gz |
Merge 10.1 into 10.2
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 6b215a8a1c2..d4239152f30 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 ff0d4f0453a..30bbf67807e 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4566,8 +4566,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); @@ -4578,8 +4576,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)); @@ -4685,6 +4681,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++; } |