Debian Codegraph @

mysql-test/suite/mariabackup/incremental_backup.test

raw
1 --source include/have_aria.inc
2 --source include/innodb_page_size.inc
3 --source include/innodb_undo_tablespaces.inc
4
5 # see suite.pm "check for exact values, in case the default changes to be small everywhere"
6 if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 65536`) {
7 skip skipped on 32bit; # tries to allocate 1GB of memory
8 }
9
10 call mtr.add_suppression("InnoDB: New log files created");
11
12 let $test_comp=`select @@innodb_page_size < 32768`;
13 let basedir=$MYSQLTEST_VARDIR/tmp/backup;
14 let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
15
16 CREATE TABLE t_aria(i INT) ENGINE ARIA;
17 CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
18 # MDEV-515 takes X-lock on the table for the first insert.
19 # So concurrent insert won't happen on the table
20 INSERT INTO t VALUES(100);
21 if ($test_comp) {
22 # If MDEV-28474 is not fixed, backup preparing will crash with SIGSEGV.
23 --disable_query_log
24 --disable_result_log
25 CREATE TABLE t_comp(i INT PRIMARY KEY) ENGINE INNODB ROW_FORMAT=COMPRESSED;
26 --enable_query_log
27 --enable_result_log
28 }
29 BEGIN;
30 INSERT INTO t VALUES(2);
31 connect (con1,localhost,root,,);
32 SET GLOBAL innodb_flush_log_at_trx_commit = 1;
33 INSERT INTO t VALUES(1);
34
35 echo # Create full backup , modify table, then create incremental/differential backup;
36 --disable_result_log
37 exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir --throttle=1000;
38 --enable_result_log
39 BEGIN;
40 INSERT INTO t VALUES(0);
41 DELETE FROM t WHERE i=0;
42 connection default;
43 COMMIT;
44
45 --echo # Generate enough aria log records to increase area log file size
46 --disable_query_log
47 --disable_result_log
48 INSERT INTO t_aria VALUES
49 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
50 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
51 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
52 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
53 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
54 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
55 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
56 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
57 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
58 (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
59 --let $i = 4
60 while ($i) {
61 INSERT INTO t_aria SELECT * FROM seq_1_to_2000;
62 --dec $i
63 }
64 --enable_query_log
65 --enable_result_log
66
67 SELECT * FROM t;
68 # wf_incremental_init() allocates (page_size/4)*page_size bytes with mmap()
69 # in each data file copy thread, what can fail on 32-bit platforms if threads
70 # are too much, that's why don't set too big --parallel option value.
71 exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir;
72
73 --disable_result_log
74 echo # Prepare full backup, apply incremental one;
75 exec $XTRABACKUP --prepare --target-dir=$basedir;
76 exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ;
77
78 let perl_result_file=$MYSQLTEST_VARDIR/tmp/check_file_size_result.inc;
79
80 --perl END_OF_FILE
81 use strict;
82 use warnings;
83
84 my $dst_file = "$ENV{'basedir'}/aria_log.00000001";
85 my $src_file = "$ENV{'incremental_dir'}/aria_log.00000001";
86 my $out_file = $ENV{'perl_result_file'};
87
88 my $dst_size = -s $dst_file;
89 my $src_size = -s $src_file;
90
91 open (my $output, '>', $out_file) or die $!;
92 if ($dst_size >= $src_size) {
93 print $output '--echo # Aria log file was updated during applying incremental backup'."\n";
94 }
95 else {
96 print $output '--echo # Aria log file was NOT updated during applying incremental backup'."\n";
97 }
98 close $output;
99 END_OF_FILE
100
101 --source $perl_result_file
102 --remove_file $perl_result_file
103
104 disconnect con1;
105 echo # Restore and check results;
106 let $targetdir=$basedir;
107 -- source include/restart_and_restore.inc
108 --enable_result_log
109
110 SELECT * FROM t;
111 DROP TABLE t;
112 if ($test_comp) {
113 --disable_query_log
114 --disable_result_log
115 DROP TABLE t_comp;
116 --enable_query_log
117 --enable_result_log
118 }
119 DROP TABLE t_aria;
120
121 # Cleanup
122 rmdir $basedir;
123 rmdir $incremental_dir;