summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2023-01-31 11:01:48 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2023-01-31 11:01:48 +0100
commit76bcea3154a3ac2c26024ac5cb241e19e0e277d9 (patch)
treecbe9339633c5eb6b9206c89a3b1c65495f05e868 /extra
parent51fc6b91d2d3c40a69b78f2e47641107d65a957b (diff)
parentde2d08994255739d53ba28ea34288ca8352029b1 (diff)
downloadmariadb-git-76bcea3154a3ac2c26024ac5cb241e19e0e277d9.tar.gz
Merge branch '10.9' into 10.10
Diffstat (limited to 'extra')
-rw-r--r--extra/innochecksum.cc8
-rw-r--r--extra/mariabackup/backup_copy.cc49
-rw-r--r--extra/mariabackup/xbcloud.cc7
-rw-r--r--extra/mariabackup/xtrabackup.cc11
4 files changed, 62 insertions, 13 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index fc616f1aa14..cc8f8d14094 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -771,7 +771,7 @@ parse_page(
{
unsigned long long id;
uint16_t undo_page_type;
- char str[20]={'\0'};
+ const char *str;
ulint n_recs;
uint32_t page_no, left_page_no, right_page_no;
ulint data_bytes;
@@ -779,11 +779,7 @@ parse_page(
ulint size_range_id;
/* Check whether page is doublewrite buffer. */
- if(skip_page) {
- strcpy(str, "Double_write_buffer");
- } else {
- strcpy(str, "-");
- }
+ str = skip_page ? "Double_write_buffer" : "-";
switch (fil_page_get_type(page)) {
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 8647f5f005c..c3b909fc9b9 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -58,6 +58,9 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "backup_debug.h"
#include "backup_mysql.h"
#include <btr0btr.h>
+#ifdef _WIN32
+#include <direct.h> /* rmdir */
+#endif
#ifdef _WIN32
#include <aclapi.h>
@@ -1562,7 +1565,49 @@ bool backup_finish()
return(true);
}
-bool
+
+/*
+ Drop all empty database directories in the base backup
+ that do not exists in the icremental backup.
+
+ This effectively re-plays all DROP DATABASE statements happened
+ in between base backup and incremental backup creation time.
+
+ Note, only checking if base_dir/db/ is empty is not enough,
+ because inc_dir/db/db.opt might have been dropped for some reasons,
+ which may also result into empty base_dir/db/.
+
+ Only the fact that at the same time:
+ - base_dir/db/ exists
+ - inc_dir/db/ does not exist
+ means that DROP DATABASE happened.
+*/
+static void
+ibx_incremental_drop_databases(const char *base_dir,
+ const char *inc_dir)
+{
+ datadir_node_t node;
+ datadir_node_init(&node);
+ datadir_iter_t *it = datadir_iter_new(base_dir);
+
+ while (datadir_iter_next(it, &node)) {
+ if (node.is_empty_dir) {
+ char path[FN_REFLEN];
+ snprintf(path, sizeof(path), "%s/%s",
+ inc_dir, node.filepath_rel);
+ if (!directory_exists(path, false)) {
+ msg("Removing %s", node.filepath);
+ rmdir(node.filepath);
+ }
+ }
+
+ }
+ datadir_iter_free(it);
+ datadir_node_free(&node);
+}
+
+
+static bool
ibx_copy_incremental_over_full()
{
const char *ext_list[] = {"frm", "isl", "MYD", "MYI", "MAD", "MAI",
@@ -1645,6 +1690,8 @@ ibx_copy_incremental_over_full()
}
copy_or_move_dir(path, ROCKSDB_BACKUP_DIR, true, true);
}
+ ibx_incremental_drop_databases(xtrabackup_target_dir,
+ xtrabackup_incremental_dir);
}
diff --git a/extra/mariabackup/xbcloud.cc b/extra/mariabackup/xbcloud.cc
index fed937be834..cee76e5f3d7 100644
--- a/extra/mariabackup/xbcloud.cc
+++ b/extra/mariabackup/xbcloud.cc
@@ -1676,8 +1676,11 @@ container_list_add_object(container_list *list, const char *name,
list->object_count += object_count_step;
}
assert(list->idx <= list->object_count);
- strcpy(list->objects[list->idx].name, name);
- strcpy(list->objects[list->idx].hash, hash);
+ safe_strcpy(list->objects[list->idx].name,
+ sizeof(list->objects[list->idx].name), name);
+ safe_strcpy(list->objects[list->idx].hash,
+ sizeof(list->objects[list->idx].hash), hash);
+
list->objects[list->idx].bytes = bytes;
++list->idx;
}
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index ef826a40105..6f5e99449c8 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -4515,11 +4515,13 @@ static bool xtrabackup_backup_low()
return false;
}
- if(!xtrabackup_incremental) {
- strcpy(metadata_type, "full-backuped");
+ if (!xtrabackup_incremental) {
+ safe_strcpy(metadata_type, sizeof(metadata_type),
+ "full-backuped");
metadata_from_lsn = 0;
} else {
- strcpy(metadata_type, "incremental");
+ safe_strcpy(metadata_type, sizeof(metadata_type),
+ "incremental");
metadata_from_lsn = incremental_lsn;
}
metadata_last_lsn = recv_sys.lsn;
@@ -6109,7 +6111,8 @@ error:
if (ok) {
char filename[FN_REFLEN];
- strcpy(metadata_type, "log-applied");
+ safe_strcpy(metadata_type, sizeof(metadata_type),
+ "log-applied");
if(xtrabackup_incremental
&& metadata_to_lsn < incremental_to_lsn)