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
20 changes: 20 additions & 0 deletions mysql-test/suite/backup/backup_aria_concurrent.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
15 30 7500
Back up the database
BACKUP SERVER TO '$target_directory' 4 CONCURRENT;
Restore the database
# restart: --datadir=MYSQLTEST_VARDIR/some_directory
Check contents after restore
SELECT COUNT(*) FROM table_checks;
COUNT(*)
400
SELECT * FROM table_checks WHERE sum_id <> 15;
tbl_name sum_id str_len blob_len num_rows
SELECT * FROM table_checks WHERE str_len <> 30;
tbl_name sum_id str_len blob_len num_rows
SELECT * FROM table_checks WHERE blob_len <> 7500;
tbl_name sum_id str_len blob_len num_rows
SELECT * FROM table_checks WHERE num_rows <> 5;
tbl_name sum_id str_len blob_len num_rows
Restart database in original data directory
# restart
Clean up
143 changes: 143 additions & 0 deletions mysql-test/suite/backup/backup_aria_concurrent.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@

--source include/have_aria.inc

--disable_query_log


DELIMITER //;
CREATE PROCEDURE populate_data(IN t_name VARCHAR(64), IN num_rows INT)
BEGIN
DECLARE i INT DEFAULT 1;
SET @query = CONCAT('INSERT INTO ', t_name, ' (id, str_val, blob_val) VALUES (?, ?, ?)');
PREPARE stmt FROM @query;

WHILE i <= num_rows DO
SET @str = CONCAT('_row_', i);
# Generate a predictable but repeating blob based on the row index
SET @blb = REPEAT(CHAR(97 + (i % 26)), 1500);
EXECUTE stmt USING i, @str, @blb;
SET i = i + 1;
END WHILE;

DEALLOCATE PREPARE stmt;
END//
DELIMITER ;//

# Create this many tables transactional and non-transactional each
let $tab_num= 200;
let $num_rows= 5;

let $i = 1;
while ($i <= $tab_num) {

let $tr=0;
while ($tr <= 1) {

let $suff= _$i;
let $table_name= ta_tr$tr$suff;

eval CREATE TABLE $table_name (
id INT PRIMARY KEY,
str_val VARCHAR(255),
blob_val BLOB,
INDEX idx_str (str_val)
) ENGINE=Aria TRANSACTIONAL=$tr;

eval CALL populate_data('$table_name', $num_rows);

inc $tr;
}

inc $i;
}

--enable_query_log

# All tables have the same data, so we query only one for reference

let $sum_id= `SELECT SUM(id) FROM ta_tr0_1`;
let $str_len= `SELECT SUM(LENGTH(str_val)) FROM ta_tr0_1`;
let $blob_len= `SELECT SUM(LENGTH(blob_val)) FROM ta_tr0_1`;

echo $sum_id $str_len $blob_len;

--let $target_directory=$MYSQLTEST_VARDIR/some_directory

# Clean up after a previous failed test, in case we are retrying.
--error 0,1
--rmdir $target_directory

--echo Back up the database
evalp BACKUP SERVER TO '$target_directory' 4 CONCURRENT;

--echo Restore the database
--let $restart_parameters=--datadir=$target_directory
--source include/restart_mysqld.inc

--echo Check contents after restore

--disable_query_log
CREATE TEMPORARY TABLE table_checks (
tbl_name VARCHAR(64),
sum_id INT,
str_len INT,
blob_len INT,
num_rows INT
) ENGINE=MEMORY;

let $i = 1;
while ($i <= $tab_num) {
let $tr=0;
while ($tr <= 1) {

let $suff= _$i;
let $table_name= ta_tr$tr$suff;

let $r_sum_id= `SELECT SUM(id) FROM $table_name`;
let $r_str_len= `SELECT SUM(LENGTH(str_val)) FROM $table_name`;
let $r_blob_len= `SELECT SUM(LENGTH(blob_val)) FROM $table_name`;
let $r_num_rows= `SELECT COUNT(*) FROM $table_name`;

eval INSERT INTO table_checks VALUES ('$table_name', $r_sum_id, $r_str_len, $r_blob_len, $r_num_rows);

inc $tr;
}
inc $i;
}

--enable_query_log

SELECT COUNT(*) FROM table_checks;

# We expect results in the table to always match the results captured before the BACKUP
# Returned rowsets should be empty
eval SELECT * FROM table_checks WHERE sum_id <> $sum_id;
eval SELECT * FROM table_checks WHERE str_len <> $str_len;
eval SELECT * FROM table_checks WHERE blob_len <> $blob_len;
eval SELECT * FROM table_checks WHERE num_rows <> $num_rows;

--echo Restart database in original data directory
--let $restart_parameters=
--source include/restart_mysqld.inc

--echo Clean up

--disable_query_log

let $i = 1;
while ($i <= $tab_num) {
let $tr=0;
while ($tr <= 1) {
let $suff= _$i;
let $table_name= ta_tr$tr$suff;
eval DROP TABLE $table_name;
inc $tr;
}
inc $i;
}

DROP PROCEDURE populate_data;

--enable_query_log

--rmdir $target_directory
53 changes: 53 additions & 0 deletions mysql-test/suite/backup/backup_aria_log_dir.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# restart: --aria-log-dir-path=MYSQLTEST_VARDIR/log_directory
CREATE TABLE t (
id INT PRIMARY KEY,
str_val VARCHAR(255),
blob_val BLOB,
INDEX idx_str (str_val)
) ENGINE=Aria TRANSACTIONAL=1;
CREATE PROCEDURE populate_data(IN num_rows INT)
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < num_rows DO
SET @str = CONCAT('_row_', i);
SET @blb = REPEAT(CHAR(97 + (i % 26)), 1500);
INSERT INTO t (id, str_val, blob_val) VALUES (i, @str, @blb);
SET i = i + 1;
END WHILE;
END//
CALL populate_data(10000);
SELECT COUNT(*) from t;
COUNT(*)
10000
SELECT SUM(id) FROM t;
SUM(id)
49995000
SELECT SUM(LENGTH(str_val)) FROM t;
SUM(LENGTH(str_val))
88890
SELECT SUM(LENGTH(blob_val)) FROM t;
SUM(LENGTH(blob_val))
15000000
Back up the database
BACKUP SERVER TO '$target_directory';
Restore the database
# restart: --datadir=MYSQLTEST_VARDIR/some_directory
Check contents after restore
SELECT COUNT(*) from t;
COUNT(*)
10000
SELECT SUM(id) FROM t;
SUM(id)
49995000
SELECT SUM(LENGTH(str_val)) FROM t;
SUM(LENGTH(str_val))
88890
SELECT SUM(LENGTH(blob_val)) FROM t;
SUM(LENGTH(blob_val))
15000000
Restart database in original log and data directories
# restart: --aria-log-dir-path=MYSQLTEST_VARDIR/log_directory
Clean up
DROP PROCEDURE populate_data;
DROP TABLE t;
# restart
74 changes: 74 additions & 0 deletions mysql-test/suite/backup/backup_aria_log_dir.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
--source include/have_aria.inc

--let $log_directory=$MYSQLTEST_VARDIR/log_directory
--let $target_directory=$MYSQLTEST_VARDIR/some_directory

# Clean up after a previous failed test, in case we are retrying.
--error 0,1
--rmdir $log_directory
--error 0,1
--rmdir $target_directory

--mkdir $log_directory

--let $orig_restart_parameters=--aria-log-dir-path=$log_directory
--let $restart_parameters=$orig_restart_parameters
--source include/restart_mysqld.inc

CREATE TABLE t (
id INT PRIMARY KEY,
str_val VARCHAR(255),
blob_val BLOB,
INDEX idx_str (str_val)
) ENGINE=Aria TRANSACTIONAL=1;

--disable_warnings
DELIMITER //;
CREATE PROCEDURE populate_data(IN num_rows INT)
BEGIN
DECLARE i INT DEFAULT 0;
WHILE i < num_rows DO
SET @str = CONCAT('_row_', i);
SET @blb = REPEAT(CHAR(97 + (i % 26)), 1500);
INSERT INTO t (id, str_val, blob_val) VALUES (i, @str, @blb);
SET i = i + 1;
END WHILE;
END//
DELIMITER ;//
--enable_warnings

CALL populate_data(10000);

SELECT COUNT(*) from t;
SELECT SUM(id) FROM t;
SELECT SUM(LENGTH(str_val)) FROM t;
SELECT SUM(LENGTH(blob_val)) FROM t;

--echo Back up the database
evalp BACKUP SERVER TO '$target_directory';

--echo Restore the database
--let $restart_parameters=--datadir=$target_directory
--source include/restart_mysqld.inc

--echo Check contents after restore

SELECT COUNT(*) from t;
SELECT SUM(id) FROM t;
SELECT SUM(LENGTH(str_val)) FROM t;
SELECT SUM(LENGTH(blob_val)) FROM t;

--echo Restart database in original log and data directories
--let $restart_parameters=$orig_restart_parameters
--source include/restart_mysqld.inc

--echo Clean up

DROP PROCEDURE populate_data;
DROP TABLE t;

--let $restart_parameters=
--source include/restart_mysqld.inc

--rmdir $target_directory
--rmdir $log_directory
56 changes: 56 additions & 0 deletions mysql-test/suite/backup/backup_nonacid.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
CREATE TABLE t_archive (id int unsigned) ENGINE=ARCHIVE;
INSERT INTO t_archive VALUES (2), (3), (5), (7), (11);
CREATE DATABASE d;
CREATE TABLE d.t_csv (id int unsigned NOT NULL) ENGINE=CSV;
INSERT INTO d.t_csv VALUES (4), (26), (41), (60), (83), (109);
CREATE TABLE t_myisam1 (id int unsigned) ENGINE=MyISAM;
INSERT INTO t_myisam1 VALUES (1), (1), (2), (3), (5), (8);
CREATE TABLE t_myisam2 (id int unsigned) ENGINE=MyISAM;
INSERT INTO t_myisam2 VALUES (13), (21), (34), (55), (89), (144);
CREATE TABLE t_mrg (id int unsigned) ENGINE=MRG_MyISAM UNION=(t_myisam1, t_myisam2);
BACKUP SERVER TO '$target_directory';
# restart: --datadir=MYSQLTEST_VARDIR/some_directory
SELECT * FROM t_archive ORDER BY id;
id
2
3
5
7
11
SELECT * FROM d.t_csv ORDER BY id;
id
4
26
41
60
83
109
SELECT * FROM t_myisam1 ORDER BY id;
id
1
1
2
3
5
8
SELECT * FROM t_mrg ORDER BY id;
id
1
1
2
3
5
8
13
21
34
55
89
144
# restart
DROP TABLE t_archive;
DROP TABLE d.t_csv;
DROP TABLE t_myisam1;
DROP TABLE t_myisam2;
DROP TABLE t_mrg;
DROP DATABASE d;
45 changes: 45 additions & 0 deletions mysql-test/suite/backup/backup_nonacid.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--source include/have_csv.inc
--source include/have_archive.inc

CREATE TABLE t_archive (id int unsigned) ENGINE=ARCHIVE;
INSERT INTO t_archive VALUES (2), (3), (5), (7), (11);

CREATE DATABASE d;
CREATE TABLE d.t_csv (id int unsigned NOT NULL) ENGINE=CSV;
INSERT INTO d.t_csv VALUES (4), (26), (41), (60), (83), (109);

CREATE TABLE t_myisam1 (id int unsigned) ENGINE=MyISAM;
INSERT INTO t_myisam1 VALUES (1), (1), (2), (3), (5), (8);

CREATE TABLE t_myisam2 (id int unsigned) ENGINE=MyISAM;
INSERT INTO t_myisam2 VALUES (13), (21), (34), (55), (89), (144);

CREATE TABLE t_mrg (id int unsigned) ENGINE=MRG_MyISAM UNION=(t_myisam1, t_myisam2);

--let $target_directory=$MYSQLTEST_VARDIR/some_directory

# Clean up after a previous failed test, in case we are retrying.
--error 0,1
--rmdir $target_directory

evalp BACKUP SERVER TO '$target_directory';

--let $restart_parameters=--datadir=$target_directory
--source include/restart_mysqld.inc

SELECT * FROM t_archive ORDER BY id;
SELECT * FROM d.t_csv ORDER BY id;
SELECT * FROM t_myisam1 ORDER BY id;
SELECT * FROM t_mrg ORDER BY id;

--let $restart_parameters=
--source include/restart_mysqld.inc

DROP TABLE t_archive;
DROP TABLE d.t_csv;
DROP TABLE t_myisam1;
DROP TABLE t_myisam2;
DROP TABLE t_mrg;
DROP DATABASE d;

--rmdir $target_directory
Loading