List:Commits« Previous MessageNext Message »
From:Jonathan Miller Date:January 24 2006 10:13pm
Subject:bk commit into 5.1 tree (jmiller:1.2073)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of ndbdev. When ndbdev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2073 06/01/24 23:12:54 jmiller@stripped +2 -0
  New CDD test case

  mysql-test/r/ndb_dd_backuprestore.result
    1.1 06/01/24 23:12:19 jmiller@stripped +489 -0
    New CDD test for NDB backup and restore

  mysql-test/r/ndb_dd_backuprestore.result
    1.0 06/01/24 23:12:19 jmiller@stripped +0 -0
    BitKeeper file /home/ndbdev/jmiller/clones/mysql-5.1-new/mysql-test/r/ndb_dd_backuprestore.result

  mysql-test/t/ndb_dd_backuprestore.test
    1.1 06/01/24 23:12:08 jmiller@stripped +319 -0
    New CDD test for NDB backup and restore

  mysql-test/t/ndb_dd_backuprestore.test
    1.0 06/01/24 23:12:08 jmiller@stripped +0 -0
    BitKeeper file /home/ndbdev/jmiller/clones/mysql-5.1-new/mysql-test/t/ndb_dd_backuprestore.test

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jmiller
# Host:	ndb08.mysql.com
# Root:	/home/ndbdev/jmiller/clones/mysql-5.1-new
--- New file ---
+++ mysql-test/r/ndb_dd_backuprestore.result	06/01/24 23:12:19
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;
**** 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 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL) TABLESPACE table_space1 STORAGE DISK ENGINE=NDB;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1	c2	c3	hex(c4)
1	Sweden	500	1
2	Sweden	499	1
3	Sweden	498	1
4	Sweden	497	1
5	Sweden	496	1
DROP TABLE test.t1;
CREATE 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 ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
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;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1	c2	c3	hex(c4)
1	Sweden	500	1
2	Sweden	499	1
3	Sweden	498	1
4	Sweden	497	1
5	Sweden	496	1
**** Test 2 Mixed Cluster Test backup and restore ****
CREATE TABLE test.t2
(pk1 MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL)ENGINE=NDB;
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;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1	c2	c3	hex(c4)
1	Sweden	500	1
2	Sweden	499	1
3	Sweden	498	1
4	Sweden	497	1
5	Sweden	496	1
SELECT COUNT(*) FROM test.t2;
COUNT(*)
500
SELECT pk1, c2, c3,  hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
pk1	c2	c3	hex(c4)
1	Sweden, Texas	500	0
2	Sweden, Texas	499	0
3	Sweden, Texas	498	0
4	Sweden, Texas	497	0
5	Sweden, Texas	496	0
SELECT COUNT(*) FROM test.t3;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
LENGTH(data)
16384
SELECT COUNT(*) FROM test.t4;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
CREATE 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 ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
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;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
500
SELECT pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY pk1 LIMIT 5;
pk1	c2	c3	hex(c4)
1	Sweden	500	1
2	Sweden	499	1
3	Sweden	498	1
4	Sweden	497	1
5	Sweden	496	1
SELECT COUNT(*) FROM test.t2;
COUNT(*)
500
SELECT pk1, c2, c3,  hex(c4) FROM test.t2 ORDER BY pk1 LIMIT 5;
pk1	c2	c3	hex(c4)
1	Sweden, Texas	500	0
2	Sweden, Texas	499	0
3	Sweden, Texas	498	0
4	Sweden, Texas	497	0
5	Sweden, Texas	496	0
SELECT COUNT(*) FROM test.t3;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t3 WHERE c1 = 2;
LENGTH(data)
16384
SELECT COUNT(*) FROM test.t4;
COUNT(*)
100
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 1;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
**** Test 3 Adding  partition Test backup and restore ****
CREATE TABLESPACE table_space2
ADD DATAFILE './table_space2/datafile.dat'
USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;
CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;
CREATE TABLE test.t4 (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 HASH(c3) PARTITIONS 2;
CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
CREATE TABLE test.t5 (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 KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 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;
Table	Create Table
t1	CREATE TABLE `t1` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4 
SHOW CREATE TABLE test.t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
SHOW CREATE TABLE test.t3;
Table	Create Table
t3	CREATE TABLE `t3` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster)
SHOW CREATE TABLE test.t4;
Table	Create Table
t4	CREATE TABLE `t4` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2 
SHOW CREATE TABLE test.t5;
Table	Create Table
t5	CREATE TABLE `t5` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
SHOW CREATE TABLE test.t6;
Table	Create Table
t6	CREATE TABLE `t6` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster)
SELECT * FROM information_schema.partitions WHERE table_name= 't1';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t1	p0	NULL	1	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t1	p1	NULL	2	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t1	p2	NULL	3	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t1	p3	NULL	4	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't2';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t2	p0	NULL	1	NULL	KEY	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t2	p1	NULL	2	NULL	KEY	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't3';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t3	x1	NULL	1	NULL	RANGE	NULL	c3	NULL	105	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t3	x2	NULL	2	NULL	RANGE	NULL	c3	NULL	333	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t3	x3	NULL	3	NULL	RANGE	NULL	c3	NULL	720	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't4';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t4	p0	NULL	1	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t4	p1	NULL	2	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't5';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t5	p0	NULL	1	NULL	KEY	NULL	pk1	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t5	p1	NULL	2	NULL	KEY	NULL	pk1	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't6';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t6	x1	NULL	1	NULL	RANGE	NULL	pk1	NULL	333	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t6	x2	NULL	2	NULL	RANGE	NULL	pk1	NULL	720	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT COUNT(*) FROM test.t1;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas	2	0
249	Sweden, Texas	4	0
248	Sweden, Texas	6	0
247	Sweden, Texas	8	0
246	Sweden, Texas	10	0
SELECT COUNT(*) FROM test.t2;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	1	1
249	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	3	1
248	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	5	1
247	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	7	1
246	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	9	1
SELECT COUNT(*) FROM test.t3;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	0	1
249	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	2	1
248	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	4	1
247	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	6	1
246	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	8	1
SELECT COUNT(*) FROM test.t4;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas	2	0
249	Sweden, Texas	4	0
248	Sweden, Texas	6	0
247	Sweden, Texas	8	0
246	Sweden, Texas	10	0
SELECT COUNT(*) FROM test.t5;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	1	1
249	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	3	1
248	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	5	1
247	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	7	1
246	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	9	1
SELECT COUNT(*) FROM test.t6;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	0	1
249	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	2	1
248	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	4	1
247	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	6	1
246	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	8	1
CREATE 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 ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;
ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;
ALTER TABLESPACE table_space2
DROP DATAFILE './table_space2/datafile.dat'
ENGINE = NDB;
DROP TABLESPACE table_space1
ENGINE = NDB;
DROP TABLESPACE table_space2
ENGINE = NDB;
DROP LOGFILE GROUP log_group1
ENGINE =NDB;
SHOW CREATE TABLE test.t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4 
SHOW CREATE TABLE test.t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
SHOW CREATE TABLE test.t3;
Table	Create Table
t3	CREATE TABLE `t3` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster)
SHOW CREATE TABLE test.t4;
Table	Create Table
t4	CREATE TABLE `t4` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2 
SHOW CREATE TABLE test.t5;
Table	Create Table
t5	CREATE TABLE `t5` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
SHOW CREATE TABLE test.t6;
Table	Create Table
t6	CREATE TABLE `t6` (
  `pk1` mediumint(9) NOT NULL auto_increment,
  `c2` text NOT NULL,
  `c3` int(11) NOT NULL,
  `c4` bit(1) NOT NULL,
  PRIMARY KEY  (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster)
SELECT * FROM information_schema.partitions WHERE table_name= 't1';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t1	p0	NULL	1	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t1	p1	NULL	2	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t1	p2	NULL	3	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t1	p3	NULL	4	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't2';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t2	p0	NULL	1	NULL	KEY	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t2	p1	NULL	2	NULL	KEY	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't3';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t3	x1	NULL	1	NULL	RANGE	NULL	c3	NULL	105	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t3	x2	NULL	2	NULL	RANGE	NULL	c3	NULL	333	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t3	x3	NULL	3	NULL	RANGE	NULL	c3	NULL	720	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't4';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t4	p0	NULL	1	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t4	p1	NULL	2	NULL	HASH	NULL	c3	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't5';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t5	p0	NULL	1	NULL	KEY	NULL	pk1	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t5	p1	NULL	2	NULL	KEY	NULL	pk1	NULL	NULL	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT * FROM information_schema.partitions WHERE table_name= 't6';
TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PARTITION_NAME	SUBPARTITION_NAME	PARTITION_ORDINAL_POSITION	SUBPARTITION_ORDINAL_POSITION	PARTITION_METHOD	SUBPARTITION_METHOD	PARTITION_EXPRESSION	SUBPARTITION_EXPRESSION	PARTITION_DESCRIPTION	TABLE_ROWS	AVG_ROW_LENGTH	DATA_LENGTH	MAX_DATA_LENGTH	INDEX_LENGTH	DATA_FREE	CREATE_TIME	UPDATE_TIME	CHECK_TIME	CHECKSUM	PARTITION_COMMENT	NODEGROUP	TABLESPACE_NAME
NULL	test	t6	x1	NULL	1	NULL	RANGE	NULL	pk1	NULL	333	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
NULL	test	t6	x2	NULL	2	NULL	RANGE	NULL	pk1	NULL	720	0	0	0	NULL	0	0	NULL	NULL	NULL	NULL	default	0	default
SELECT COUNT(*) FROM test.t1;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas	2	0
249	Sweden, Texas	4	0
248	Sweden, Texas	6	0
247	Sweden, Texas	8	0
246	Sweden, Texas	10	0
SELECT COUNT(*) FROM test.t2;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	1	1
249	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	3	1
248	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	5	1
247	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	7	1
246	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	9	1
SELECT COUNT(*) FROM test.t3;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	0	1
249	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	2	1
248	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	4	1
247	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	6	1
246	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	8	1
SELECT COUNT(*) FROM test.t4;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas	2	0
249	Sweden, Texas	4	0
248	Sweden, Texas	6	0
247	Sweden, Texas	8	0
246	Sweden, Texas	10	0
SELECT COUNT(*) FROM test.t5;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t5 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	1	1
249	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	3	1
248	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	5	1
247	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	7	1
246	Sweden, Texas, ITALY, Kyle, JO, JBM,TU	9	1
SELECT COUNT(*) FROM test.t6;
COUNT(*)
250
SELECT pk1, c2, c3,  hex(c4) FROM test.t6 ORDER BY c3 LIMIT 5;
pk1	c2	c3	hex(c4)
250	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	0	1
249	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	2	1
248	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	4	1
247	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	6	1
246	TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU	8	1
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;
ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;
ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;
DROP TABLESPACE table_space1 ENGINE = NDB;
DROP TABLESPACE table_space2 ENGINE = NDB;
DROP LOGFILE GROUP log_group1 ENGINE = NDB;

--- New file ---
+++ mysql-test/t/ndb_dd_backuprestore.test	06/01/24 23:12:08
########################################
# 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 TEXT 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;

--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT

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 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
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;

DROP TABLESPACE table_space1
ENGINE = NDB;

DROP LOGFILE GROUP log_group1
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
--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 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 TEXT 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

--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT

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;

# 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 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;
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;

--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
--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 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;
###################### Adding partition #################################
-- echo **** Test 3 Adding  partition Test backup and restore ****

CREATE TABLESPACE table_space2
ADD DATAFILE './table_space2/datafile.dat'
USE LOGFILE GROUP log_group1
INITIAL_SIZE 12M
ENGINE NDB;

CREATE TABLE test.t1 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space1 STORAGE DISK ENGINE=NDB PARTITION BY HASH(c3) PARTITIONS 4;

CREATE TABLE test.t4 (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 HASH(c3) PARTITIONS 2;

CREATE TABLE test.t2 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY KEY(c3) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);

CREATE TABLE test.t5 (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 KEY(pk1) (PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);

CREATE TABLE test.t3 (pk1 MEDIUMINT NOT NULL AUTO_INCREMENT, c2 TEXT NOT NULL, c3 INT NOT NULL, c4 BIT NOT NULL, PRIMARY KEY(pk1,c3))TABLESPACE table_space2 STORAGE DISK ENGINE=NDB PARTITION BY RANGE (c3) PARTITIONS 3 (PARTITION x1 VALUES LESS THAN (105), PARTITION x2 VALUES LESS THAN (333), PARTITION x3 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.t2;
SHOW CREATE TABLE test.t3;
SHOW CREATE TABLE test.t4;
SHOW CREATE TABLE test.t5;
SHOW CREATE TABLE test.t6;
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= 't3';
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= 't6';


let $j= 500;
--disable_query_log
while ($j)
{
  eval INSERT INTO test.t1 VALUES (NULL, "Sweden, Texas", $j, b'0');
  eval INSERT INTO test.t4 VALUES (NULL, "Sweden, Texas", $j, b'0');
  dec $j;
  eval INSERT INTO test.t2 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
  eval INSERT INTO test.t5 VALUES (NULL, "Sweden, Texas, ITALY, Kyle, JO, JBM,TU", $j, b'1');
  dec $j;
  eval INSERT INTO test.t3 VALUES (NULL, "TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU", $j, b'1');
  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 pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3,  hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t3;
SELECT pk1, c2, c3,  hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t4;
SELECT pk1, c2, c3,  hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
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

# 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 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;

DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;

ALTER TABLESPACE table_space1
DROP DATAFILE './table_space1/datafile.dat'
ENGINE = NDB;

ALTER TABLESPACE table_space2
DROP DATAFILE './table_space2/datafile.dat'
ENGINE = NDB;

DROP TABLESPACE table_space1
ENGINE = NDB;

DROP TABLESPACE table_space2
ENGINE = NDB;

DROP LOGFILE GROUP log_group1
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
--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.t2;
SHOW CREATE TABLE test.t3;
SHOW CREATE TABLE test.t4;
SHOW CREATE TABLE test.t5;
SHOW CREATE TABLE test.t6;
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= 't3';
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= 't6';
SELECT COUNT(*) FROM test.t1;
SELECT pk1, c2, c3,  hex(c4) FROM test.t1 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t2;
SELECT pk1, c2, c3,  hex(c4) FROM test.t2 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t3;
SELECT pk1, c2, c3,  hex(c4) FROM test.t3 ORDER BY c3 LIMIT 5;
SELECT COUNT(*) FROM test.t4;
SELECT pk1, c2, c3,  hex(c4) FROM test.t4 ORDER BY c3 LIMIT 5;
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;

# Cleanup

DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;
DROP TABLE test.t5;
DROP TABLE test.t6;

ALTER TABLESPACE table_space1 DROP DATAFILE './table_space1/datafile.dat' ENGINE=NDB;

ALTER TABLESPACE table_space2 DROP DATAFILE './table_space2/datafile.dat' ENGINE=NDB;

DROP TABLESPACE table_space1 ENGINE = NDB;

DROP TABLESPACE table_space2 ENGINE = NDB;

DROP LOGFILE GROUP log_group1 ENGINE = NDB;

#End 5.1 test case


Thread
bk commit into 5.1 tree (jmiller:1.2073)Jonathan Miller24 Jan