Debian Codegraph @

mysql-test/suite/mariabackup/alter_copy_excluded.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 # will not be included in a backup.
7
8 echo # xtrabackup backup;
9 let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
10
11 CREATE TABLE t1(i int, t text, fulltext index(t)) ENGINE=InnoDB;
12 INSERT into t1 values(1,'foo');
13
14 connect con2, localhost, root,,;
15 connection con2;
16 SET debug_sync='copy_data_between_tables_before_reset_backup_lock SIGNAL go WAIT_FOR after_backup_stage_block_commit' ;
17 DELIMITER |;
18 send SET debug_sync='now WAIT_FOR after_backup_stage_start';ALTER TABLE test.t1 DROP t, algorithm=COPY;|
19 DELIMITER ;|
20 connection default;
21
22 # Setup mariabackup events
23 # - After BACKUP STAGE START , let concurrent ALTER run, wand wait for it to create temporary tables
24 # - After BACKUP STAGE COMMIT, check that temporary files are in the database
25
26 let after_backup_stage_start=SET debug_sync='now SIGNAL after_backup_stage_start WAIT_FOR go';
27 DELIMITER |;
28 # The following query only works if there are innodb "intermediate" tables
29 # in the system tables , which we want to prove there
30 let after_backup_stage_block_commit=
31 IF (SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.innodb_sys_tablespaces WHERE name like '%/#sql%') THEN
32 SET debug_sync='now SIGNAL after_backup_stage_block_commit';
33 END IF|
34 DELIMITER ;|
35
36 --disable_result_log
37 exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
38 --enable_result_log
39
40 # There should be no temp files in the backup.
41 --list_files $targetdir/test #sql*
42
43 connection con2;
44 #Wait for ALTER to finish, cleanup
45 reap;
46 SET debug_sync='RESET';
47 disconnect con2;
48
49 connection default;
50 echo # xtrabackup prepare;
51 --disable_result_log
52 exec $XTRABACKUP --prepare --target-dir=$targetdir;
53 -- source include/restart_and_restore.inc
54 --enable_result_log
55
56 # Check there are no temp tablespaces in sys_tablespaces, after backup
57 SELECT * FROM t1;
58 DROP TABLE t1;
59 SELECT * FROM INFORMATION_SCHEMA.innodb_sys_tablespaces WHERE name like '%/#sql%' or name like 'test/%';
60
61 # Restart once again to clear first_start_after_backup flag
62 # This is to catch potential warnings, since "missing file" for #sql is suppressed
63 # during the first start after backup
64 --source include/restart_mysqld.inc
65
66 rmdir $targetdir;