A cleanup for MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used

Fixing buildbot failures on mariabackup.aria_log_dir_path_rel.

The problem was that directory_exists() was called with the
relative aria_log_dir_path value, while the current directory
in mariadb-backup is not necessarily equal to datadir when MTR is running.

Fix:

- Moving building the absolute path un level upper:
  from the function copy_back_aria_logs() to the function copy_back().
- Passing the built absolute path to both directory_exists() and
  copy_back_aria_logs() as a parameter.
This commit is contained in:
Alexander Barkov 2023-04-24 10:27:55 +04:00
parent 6dc6c22c14
commit d3e394b3b1

View file

@ -1849,10 +1849,8 @@ is_aria_log_dir_file(const datadir_node_t &node)
bool bool
copy_back_aria_logs() copy_back_aria_logs(const char *dstdir)
{ {
Copy_back_dst_dir dst_dir_buf;
const char *dstdir= dst_dir_buf.make(aria_log_dir_path);
std::unique_ptr<ds_ctxt_t, void (&)(ds_ctxt_t*)> std::unique_ptr<ds_ctxt_t, void (&)(ds_ctxt_t*)>
ds_ctxt_aria_log_dir_path(ds_create(dstdir, DS_TYPE_LOCAL), ds_destroy); ds_ctxt_aria_log_dir_path(ds_create(dstdir, DS_TYPE_LOCAL), ds_destroy);
@ -1907,8 +1905,11 @@ copy_back()
&& !directory_exists(srv_log_group_home_dir, true)) { && !directory_exists(srv_log_group_home_dir, true)) {
return(false); return(false);
} }
Copy_back_dst_dir aria_log_dir_path_dst;
const char *aria_log_dir_path_abs= aria_log_dir_path_dst.make(aria_log_dir_path);
if (aria_log_dir_path && *aria_log_dir_path if (aria_log_dir_path && *aria_log_dir_path
&& !directory_exists(aria_log_dir_path, true)) { && !directory_exists(aria_log_dir_path_abs, true)) {
return false; return false;
} }
@ -1919,7 +1920,7 @@ copy_back()
return(false); return(false);
} }
if (!copy_back_aria_logs()) if (!copy_back_aria_logs(aria_log_dir_path_abs))
return false; return false;
/* parse data file path */ /* parse data file path */