From 11986ec6541733477cb5dd312bac1dc64ed7e57c Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 8 Apr 2024 14:56:31 +0400 Subject: [PATCH] MDEV-31251 MDEV-30968 breaks running mariabackup on older mariadb (opendir(NULL)) The problem happened when running mariabackup agains a pre-MDEV-30971 server, i.e. not having yet the system variable @@aria_log_dir_path. As a result, backup_start() called the function backup_files_from_datadir() with a NULL value, which further caused a crash. Fix: Perform this call: backup_files_from_datadir(.., aria_log_dir_path, ..) only if aria_log_dir_path is not NULL. Otherwise, assume that Aria log files are in their default location, so they've just copied by the previous call: backup_files_from_datadir(.., fil_path_to_mysql_datadir, ..) Thanks to Walter Doekes for a patch proposal. --- extra/mariabackup/backup_copy.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 7b3336f67b7..90081ccb650 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1439,9 +1439,10 @@ bool backup_start(ds_ctxt *ds_data, ds_ctxt *ds_meta, if (!backup_files_from_datadir(ds_data, fil_path_to_mysql_datadir, "aws-kms-key") || - !backup_files_from_datadir(ds_data, - aria_log_dir_path, - "aria_log")) { + (aria_log_dir_path && + !backup_files_from_datadir(ds_data, + aria_log_dir_path, + "aria_log"))) { return false; }