summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-11-19 20:43:04 +0100
committerMonty <monty@mariadb.org>2018-12-09 22:12:27 +0200
commitc0ca164b1ce48ec8bf9b95c95c94ba62dde1f29a (patch)
tree84759eeb0b9081986e10c048de3c4fdd7cc09115 /extra
parentc53aab974bef7d98810409029d996e89677d2f68 (diff)
downloadmariadb-git-c0ca164b1ce48ec8bf9b95c95c94ba62dde1f29a.tar.gz
MDEV-17308 mariabackup to use the BACKUP statement instead of FTWRL
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/backup_mysql.cc37
-rw-r--r--extra/mariabackup/xtrabackup.cc15
2 files changed, 21 insertions, 31 deletions
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index a142ad70b26..363fad3865f 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -971,28 +971,10 @@ lock_tables(MYSQL *connection)
}
if (opt_lock_ddl_per_table) {
+ /* TODO : Remove after MDEV-17772 is fixed */
start_mdl_waiters_killer();
}
- if (!opt_lock_wait_timeout && !opt_kill_long_queries_timeout) {
-
- /* We do first a FLUSH TABLES. If a long update is running, the
- FLUSH TABLES will wait but will not stall the whole mysqld, and
- when the long update is done the FLUSH TABLES WITH READ LOCK
- will start and succeed quickly. So, FLUSH TABLES is to lower
- the probability of a stage where both mysqldump and most client
- connections are stalled. Of course, if a second long update
- starts between the two FLUSHes, we have that bad stall.
-
- Option lock_wait_timeout serve the same purpose and is not
- compatible with this trick.
- */
-
- msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...\n");
-
- xb_mysql_query(connection,
- "FLUSH NO_WRITE_TO_BINLOG TABLES", false);
- }
if (opt_lock_wait_timeout) {
if (!wait_for_no_updates(connection, opt_lock_wait_timeout,
@@ -1001,7 +983,7 @@ lock_tables(MYSQL *connection)
}
}
- msg_ts("Executing FLUSH TABLES WITH READ LOCK...\n");
+ msg_ts("Acquiring BACKUP LOCKS...\n");
if (opt_kill_long_queries_timeout) {
start_query_killer();
@@ -1012,9 +994,13 @@ lock_tables(MYSQL *connection)
"SET SESSION wsrep_causal_reads=0", false);
}
- xb_mysql_query(connection, "FLUSH TABLES WITH READ LOCK", false);
+ xb_mysql_query(connection, "BACKUP STAGE START", true);
+ //xb_mysql_query(connection, "BACKUP STAGE FLUSH", true);
+ //xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true);
+ xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true);
if (opt_lock_ddl_per_table) {
+ /* TODO : Remove after MDEV-17772 is fixed */
stop_mdl_waiters_killer();
}
@@ -1058,13 +1044,8 @@ unlock_all(MYSQL *connection)
os_thread_sleep(opt_debug_sleep_before_unlock * 1000);
}
- if (binlog_locked) {
- msg_ts("Executing UNLOCK BINLOG\n");
- xb_mysql_query(connection, "UNLOCK BINLOG", false);
- }
-
- msg_ts("Executing UNLOCK TABLES\n");
- xb_mysql_query(connection, "UNLOCK TABLES", false);
+ msg_ts("Executing BACKUP STAGE END\n");
+ xb_mysql_query(connection, "BACKUP STAGE END", false);
msg_ts("All tables unlocked\n");
}
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index a79ad40b8e2..6058a022a05 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -474,9 +474,18 @@ DECLARE_THREAD(dbug_execute_in_new_connection)(void *arg)
dbug_thread_param_t *par= (dbug_thread_param_t *)arg;
int err = mysql_query(par->con, par->query);
int err_no = mysql_errno(par->con);
- DBUG_ASSERT(par->expect_err == err);
- if (err && par->expect_errno)
- DBUG_ASSERT(err_no == par->expect_errno);
+ if(par->expect_err != err)
+ {
+ msg("FATAL: dbug_execute_in_new_connection : mysql_query '%s' returns %d, instead of expected %d",
+ par->query, err, par->expect_err);
+ _exit(1);
+ }
+ if (err && par->expect_errno && par->expect_errno != err_no)
+ {
+ msg("FATAL: dbug_execute_in_new_connection: mysql_query '%s' returns mysql_errno %d, instead of expected %d",
+ par->query, err_no, par->expect_errno);
+ _exit(1);
+ }
mysql_close(par->con);
mysql_thread_end();
os_event_t done = par->done_event;