summaryrefslogtreecommitdiff
path: root/extra/mariabackup/xtrabackup.cc
diff options
context:
space:
mode:
Diffstat (limited to 'extra/mariabackup/xtrabackup.cc')
-rw-r--r--extra/mariabackup/xtrabackup.cc62
1 files changed, 60 insertions, 2 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index bb1e2eaf42d..c1b2a1a9c85 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -240,7 +240,8 @@ long innobase_log_buffer_size = 1024*1024L;
long innobase_open_files = 300L;
longlong innobase_page_size = (1LL << 14); /* 16KB */
-char* innobase_buffer_pool_filename = NULL;
+char *innobase_buffer_pool_filename = NULL;
+char *buffer_pool_filename = NULL;
/* The default values for the following char* start-up parameters
are determined in innobase_init below: */
@@ -347,6 +348,7 @@ uint opt_lock_wait_timeout = 0;
uint opt_lock_wait_threshold = 0;
uint opt_debug_sleep_before_unlock = 0;
uint opt_safe_slave_backup_timeout = 0;
+uint opt_max_binlogs = UINT_MAX;
const char *opt_history = NULL;
@@ -1051,7 +1053,8 @@ enum options_xtrabackup
OPT_BACKUP_ROCKSDB,
OPT_XTRA_CHECK_PRIVILEGES,
OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION,
- OPT_INNODB_FORCE_RECOVERY
+ OPT_INNODB_FORCE_RECOVERY,
+ OPT_MAX_BINLOGS
};
struct my_option xb_client_options[]= {
@@ -1454,6 +1457,17 @@ struct my_option xb_client_options[]= {
&opt_log_innodb_page_corruption, &opt_log_innodb_page_corruption, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"sst_max_binlogs", OPT_MAX_BINLOGS,
+ "Number of recent binary logs to be included in the backup. "
+ "Setting this parameter to zero normally disables transmission "
+ "of binary logs to the joiner nodes during SST using Galera. "
+ "But sometimes a single current binlog can still be transmitted "
+ "to the joiner even with sst_max_binlogs=0, because it is "
+ "required for Galera to work properly with GTIDs support.",
+ (G_PTR *) &opt_max_binlogs,
+ (G_PTR *) &opt_max_binlogs, 0, GET_UINT, OPT_ARG,
+ UINT_MAX, 0, UINT_MAX, 0, 1, 0},
+
#define MYSQL_CLIENT
#include "sslopt-longopts.h"
#undef MYSQL_CLIENT
@@ -6272,6 +6286,44 @@ check_all_privileges()
}
}
+static
+void
+xb_init_buffer_pool(const char * filename)
+{
+ if (filename &&
+#ifdef _WIN32
+ (filename[0] == '/' ||
+ filename[0] == '\\' ||
+ strchr(filename, ':')))
+#else
+ filename[0] == FN_LIBCHAR)
+#endif
+ {
+ buffer_pool_filename = strdup(filename);
+ } else {
+ char filepath[FN_REFLEN];
+ char *dst_dir =
+ (innobase_data_home_dir && *innobase_data_home_dir) ?
+ innobase_data_home_dir : mysql_data_home;
+ size_t dir_length;
+ if (dst_dir && *dst_dir) {
+ dir_length = strlen(dst_dir);
+ while (IS_TRAILING_SLASH(dst_dir, dir_length)) {
+ dir_length--;
+ }
+ memcpy(filepath, dst_dir, dir_length);
+ }
+ else {
+ filepath[0] = '.';
+ dir_length = 1;
+ }
+ snprintf(filepath + dir_length,
+ sizeof(filepath) - dir_length, "%c%s", FN_LIBCHAR,
+ filename ? filename : "ib_buffer_pool");
+ buffer_pool_filename = strdup(filepath);
+ }
+}
+
bool
xb_init()
{
@@ -6336,11 +6388,15 @@ xb_init()
if (!get_mysql_vars(mysql_connection)) {
return(false);
}
+ xb_init_buffer_pool(buffer_pool_filename);
+
if (opt_check_privileges) {
check_all_privileges();
}
history_start_time = time(NULL);
+ } else {
+ xb_init_buffer_pool(innobase_buffer_pool_filename);
}
return(true);
@@ -6634,6 +6690,8 @@ int main(int argc, char **argv)
free_error_messages();
mysql_mutex_destroy(&LOCK_error_log);
+ free(buffer_pool_filename);
+
if (status == EXIT_SUCCESS) {
msg("completed OK!");
}