Debian Codegraph @

mysql-test/suite/mariabackup/alter_copy_race.test

raw
1 --source include/have_innodb.inc
2 --source include/have_debug.inc
3 --source include/have_debug_sync.inc
4
5 # The test demonstrates that intermediate tables (ALTER TABLE...ALGORITHM=COPY)
6 # are not always properly locked, e.g., can be dropped after
7 # BACKUP STAGE BLOCK_COMMIT
8 # succeeded.
9 # Thus mariabackup decides not to have them in backup at all,
10 # since they keep changing even after the backup LSN was determined.
11
12 echo # xtrabackup backup;
13 let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
14
15 CREATE TABLE t1(i int) ENGINE=InnoDB;
16 INSERT into t1 values(1);
17
18 connect con2, localhost, root,,;
19 connection con2;
20 set lock_wait_timeout=1;
21 SET debug_sync='copy_data_between_tables_before_reset_backup_lock SIGNAL go WAIT_FOR after_backup_stage_block_ddl';
22 SET debug_sync='alter_table_after_temp_table_drop SIGNAL temp_table_dropped';
23 DELIMITER |;
24 send SET debug_sync='now WAIT_FOR after_backup_stage_start';ALTER TABLE test.t1 FORCE, algorithm=COPY;|
25 DELIMITER ;|
26 connection default;
27
28 # setup mariabackup events
29 let after_backup_stage_start=SET debug_sync='now SIGNAL after_backup_stage_start WAIT_FOR go';
30 let after_backup_stage_block_ddl=SET debug_sync='now SIGNAL after_backup_stage_block_ddl';
31 let backup_fix_ddl=SET debug_sync='now WAIT_FOR temp_table_dropped';
32 --disable_result_log
33 exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
34 --enable_result_log
35
36 connection con2;
37 --error ER_LOCK_WAIT_TIMEOUT
38 reap;
39 SET debug_sync='RESET';
40 disconnect con2;
41
42 connection default;
43 echo # xtrabackup prepare;
44 --disable_result_log
45 exec $XTRABACKUP --prepare --target-dir=$targetdir;
46 -- source include/restart_and_restore.inc
47 --enable_result_log
48
49 SELECT * FROM t1;
50 DROP TABLE t1;
51 rmdir $targetdir;
52
53 --echo #
54 --echo # MDEV-38041 MariaBackup fails during rollback of
55 --echo # inplace FTS alter table
56 --echo #
57
58 let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
59
60 CREATE TABLE t1(f1 int, f2 char(100), fulltext(f2)) ENGINE=InnoDB;
61 INSERT into t1 values(1, "MariaDB"), (1, "MySQL");
62
63 connect con2, localhost, root,,;
64 set lock_wait_timeout=1;
65 SET debug_sync='copy_data_between_tables_before_reset_backup_lock SIGNAL go WAIT_FOR after_backup_stage_block_ddl';
66 SET debug_sync='alter_table_after_temp_table_drop SIGNAL temp_table_dropped';
67 DELIMITER |;
68 send SET debug_sync='now WAIT_FOR after_backup_stage_start';ALTER TABLE test.t1 ADD PRIMARY KEY(f1), algorithm=COPY;|
69 DELIMITER ;|
70 connection default;
71
72 # setup mariabackup events
73 let backup_fix_ddl=;
74 let after_backup_stage_start=SET debug_sync='now SIGNAL after_backup_stage_start WAIT_FOR go';
75 let after_backup_stage_block_commit=SET debug_sync='now SIGNAL after_backup_stage_block_ddl';
76 let after_backup_fix_ddl=SET debug_sync='now WAIT_FOR temp_table_dropped';
77 let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log;
78 --disable_result_log
79 exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events > $backup_log 2>&1;
80 --enable_result_log
81
82 connection con2;
83 --error ER_DUP_ENTRY
84 reap;
85 SET debug_sync='RESET';
86 disconnect con2;
87
88 connection default;
89 DROP TABLE t1;
90 rmdir $targetdir;