summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2023-03-17 18:51:33 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2023-03-21 11:16:51 +0300
commitf8c3d4c2d503e2343303fe506826a5a2ecffbae2 (patch)
treef31374a53f947281daeda63aac0c45660accafc3 /extra
parenta2cb6d8760362dbbe874cae3067b20f88242aaf3 (diff)
downloadmariadb-git-f8c3d4c2d503e2343303fe506826a5a2ecffbae2.tar.gz
MDEV-28187 mariadb-backup doesn't utilise innodb-undo-log-directory (if specified as a relative path) during copy-back operation
Make absolute destination path from relative one, basing on mysql data directory. Reviewed by Alexander Barkov.
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/backup_copy.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index e7d69a25b76..608be7125bd 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1816,13 +1816,28 @@ apply_log_finish()
return(true);
}
+class Copy_back_dst_dir
+{
+ std::string buf;
+
+public:
+ const char *make(const char *path)
+ {
+ if (!path || !path[0])
+ return mysql_data_home;
+ if (is_absolute_path(path))
+ return path;
+ return buf.assign(mysql_data_home).append(path).c_str();
+ }
+};
+
bool
copy_back()
{
bool ret = false;
datadir_iter_t *it = NULL;
datadir_node_t node;
- char *dst_dir;
+ const char *dst_dir;
memset(&node, 0, sizeof(node));
@@ -1875,9 +1890,9 @@ copy_back()
/* copy undo tablespaces */
+ Copy_back_dst_dir dst_dir_buf;
- dst_dir = (srv_undo_dir && *srv_undo_dir)
- ? srv_undo_dir : mysql_data_home;
+ dst_dir = dst_dir_buf.make(srv_undo_dir);
ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);
@@ -1898,8 +1913,7 @@ copy_back()
/* copy redo logs */
- dst_dir = (srv_log_group_home_dir && *srv_log_group_home_dir)
- ? srv_log_group_home_dir : mysql_data_home;
+ dst_dir = dst_dir_buf.make(srv_log_group_home_dir);
/* --backup generates a single ib_logfile0, which we must copy
if it exists. */
@@ -1926,8 +1940,7 @@ copy_back()
/* copy innodb system tablespace(s) */
- dst_dir = (innobase_data_home_dir && *innobase_data_home_dir)
- ? innobase_data_home_dir : mysql_data_home;
+ dst_dir = dst_dir_buf.make(innobase_data_home_dir);
ds_data = ds_create(dst_dir, DS_TYPE_LOCAL);