summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2023-02-16 13:34:45 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2023-02-16 13:34:45 +0200
commit2e431ff7e69d9c887777cc597ccf5cfb446e13d8 (patch)
tree98be0df7531bbe1f26e1f339cf18430556bca933 /extra
parent80b4fa54e1d38c8f90f6b94240c583aa9d4627b7 (diff)
parent1fd00998390a7487e42f5e29472e99354159c8bc (diff)
downloadmariadb-git-2e431ff7e69d9c887777cc597ccf5cfb446e13d8.tar.gz
Merge 10.11 into 11.0
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.cc32
-rw-r--r--extra/mariabackup/xtrabackup.h1
-rw-r--r--extra/wolfssl/CMakeLists.txt3
6 files changed, 77 insertions, 23 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 1f7f341e397..eaaeb0c36a5 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -773,7 +773,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;
@@ -781,11 +781,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 e0ea4a17ab8..055e8ab85ec 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -1294,7 +1294,7 @@ struct my_option xb_client_options[]= {
{"rsync", OPT_RSYNC,
"Uses the rsync utility to optimize local file "
- "transfers. When this option is specified, innobackupex uses rsync "
+ "transfers. When this option is specified, " XB_TOOL_NAME " uses rsync "
"to copy all non-InnoDB files instead of spawning a separate cp for "
"each file, which can be much faster for servers with a large number "
"of databases or tables. This option cannot be used together with "
@@ -1402,7 +1402,7 @@ struct my_option xb_client_options[]= {
{"ftwrl-wait-query-type", OPT_LOCK_WAIT_QUERY_TYPE,
"This option specifies which types of queries are allowed to complete "
- "before innobackupex will issue the global lock. Default is all.",
+ "before " XB_TOOL_NAME " will issue the global lock. Default is all.",
(uchar *) &opt_lock_wait_query_type, (uchar *) &opt_lock_wait_query_type,
&query_type_typelib, GET_ENUM, REQUIRED_ARG, QUERY_TYPE_ALL, 0, 0, 0, 0,
0},
@@ -1422,26 +1422,26 @@ struct my_option xb_client_options[]= {
NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"kill-long-queries-timeout", OPT_KILL_LONG_QUERIES_TIMEOUT,
- "This option specifies the number of seconds innobackupex waits "
+ "This option specifies the number of seconds " XB_TOOL_NAME " waits "
"between starting FLUSH TABLES WITH READ LOCK and killing those "
"queries that block it. Default is 0 seconds, which means "
- "innobackupex will not attempt to kill any queries.",
+ XB_TOOL_NAME " will not attempt to kill any queries.",
(uchar *) &opt_kill_long_queries_timeout,
(uchar *) &opt_kill_long_queries_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0,
0, 0, 0, 0},
{"ftwrl-wait-timeout", OPT_LOCK_WAIT_TIMEOUT,
- "This option specifies time in seconds that innobackupex should wait "
+ "This option specifies time in seconds that " XB_TOOL_NAME " should wait "
"for queries that would block FTWRL before running it. If there are "
- "still such queries when the timeout expires, innobackupex terminates "
- "with an error. Default is 0, in which case innobackupex does not "
+ "still such queries when the timeout expires, " XB_TOOL_NAME " terminates "
+ "with an error. Default is 0, in which case " XB_TOOL_NAME " does not "
"wait for queries to complete and starts FTWRL immediately.",
(uchar *) &opt_lock_wait_timeout, (uchar *) &opt_lock_wait_timeout, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ftwrl-wait-threshold", OPT_LOCK_WAIT_THRESHOLD,
"This option specifies the query run time threshold which is used by "
- "innobackupex to detect long-running queries with a non-zero value "
+ XB_TOOL_NAME " to detect long-running queries with a non-zero value "
"of --ftwrl-wait-timeout. FTWRL is not started until such "
"long-running queries exist. This option has no effect if "
"--ftwrl-wait-timeout is 0. Default value is 60 seconds.",
@@ -3106,7 +3106,8 @@ static bool xtrabackup_copy_logfile()
mysql_mutex_lock(&recv_sys.mutex);
}
- msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn);
+ if (verbose)
+ msg(">> log scanned up to (" LSN_PF ")", recv_sys.lsn);
return false;
}
@@ -3149,7 +3150,7 @@ static void log_copying_thread()
my_thread_end();
}
-/** whether io_watching_thread() is active; protected by log_sys.mutex */
+/** whether io_watching_thread() is active; protected by recv_sys.mutex */
static bool have_io_watching_thread;
/* io throttle watching (rough) */
@@ -4431,11 +4432,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;
@@ -6025,7 +6028,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)
diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h
index 3796c9ec698..d2a5e31645b 100644
--- a/extra/mariabackup/xtrabackup.h
+++ b/extra/mariabackup/xtrabackup.h
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "changed_page_bitmap.h"
#include <set>
+#define XB_TOOL_NAME "mariadb-backup"
#define XB_HISTORY_TABLE "mysql.mariadb_backup_history"
struct xb_delta_info_t
diff --git a/extra/wolfssl/CMakeLists.txt b/extra/wolfssl/CMakeLists.txt
index 5f446663dc8..390a618ac91 100644
--- a/extra/wolfssl/CMakeLists.txt
+++ b/extra/wolfssl/CMakeLists.txt
@@ -12,6 +12,9 @@ IF(MSVC_INTEL)
SET(WOLFSSL_X86_64_BUILD 1)
SET(HAVE_INTEL_RDSEED 1)
SET(HAVE_INTEL_RDRAND 1)
+ELSEIF(CMAKE_ASM_COMPILER_ID MATCHES "Clang" AND CMAKE_VERSION VERSION_LESS 3.16)
+
+ # WolfSSL 5.5.4 bug workaround below does not work, due to some CMake bug
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
SET(WOLFSSL_X86_64_BUILD 1)
IF(CMAKE_C_COMPILER_ID MATCHES GNU AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)