Commit 282ba973 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-18549 Failing assertion: opt_no_lock during mariabackup --backup

The assertion happens under BACKUP STAGE BLOCK_COMMIT, when a DDL on a
temporary table (#sql-xxx) is found.

Apparently, assumption that all DDLs are blocked under FTWRL does not
hold for BACKUP STAGE, and temporary tables can still have ALTERs

The fix is to relax the assertion, and only check for opt_no_lock if
backup is *really* inconsistent, i.e either optimized DDL or CREATE/RENAME
are done on the tables that were not skipped during backup.
parent ea0be9e2
...@@ -644,7 +644,6 @@ static void backup_file_op_fail(ulint space_id, const byte* flags, ...@@ -644,7 +644,6 @@ static void backup_file_op_fail(ulint space_id, const byte* flags,
const byte* name, ulint len, const byte* name, ulint len,
const byte* new_name, ulint new_len) const byte* new_name, ulint new_len)
{ {
ut_a(opt_no_lock);
bool fail; bool fail;
if (flags) { if (flags) {
msg("DDL tracking : create %zu \"%.*s\": %x", msg("DDL tracking : create %zu \"%.*s\": %x",
...@@ -665,6 +664,7 @@ static void backup_file_op_fail(ulint space_id, const byte* flags, ...@@ -665,6 +664,7 @@ static void backup_file_op_fail(ulint space_id, const byte* flags,
msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name);
} }
if (fail) { if (fail) {
ut_a(opt_no_lock);
die("DDL operation detected in the late phase of backup." die("DDL operation detected in the late phase of backup."
"Backup is inconsistent. Remove --no-lock option to fix."); "Backup is inconsistent. Remove --no-lock option to fix.");
} }
...@@ -685,9 +685,9 @@ static void backup_optimized_ddl_op(ulint space_id) ...@@ -685,9 +685,9 @@ static void backup_optimized_ddl_op(ulint space_id)
run with --no-lock. Usually aborts the backup. run with --no-lock. Usually aborts the backup.
*/ */
static void backup_optimized_ddl_op_fail(ulint space_id) { static void backup_optimized_ddl_op_fail(ulint space_id) {
ut_a(opt_no_lock);
msg("DDL tracking : optimized DDL on space %zu", space_id); msg("DDL tracking : optimized DDL on space %zu", space_id);
if (ddl_tracker.tables_in_backup.find(space_id) != ddl_tracker.tables_in_backup.end()) { if (ddl_tracker.tables_in_backup.find(space_id) != ddl_tracker.tables_in_backup.end()) {
ut_a(opt_no_lock);
msg("ERROR : Optimized DDL operation detected in the late phase of backup." msg("ERROR : Optimized DDL operation detected in the late phase of backup."
"Backup is inconsistent. Remove --no-lock option to fix."); "Backup is inconsistent. Remove --no-lock option to fix.");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment