Commit b4e7b365 authored by unknown's avatar unknown

Updates from review


mysql-test/include/ndb_backup.inc:
  We are writting test cases that use the ndb backup. This new include contains all the code needed to start the backup and grab the backup ID for the test. By moving the code here it will be easy to reuse
mysql-test/include/ndb_restore_master.inc:
  We are writting test cases that use the ndb backup and restore. This new include contains all the code needed to restore a master cluster from the backup done with ndb_backup.inc. By moving the code here it will be easy to reuse
mysql-test/t/ndb_dd_backuprestore.test:
  Updated with suggestions from Jonas
parent be4a1c2e
######################################################
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "star
t backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -
d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE =
HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY '
,';
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info;
let the_backup_id=`select @the_backup_id`;
DROP TABLE test.backup_info;
######################################################
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUS
TER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP
/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUS
TER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/B
ACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
...@@ -45,22 +45,10 @@ while ($j) ...@@ -45,22 +45,10 @@ while ($j)
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT -- source include/ndb_backup.inc
DROP TABLE test.t1; DROP TABLE test.t1;
# there is no neat way to find the backupid, this is a hack to find it...
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info;
let the_backup_id=`select @the_backup_id`;
DROP TABLE test.backup_info;
ALTER TABLESPACE table_space1 ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat' DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB; ENGINE = NDB;
...@@ -71,9 +59,7 @@ ENGINE = NDB; ...@@ -71,9 +59,7 @@ ENGINE = NDB;
DROP LOGFILE GROUP log_group1 DROP LOGFILE GROUP log_group1
ENGINE =NDB; ENGINE =NDB;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT -- source include/ndb_restore_master.inc
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM test.t1;
...@@ -110,28 +96,27 @@ while ($j) ...@@ -110,28 +96,27 @@ while ($j)
} }
--enable_query_log --enable_query_log
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t2; SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t3; SELECT COUNT(*) FROM test.t3;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
SELECT COUNT(*) FROM test.t4; SELECT COUNT(*) FROM test.t4;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
# there is no neat way to find the backupid, this is a hack to find it... SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM test.backup_info; SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -- source include/ndb_backup.inc
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info;
let the_backup_id=`select @the_backup_id`;
DROP TABLE test.backup_info; DROP TABLE test.backup_info;
DROP TABLE test.t1; DROP TABLE test.t1;
...@@ -149,19 +134,26 @@ ENGINE = NDB; ...@@ -149,19 +134,26 @@ ENGINE = NDB;
DROP LOGFILE GROUP log_group1 DROP LOGFILE GROUP log_group1
ENGINE =NDB; ENGINE =NDB;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT -- source include/ndb_restore_master.inc
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t2; SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
SELECT COUNT(*) FROM test.t3; SELECT COUNT(*) FROM test.t3;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
SELECT COUNT(*) FROM test.t4; SELECT COUNT(*) FROM test.t4;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
DROP TABLE test.t1; DROP TABLE test.t1;
...@@ -190,16 +182,27 @@ CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c ...@@ -190,16 +182,27 @@ CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c
CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720)); CREATE TABLE test.t6 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))ENGINE=NDB PARTITION BY RANGE (pk1) PARTITIONS 2 (PARTITION x1 VALUES LESS THAN (333), PARTITION x2 VALUES LESS THAN (720));
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
SHOW CREATE TABLE test.t3; SHOW CREATE TABLE test.t3;
SHOW CREATE TABLE test.t4; SHOW CREATE TABLE test.t4;
SHOW CREATE TABLE test.t5; SHOW CREATE TABLE test.t5;
SHOW CREATE TABLE test.t6; SHOW CREATE TABLE test.t6;
SELECT * FROM information_schema.partitions WHERE table_name= 't1'; SELECT * FROM information_schema.partitions WHERE table_name= 't1';
SELECT * FROM information_schema.partitions WHERE table_name= 't2'; SELECT * FROM information_schema.partitions WHERE table_name= 't2';
SELECT * FROM information_schema.partitions WHERE table_name= 't3'; SELECT * FROM information_schema.partitions WHERE table_name= 't3';
SELECT * FROM information_schema.partitions WHERE table_name= 't4'; SELECT * FROM information_schema.partitions WHERE table_name= 't4';
SELECT * FROM information_schema.partitions WHERE table_name= 't5'; SELECT * FROM information_schema.partitions WHERE table_name= 't5';
SELECT * FROM information_schema.partitions WHERE table_name= 't6'; SELECT * FROM information_schema.partitions WHERE table_name= 't6';
...@@ -217,31 +220,30 @@ while ($j) ...@@ -217,31 +220,30 @@ while ($j)
eval INSERT INTO test.t6 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1'); } --enable_query_log eval INSERT INTO test.t6 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1'); } --enable_query_log
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t2; SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t3; SELECT COUNT(*) FROM test.t3;
SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t4; SELECT COUNT(*) FROM test.t4;
SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t5; SELECT COUNT(*) FROM test.t5;
SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t6;
SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
# there is no neat way to find the backupid, this is a hack to find it... SELECT COUNT(*) FROM test.t6;
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > var/tmp.dat
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP; SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../../var/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; -- source include/ndb_backup.inc
--replace_column 1 <the_backup_id>
SELECT @the_backup_id:=backup_id FROM test.backup_info;
let the_backup_id=`select @the_backup_id`;
DROP TABLE test.backup_info;
DROP TABLE test.t1; DROP TABLE test.t1;
DROP TABLE test.t2; DROP TABLE test.t2;
...@@ -267,33 +269,55 @@ ENGINE = NDB; ...@@ -267,33 +269,55 @@ ENGINE = NDB;
DROP LOGFILE GROUP log_group1 DROP LOGFILE GROUP log_group1
ENGINE =NDB; ENGINE =NDB;
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT -- source include/ndb_restore_master.inc
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
SHOW CREATE TABLE test.t1; SHOW CREATE TABLE test.t1;
SHOW CREATE TABLE test.t2; SHOW CREATE TABLE test.t2;
SHOW CREATE TABLE test.t3; SHOW CREATE TABLE test.t3;
SHOW CREATE TABLE test.t4; SHOW CREATE TABLE test.t4;
SHOW CREATE TABLE test.t5; SHOW CREATE TABLE test.t5;
SHOW CREATE TABLE test.t6; SHOW CREATE TABLE test.t6;
SELECT * FROM information_schema.partitions WHERE table_name= 't1'; SELECT * FROM information_schema.partitions WHERE table_name= 't1';
SELECT * FROM information_schema.partitions WHERE table_name= 't2'; SELECT * FROM information_schema.partitions WHERE table_name= 't2';
SELECT * FROM information_schema.partitions WHERE table_name= 't3'; SELECT * FROM information_schema.partitions WHERE table_name= 't3';
SELECT * FROM information_schema.partitions WHERE table_name= 't4'; SELECT * FROM information_schema.partitions WHERE table_name= 't4';
SELECT * FROM information_schema.partitions WHERE table_name= 't5'; SELECT * FROM information_schema.partitions WHERE table_name= 't5';
SELECT * FROM information_schema.partitions WHERE table_name= 't6'; SELECT * FROM information_schema.partitions WHERE table_name= 't6';
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t2; SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t3; SELECT COUNT(*) FROM test.t3;
SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t4; SELECT COUNT(*) FROM test.t4;
SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t5; SELECT COUNT(*) FROM test.t5;
SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t6; SELECT COUNT(*) FROM test.t6;
SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5; SELECT pk1, c2, c3, hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
# Cleanup # Cleanup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment