Skip to content

Commit 4b46a15

Browse files
MDEV-39988 Copy non-ACID engine files in BACKUP SERVER
Move copying of common files and MyISAM files out of Aria plugim Fix incorrect handling of non-default aria_log_dir_path.
1 parent 2d5eb1f commit 4b46a15

8 files changed

Lines changed: 693 additions & 281 deletions

File tree

mysql-test/suite/backup/backup_aria_concurrent.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ let $num_rows= 5;
3030
let $i = 1;
3131
while ($i <= $tab_num) {
3232

33-
# Create Transactional Table
34-
3533
let $tr=0;
3634
while ($tr <= 1) {
3735

@@ -142,4 +140,4 @@ DROP PROCEDURE populate_data;
142140

143141
--enable_query_log
144142

145-
--rmdir $MYSQLTEST_VARDIR/some_directory
143+
--rmdir $target_directory
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# restart: --aria-log-dir-path=MYSQLTEST_VARDIR/log_directory
2+
CREATE TABLE t (
3+
id INT PRIMARY KEY,
4+
str_val VARCHAR(255),
5+
blob_val BLOB,
6+
INDEX idx_str (str_val)
7+
) ENGINE=Aria TRANSACTIONAL=1;
8+
CREATE PROCEDURE populate_data(IN num_rows INT)
9+
BEGIN
10+
DECLARE i INT DEFAULT 0;
11+
WHILE i < num_rows DO
12+
SET @str = CONCAT('_row_', i);
13+
SET @blb = REPEAT(CHAR(97 + (i % 26)), 1500);
14+
INSERT INTO t (id, str_val, blob_val) VALUES (i, @str, @blb);
15+
SET i = i + 1;
16+
END WHILE;
17+
END//
18+
CALL populate_data(10000);
19+
SELECT COUNT(*) from t;
20+
COUNT(*)
21+
10000
22+
SELECT SUM(id) FROM t;
23+
SUM(id)
24+
49995000
25+
SELECT SUM(LENGTH(str_val)) FROM t;
26+
SUM(LENGTH(str_val))
27+
88890
28+
SELECT SUM(LENGTH(blob_val)) FROM t;
29+
SUM(LENGTH(blob_val))
30+
15000000
31+
Back up the database
32+
BACKUP SERVER TO '$target_directory';
33+
Restore the database
34+
# restart: --datadir=MYSQLTEST_VARDIR/some_directory
35+
Check contents after restore
36+
SELECT COUNT(*) from t;
37+
COUNT(*)
38+
10000
39+
SELECT SUM(id) FROM t;
40+
SUM(id)
41+
49995000
42+
SELECT SUM(LENGTH(str_val)) FROM t;
43+
SUM(LENGTH(str_val))
44+
88890
45+
SELECT SUM(LENGTH(blob_val)) FROM t;
46+
SUM(LENGTH(blob_val))
47+
15000000
48+
Restart database in original log and data directories
49+
# restart: --aria-log-dir-path=MYSQLTEST_VARDIR/log_directory
50+
Clean up
51+
DROP PROCEDURE populate_data;
52+
DROP TABLE t;
53+
# restart
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
--source include/have_aria.inc
2+
3+
--let $log_directory=$MYSQLTEST_VARDIR/log_directory
4+
--let $target_directory=$MYSQLTEST_VARDIR/some_directory
5+
6+
# Clean up after a previous failed test, in case we are retrying.
7+
--error 0,1
8+
--rmdir $log_directory
9+
--error 0,1
10+
--rmdir $target_directory
11+
12+
--mkdir $log_directory
13+
14+
--let $orig_restart_parameters=--aria-log-dir-path=$log_directory
15+
--let $restart_parameters=$orig_restart_parameters
16+
--source include/restart_mysqld.inc
17+
18+
CREATE TABLE t (
19+
id INT PRIMARY KEY,
20+
str_val VARCHAR(255),
21+
blob_val BLOB,
22+
INDEX idx_str (str_val)
23+
) ENGINE=Aria TRANSACTIONAL=1;
24+
25+
--disable_warnings
26+
DELIMITER //;
27+
CREATE PROCEDURE populate_data(IN num_rows INT)
28+
BEGIN
29+
DECLARE i INT DEFAULT 0;
30+
WHILE i < num_rows DO
31+
SET @str = CONCAT('_row_', i);
32+
SET @blb = REPEAT(CHAR(97 + (i % 26)), 1500);
33+
INSERT INTO t (id, str_val, blob_val) VALUES (i, @str, @blb);
34+
SET i = i + 1;
35+
END WHILE;
36+
END//
37+
DELIMITER ;//
38+
--enable_warnings
39+
40+
CALL populate_data(10000);
41+
42+
SELECT COUNT(*) from t;
43+
SELECT SUM(id) FROM t;
44+
SELECT SUM(LENGTH(str_val)) FROM t;
45+
SELECT SUM(LENGTH(blob_val)) FROM t;
46+
47+
--echo Back up the database
48+
evalp BACKUP SERVER TO '$target_directory';
49+
50+
--echo Restore the database
51+
--let $restart_parameters=--datadir=$target_directory
52+
--source include/restart_mysqld.inc
53+
54+
--echo Check contents after restore
55+
56+
SELECT COUNT(*) from t;
57+
SELECT SUM(id) FROM t;
58+
SELECT SUM(LENGTH(str_val)) FROM t;
59+
SELECT SUM(LENGTH(blob_val)) FROM t;
60+
61+
--echo Restart database in original log and data directories
62+
--let $restart_parameters=$orig_restart_parameters
63+
--source include/restart_mysqld.inc
64+
65+
--echo Clean up
66+
67+
DROP PROCEDURE populate_data;
68+
DROP TABLE t;
69+
70+
--let $restart_parameters=
71+
--source include/restart_mysqld.inc
72+
73+
--rmdir $target_directory
74+
--rmdir $log_directory
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
CREATE TABLE t_archive (id int unsigned) ENGINE=ARCHIVE;
2+
INSERT INTO t_archive VALUES (2), (3), (5), (7), (11);
3+
CREATE DATABASE d;
4+
CREATE TABLE d.t_csv (id int unsigned NOT NULL) ENGINE=CSV;
5+
INSERT INTO d.t_csv VALUES (4), (26), (41), (60), (83), (109);
6+
CREATE TABLE t_myisam1 (id int unsigned) ENGINE=MyISAM;
7+
INSERT INTO t_myisam1 VALUES (1), (1), (2), (3), (5), (8);
8+
CREATE TABLE t_myisam2 (id int unsigned) ENGINE=MyISAM;
9+
INSERT INTO t_myisam2 VALUES (13), (21), (34), (55), (89), (144);
10+
CREATE TABLE t_mrg (id int unsigned) ENGINE=MRG_MyISAM UNION=(t_myisam1, t_myisam2);
11+
BACKUP SERVER TO '$target_directory';
12+
# restart: --datadir=MYSQLTEST_VARDIR/some_directory
13+
SELECT * FROM t_archive ORDER BY id;
14+
id
15+
2
16+
3
17+
5
18+
7
19+
11
20+
SELECT * FROM d.t_csv ORDER BY id;
21+
id
22+
4
23+
26
24+
41
25+
60
26+
83
27+
109
28+
SELECT * FROM t_myisam1 ORDER BY id;
29+
id
30+
1
31+
1
32+
2
33+
3
34+
5
35+
8
36+
SELECT * FROM t_mrg ORDER BY id;
37+
id
38+
1
39+
1
40+
2
41+
3
42+
5
43+
8
44+
13
45+
21
46+
34
47+
55
48+
89
49+
144
50+
# restart
51+
DROP TABLE t_archive;
52+
DROP TABLE d.t_csv;
53+
DROP TABLE t_myisam1;
54+
DROP TABLE t_myisam2;
55+
DROP TABLE t_mrg;
56+
DROP DATABASE d;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--source include/have_csv.inc
2+
--source include/have_archive.inc
3+
4+
CREATE TABLE t_archive (id int unsigned) ENGINE=ARCHIVE;
5+
INSERT INTO t_archive VALUES (2), (3), (5), (7), (11);
6+
7+
CREATE DATABASE d;
8+
CREATE TABLE d.t_csv (id int unsigned NOT NULL) ENGINE=CSV;
9+
INSERT INTO d.t_csv VALUES (4), (26), (41), (60), (83), (109);
10+
11+
CREATE TABLE t_myisam1 (id int unsigned) ENGINE=MyISAM;
12+
INSERT INTO t_myisam1 VALUES (1), (1), (2), (3), (5), (8);
13+
14+
CREATE TABLE t_myisam2 (id int unsigned) ENGINE=MyISAM;
15+
INSERT INTO t_myisam2 VALUES (13), (21), (34), (55), (89), (144);
16+
17+
CREATE TABLE t_mrg (id int unsigned) ENGINE=MRG_MyISAM UNION=(t_myisam1, t_myisam2);
18+
19+
--let $target_directory=$MYSQLTEST_VARDIR/some_directory
20+
21+
# Clean up after a previous failed test, in case we are retrying.
22+
--error 0,1
23+
--rmdir $target_directory
24+
25+
evalp BACKUP SERVER TO '$target_directory';
26+
27+
--let $restart_parameters=--datadir=$target_directory
28+
--source include/restart_mysqld.inc
29+
30+
SELECT * FROM t_archive ORDER BY id;
31+
SELECT * FROM d.t_csv ORDER BY id;
32+
SELECT * FROM t_myisam1 ORDER BY id;
33+
SELECT * FROM t_mrg ORDER BY id;
34+
35+
--let $restart_parameters=
36+
--source include/restart_mysqld.inc
37+
38+
DROP TABLE t_archive;
39+
DROP TABLE d.t_csv;
40+
DROP TABLE t_myisam1;
41+
DROP TABLE t_myisam2;
42+
DROP TABLE t_mrg;
43+
DROP DATABASE d;
44+
45+
--rmdir $target_directory

0 commit comments

Comments
 (0)