Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extra/mariabackup/backup_copy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,7 @@ bool backup_start(ds_ctxt *ds_data, ds_ctxt *ds_meta,

corrupted_pages.backup_fix_ddl(ds_data, ds_meta);

DBUG_MARIABACKUP_EVENT("after_backup_fix_ddl", {});
// There is no need to stop slave thread before coping non-Innodb data when
// --no-lock option is used because --no-lock option requires that no DDL or
// DML to non-transaction tables can occur.
Expand Down
14 changes: 13 additions & 1 deletion extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,19 @@ static void backup_file_op_fail(uint32_t space_id, int type,
filename_to_spacename(name, len).c_str());
msg("DDL tracking : delete %" PRIu32 " \"%.*s\"",
space_id, int(len), name);
error= "delete";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line had been indented with TAB consistently with the rest of the function. Here the indentation is being changed without any good reason.

if (fail && !opt_no_lock &&
check_if_fts_table(
filename_to_spacename(name, len).c_str())) {
Comment on lines 1072 to +1077
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before the switch block, can we assign

const std::string spacename{filename_to_spacename(name, len)};

and replace each occurrence of filename_to_spacename(name, len) with spacename, like it was done in 63a7e4c and b1829ff?

/* Ignore the FTS internal table because InnoDB does
drop intermediate table and their associative FTS
Comment on lines +1078 to +1079
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace "does drop" with "may drop".

internal table as a part of inplace rollback operation.
backup_set_alter_copy_lock() downgrades the
MDL_BACKUP_DDL before inplace phase of alter.
This leads to the FTS internal table being
dropped in the late phase of backup. */
Comment on lines +1083 to +1084
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence feels redundant to me.

fail = false;
}
error= "delete";
break;
default:
ut_ad(0);
Expand Down
18 changes: 18 additions & 0 deletions mysql-test/suite/mariabackup/alter_copy_race.result
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,21 @@ SELECT * FROM t1;
i
1
DROP TABLE t1;
#
# MDEV-38041 MariaBackup fails during rollback of
# inplace FTS alter table
#
CREATE TABLE t1(f1 int, f2 char(100), fulltext(f2)) ENGINE=InnoDB;
INSERT into t1 values(1, "MariaDB"), (1, "MySQL");
connect con2, localhost, root,,;
set lock_wait_timeout=1;
SET debug_sync='copy_data_between_tables_before_reset_backup_lock SIGNAL go WAIT_FOR after_backup_stage_block_commit';
SET debug_sync='alter_table_after_temp_table_drop SIGNAL temp_table_dropped';
SET debug_sync='now WAIT_FOR after_backup_stage_start';ALTER TABLE test.t1 ADD PRIMARY KEY(f1), algorithm=COPY;|
connection default;
connection con2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SET debug_sync='RESET';
disconnect con2;
connection default;
DROP TABLE t1;
39 changes: 39 additions & 0 deletions mysql-test/suite/mariabackup/alter_copy_race.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,42 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
SELECT * FROM t1;
DROP TABLE t1;
rmdir $targetdir;

--echo #
--echo # MDEV-38041 MariaBackup fails during rollback of
--echo # inplace FTS alter table
--echo #

let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;

CREATE TABLE t1(f1 int, f2 char(100), fulltext(f2)) ENGINE=InnoDB;
INSERT into t1 values(1, "MariaDB"), (1, "MySQL");

connect con2, localhost, root,,;
set lock_wait_timeout=1;
SET debug_sync='copy_data_between_tables_before_reset_backup_lock SIGNAL go WAIT_FOR after_backup_stage_block_commit';
SET debug_sync='alter_table_after_temp_table_drop SIGNAL temp_table_dropped';
DELIMITER |;
send SET debug_sync='now WAIT_FOR after_backup_stage_start';ALTER TABLE test.t1 ADD PRIMARY KEY(f1), algorithm=COPY;|
DELIMITER ;|
connection default;

# setup mariabackup events
let backup_fix_ddl=;
let after_backup_stage_start=SET debug_sync='now SIGNAL after_backup_stage_start WAIT_FOR go';
let after_backup_stage_block_commit=SET debug_sync='now SIGNAL after_backup_stage_block_commit';
let after_backup_fix_ddl=SET debug_sync='now WAIT_FOR temp_table_dropped';
let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events > $backup_log 2>&1;
--enable_result_log

connection con2;
--error ER_DUP_ENTRY
reap;
SET debug_sync='RESET';
disconnect con2;

connection default;
DROP TABLE t1;
rmdir $targetdir;