######################################## # Author: JBM # Date: 2006-01-24 # Purpose: Test CDD backup and restore ######################################## -- source include/have_ndb.inc --disable_warnings DROP TABLE IF EXISTS test.t1; DROP TABLE IF EXISTS test.t2; DROP TABLE IF EXISTS test.t3; DROP TABLE IF EXISTS test.t4; DROP TABLE IF EXISTS test.t5; DROP TABLE IF EXISTS test.t6; --enable_warnings ############ Test 1 Simple DD backup and restore ############# -- echo **** Test 1 Simple DD backup and restore **** CREATE LOGFILE GROUP log_group1 ADD UNDOFILE './log_group1/undofile.dat' INITIAL_SIZE 16M UNDO_BUFFER_SIZE = 1M ENGINE=NDB; CREATE TABLESPACE table_space1 ADD DATAFILE './table_space1/datafile.dat' USE LOGFILE GROUP log_group1 INITIAL_SIZE 12M ENGINE NDB; CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 CHAR(50) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; let $j= 500; --disable_query_log while ($j) { eval INSERT INTO test.t1 VALUES (NULL, "Sweden", $j, b'1'); dec $j; } --enable_query_log SELECT COUNT(*) FROM test.t1; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5; -- source include/ndb_backup.inc DROP TABLE test.t1; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE = NDB; DROP TABLESPACE table_space1 ENGINE = NDB; DROP LOGFILE GROUP log_group1 ENGINE =NDB; -- source include/ndb_restore_master.inc SELECT COUNT(*) FROM test.t1; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5; ################# Mixed Cluster Test ############################ -- echo **** Test 2 Mixed Cluster Test backup and restore **** CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 VARCHAR(200) NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB; let $j= 500; --disable_query_log while ($j) { eval INSERT INTO test.t2 VALUES (NULL, "Sweden, Texas", $j, b'0'); dec $j; } --enable_query_log CREATE TABLE test.t3 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB; CREATE TABLE test.t4 (c1 int not null auto_increment, data LONGBLOB, PRIMARY KEY(c1))ENGINE=NDB; let $j= 50; --disable_query_log while ($j) { INSERT INTO test.t3 VALUES (NULL, repeat('a',1*1024)); INSERT INTO test.t3 VALUES (NULL, repeat('b',16*1024)); INSERT INTO test.t4 VALUES (NULL, repeat('a',1*1024)); INSERT INTO test.t4 VALUES (NULL, repeat('b',16*1024)); dec $j; } --enable_query_log SELECT COUNT(*) FROM test.t1; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5; SELECT COUNT(*) FROM test.t2; SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5; SELECT COUNT(*) FROM test.t3; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2; SELECT COUNT(*) FROM test.t4; SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; -- source include/ndb_backup.inc DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; DROP TABLE test.t4; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE = NDB; DROP TABLESPACE table_space1 ENGINE = NDB; DROP LOGFILE GROUP log_group1 ENGINE =NDB; -- source include/ndb_restore_master.inc SELECT COUNT(*) FROM test.t1; SELECT pk1, c2, c3, hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5; SELECT COUNT(*) FROM test.t2; SELECT pk1, c2, c3, hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5; SELECT COUNT(*) FROM test.t3; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2; SELECT COUNT(*) FROM test.t4; SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1; SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; DROP TABLE test.t1; DROP TABLE test.t2; DROP TABLE test.t3; DROP TABLE test.t4; ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE = NDB; DROP TABLESPACE table_space1 ENGINE = NDB; DROP LOGFILE GROUP log_group1 ENGINE =NDB; #End 5.1 test case