summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-06-30 16:39:20 +0200
committerSergei Golubchik <serg@mariadb.org>2018-06-30 16:39:20 +0200
commit36e59752e7fc70bc5179a3d730b5ce3ee58e4e30 (patch)
tree0d3e30ce973b2e1f044931c0eb1846d7192becda /extra
parent7c0779da7c37f6ef6eff2f79dda6f1b0c57e3869 (diff)
parent1dd3c8f8ba49ec06e550d7376d27ff05ce024bec (diff)
downloadmariadb-git-36e59752e7fc70bc5179a3d730b5ce3ee58e4e30.tar.gz
Merge branch '10.2' into 10.3
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/backup_mysql.cc10
-rw-r--r--extra/mariabackup/xtrabackup.cc24
2 files changed, 26 insertions, 8 deletions
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index 3517d9136d4..d04f680c8ef 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -187,6 +187,7 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
if (!use_result) {
mysql_free_result(mysql_result);
+ mysql_result = NULL;
}
}
@@ -1784,12 +1785,17 @@ mdl_lock_table(ulint space_id)
MYSQL_RES *mysql_result = xb_mysql_query(mdl_con, oss.str().c_str(), true, true);
while (MYSQL_ROW row = mysql_fetch_row(mysql_result)) {
+
+ DBUG_EXECUTE_IF("rename_during_mdl_lock_table",
+ if (strcmp(row[0], "test/t1") == 0)
+ xb_mysql_query(mysql_connection, "RENAME TABLE test.t1 to test.t2", false, true
+ ););
+
std::string full_table_name = ut_get_name(0,row[0]);
std::ostringstream lock_query;
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
-
msg_ts("Locking MDL for %s\n", full_table_name.c_str());
- xb_mysql_query(mdl_con, lock_query.str().c_str(), false, false);
+ xb_mysql_query(mdl_con, lock_query.str().c_str(), false, true);
}
pthread_mutex_unlock(&mdl_lock_con_mutex);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 828cff8e906..33a8e638ccf 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -109,6 +109,7 @@ int sys_var_init();
char xtrabackup_real_target_dir[FN_REFLEN] = "./xtrabackup_backupfiles/";
char *xtrabackup_target_dir= xtrabackup_real_target_dir;
static my_bool xtrabackup_version;
+static my_bool verbose;
my_bool xtrabackup_backup;
my_bool xtrabackup_prepare;
my_bool xtrabackup_copy_back;
@@ -692,6 +693,9 @@ enum options_xtrabackup
struct my_option xb_client_options[] =
{
+ {"verbose", 'V', "display verbose output",
+ (G_PTR*) &verbose, (G_PTR*) &verbose, 0, GET_BOOL, NO_ARG,
+ FALSE, 0, 0, 0, 0, 0},
{"version", 'v', "print xtrabackup version information",
(G_PTR *) &xtrabackup_version, (G_PTR *) &xtrabackup_version, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -1236,7 +1240,7 @@ struct my_option xb_server_options[] =
&xb_rocksdb_datadir, &xb_rocksdb_datadir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "backup-rocksdb", OPT_BACKUP_ROCKSDB, "Backup rocksdb data, if rocksdb plugin is installed."
+ { "rocksdb-backup", OPT_BACKUP_ROCKSDB, "Backup rocksdb data, if rocksdb plugin is installed."
"Used only with --backup option. Can be useful for partial backups, to exclude all rocksdb data",
&xb_backup_rocksdb, &xb_backup_rocksdb,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
@@ -1749,7 +1753,7 @@ static bool innodb_init_param()
srv_max_n_open_files = ULINT_UNDEFINED - 5;
srv_innodb_status = (ibool) innobase_create_status_file;
- srv_print_verbose_log = 1;
+ srv_print_verbose_log = verbose ? 2 : 1;
/* Store the default charset-collation number of this MySQL
installation */
@@ -2459,9 +2463,10 @@ skip:
/** Copy redo log blocks to the data sink.
@param start_lsn buffer start LSN
@param end_lsn buffer end LSN
+@param last whether we are copying the final part of the log
@return last scanned LSN
@retval 0 on failure */
-static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn)
+static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
{
lsn_t scanned_lsn = start_lsn;
const byte* log_block = log_sys.buf;
@@ -2520,7 +2525,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn)
log_sys.log.scanned_lsn = scanned_lsn;
- end_lsn = metadata_to_lsn
+ end_lsn = last
? ut_uint64_align_up(scanned_lsn, OS_FILE_LOG_BLOCK_SIZE)
: scanned_lsn & ~lsn_t(OS_FILE_LOG_BLOCK_SIZE - 1);
@@ -2540,8 +2545,9 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn)
}
/** Copy redo log until the current end of the log is reached
+@param last whether we are copying the final part of the log
@return whether the operation failed */
-static bool xtrabackup_copy_logfile()
+static bool xtrabackup_copy_logfile(bool last = false)
{
ut_a(dst_log_file != NULL);
ut_ad(recv_sys != NULL);
@@ -2571,7 +2577,7 @@ static bool xtrabackup_copy_logfile()
}
start_lsn = (lsn == start_lsn)
- ? 0 : xtrabackup_copy_log(start_lsn, lsn);
+ ? 0 : xtrabackup_copy_log(start_lsn, lsn, last);
log_mutex_exit();
@@ -3701,6 +3707,12 @@ static bool xtrabackup_backup_low()
stop_backup_threads();
+ if (metadata_to_lsn && xtrabackup_copy_logfile(true)) {
+ ds_close(dst_log_file);
+ dst_log_file = NULL;
+ return false;
+ }
+
if (ds_close(dst_log_file) || !metadata_to_lsn) {
dst_log_file = NULL;
return false;