diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2023-01-28 18:22:55 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2023-01-28 18:22:55 +0100 |
commit | a977054ee0bd1601a5252ec02459bac0241d9bfc (patch) | |
tree | fa5d780bbdcd977294e519e6890fa2ea48436f8c /extra | |
parent | 765291d63e0c2a10c513a354e9ecb2e905570775 (diff) | |
parent | c73985f2ce8a391582787f3e310a011c1a712bec (diff) | |
download | mariadb-git-a977054ee0bd1601a5252ec02459bac0241d9bfc.tar.gz |
Merge branch '10.3' into 10.4
Diffstat (limited to 'extra')
-rw-r--r-- | extra/innochecksum.cc | 8 | ||||
-rw-r--r-- | extra/mariabackup/backup_copy.cc | 49 | ||||
-rw-r--r-- | extra/mariabackup/xbcloud.cc | 7 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 11 |
4 files changed, 62 insertions, 13 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 7252d008ea7..67528827dc0 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -835,7 +835,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; @@ -843,11 +843,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 (mach_read_from_2(page + FIL_PAGE_TYPE)) { diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index f24b068fdf4..e7d69a25b76 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -57,6 +57,9 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include "backup_copy.h" #include "backup_mysql.h" #include <btr0btr.h> +#ifdef _WIN32 +#include <direct.h> /* rmdir */ +#endif #define ROCKSDB_BACKUP_DIR "#rocksdb" @@ -1619,7 +1622,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", @@ -1702,6 +1747,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 11e638e307c..bb440eec7f8 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -4460,11 +4460,13 @@ static bool xtrabackup_backup_low() dst_log_file = NULL; - 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 = log_copy_scanned_lsn; @@ -6211,7 +6213,8 @@ static bool xtrabackup_prepare_func(char** argv) 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) |