初版
This commit is contained in:
@@ -0,0 +1,397 @@
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
flush status;
|
||||
create table t1(
|
||||
id int not null primary key,
|
||||
name char(20)
|
||||
) engine=ndb;
|
||||
insert into t1 values(1, "Autodiscover");
|
||||
flush tables;
|
||||
select * from t1;
|
||||
id name
|
||||
1 Autodiscover
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 1
|
||||
flush tables;
|
||||
insert into t1 values (2, "Auto 2");
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 2
|
||||
insert into t1 values (3, "Discover 3");
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 2
|
||||
flush tables;
|
||||
select * from t1 order by id;
|
||||
id name
|
||||
1 Autodiscover
|
||||
2 Auto 2
|
||||
3 Discover 3
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 3
|
||||
flush tables;
|
||||
update t1 set name="Autodiscover" where id = 2;
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 4
|
||||
select * from t1 order by id;
|
||||
id name
|
||||
1 Autodiscover
|
||||
2 Autodiscover
|
||||
3 Discover 3
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 4
|
||||
flush tables;
|
||||
delete from t1 where id = 3;
|
||||
select * from t1 order by id;
|
||||
id name
|
||||
1 Autodiscover
|
||||
2 Autodiscover
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 5
|
||||
drop table t1;
|
||||
flush status;
|
||||
create table t2(
|
||||
id int not null primary key,
|
||||
name char(22)
|
||||
) engine=ndb;
|
||||
insert into t2 values (1, "Discoverer");
|
||||
select * from t2;
|
||||
id name
|
||||
1 Discoverer
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
flush tables;
|
||||
select * from t2;
|
||||
id name
|
||||
1 Discoverer
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 1
|
||||
drop table t2;
|
||||
flush status;
|
||||
create table t3(
|
||||
id int not null primary key,
|
||||
name char(255)
|
||||
) engine=ndb;
|
||||
insert into t3 values (1, "Explorer");
|
||||
select * from t3;
|
||||
id name
|
||||
1 Explorer
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
flush tables;
|
||||
create table t3(
|
||||
id int not null primary key,
|
||||
name char(20), a int, b float, c char(24)
|
||||
) engine=ndb;
|
||||
ERROR 42S01: Table 't3' already exists
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
create table IF NOT EXISTS t3(
|
||||
id int not null primary key,
|
||||
id2 int not null,
|
||||
name char(20)
|
||||
) engine=ndb;
|
||||
Warnings:
|
||||
Note 1050 Table 't3' already exists
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
SHOW CREATE TABLE t3;
|
||||
Table Create Table
|
||||
t3 CREATE TABLE `t3` (
|
||||
`id` int(11) NOT NULL,
|
||||
`name` char(255) default NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
|
||||
select * from t3;
|
||||
id name
|
||||
1 Explorer
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 1
|
||||
drop table t3;
|
||||
flush status;
|
||||
create table t7(
|
||||
id int not null primary key,
|
||||
name char(255)
|
||||
) engine=ndb;
|
||||
create table t6(
|
||||
id int not null primary key,
|
||||
name char(255)
|
||||
) engine=MyISAM;
|
||||
insert into t7 values (1, "Explorer");
|
||||
insert into t6 values (2, "MyISAM table");
|
||||
select * from t7;
|
||||
id name
|
||||
1 Explorer
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
flush tables;
|
||||
show tables from test;
|
||||
Tables_in_test
|
||||
t6
|
||||
t7
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 1
|
||||
flush tables;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t6 MyISAM 10 Fixed 1 # # # # 0 NULL # # NULL # NULL #
|
||||
t7 NDBCLUSTER 10 Fixed 1 # # # # 0 NULL # # NULL # NULL #
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 2
|
||||
drop table t6, t7;
|
||||
flush status;
|
||||
create table t4(
|
||||
id int not null primary key,
|
||||
name char(27)
|
||||
) engine=ndb;
|
||||
insert into t4 values (1, "Automatic");
|
||||
select * from t4;
|
||||
id name
|
||||
1 Automatic
|
||||
select * from t4;
|
||||
ERROR 42S02: Table 'test.t4' doesn't exist
|
||||
select * from t4;
|
||||
ERROR 42S02: Table 'test.t4' doesn't exist
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
drop table t4;
|
||||
ERROR 42S02: Unknown table 't4'
|
||||
create table t4(
|
||||
id int not null primary key,
|
||||
name char(27)
|
||||
) engine=ndb;
|
||||
insert into t4 values (1, "Automatic");
|
||||
select * from t4;
|
||||
id name
|
||||
1 Automatic
|
||||
select * from t4;
|
||||
ERROR 42S02: Table 'test.t4' doesn't exist
|
||||
drop table if exists t4;
|
||||
Warnings:
|
||||
Error 155 Table 'test.t4' doesn't exist
|
||||
drop table t5;
|
||||
ERROR 42S02: Unknown table 't5'
|
||||
drop table if exists t5;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't5'
|
||||
flush status;
|
||||
create table t4(
|
||||
id int not null primary key,
|
||||
id2 int,
|
||||
name char(27)
|
||||
) engine=ndb;
|
||||
insert into t4 values (1, 76, "Automatic2");
|
||||
select * from t4;
|
||||
id id2 name
|
||||
1 76 Automatic2
|
||||
flush tables;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
select * from t4;
|
||||
ERROR 42S02: Table 'test.t4' doesn't exist
|
||||
flush status;
|
||||
create table t1(id int) engine=ndbcluster;
|
||||
create table t2(id int, b char(255)) engine=myisam;
|
||||
create table t3(id int, c char(255)) engine=ndbcluster;
|
||||
create table t4(id int) engine=myisam;
|
||||
create table t5(id int, d char(56)) engine=ndbcluster;
|
||||
create table t6(id int) engine=ndbcluster;
|
||||
create table t7(id int) engine=ndbcluster;
|
||||
create table t8(id int, e char(34)) engine=myisam;
|
||||
create table t9(id int) engine=myisam;
|
||||
insert into t2 values (2, "myisam table 2");
|
||||
insert into t3 values (3, "ndb table 3");
|
||||
insert into t5 values (5, "ndb table 5");
|
||||
insert into t6 values (6);
|
||||
insert into t8 values (8, "myisam table 8");
|
||||
insert into t9 values (9);
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
t1
|
||||
t2
|
||||
t4
|
||||
t8
|
||||
t9
|
||||
t7
|
||||
t6
|
||||
select * from t6;
|
||||
id
|
||||
6
|
||||
select * from t7;
|
||||
id
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 2
|
||||
drop table t1, t2, t4, t6, t7, t8, t9;
|
||||
flush status;
|
||||
create table t1(id int) engine=ndbcluster;
|
||||
create table t2(id int, b char(255)) engine=myisam;
|
||||
create table t3(id int, c char(255)) engine=ndbcluster;
|
||||
create table t4(id int) engine=myisam;
|
||||
create table t5(id int, d char(56)) engine=ndbcluster;
|
||||
create table t6(id int) engine=ndbcluster;
|
||||
create table t7(id int) engine=ndbcluster;
|
||||
create table t8(id int, e char(34)) engine=myisam;
|
||||
create table t9(id int) engine=myisam;
|
||||
insert into t2 values (2, "myisam table 2");
|
||||
insert into t3 values (3, "ndb table 3");
|
||||
insert into t5 values (5, "ndb table 5");
|
||||
insert into t6 values (6);
|
||||
insert into t8 values (8, "myisam table 8");
|
||||
insert into t9 values (9);
|
||||
SHOW TABLES LIKE 't6';
|
||||
Tables_in_test (t6)
|
||||
t6
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 1
|
||||
create table t3(a int);
|
||||
ERROR 42S01: Table 't3' already exists
|
||||
create table t5(a int);
|
||||
ERROR 42S01: Table 't5' already exists
|
||||
SHOW TABLES LIKE 't%';
|
||||
Tables_in_test (t%)
|
||||
t1
|
||||
t2
|
||||
t4
|
||||
t6
|
||||
t8
|
||||
t9
|
||||
t7
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 2
|
||||
drop table t1, t2, t4, t6, t7, t8, t9;
|
||||
flush status;
|
||||
create table t1(id int) engine=ndbcluster;
|
||||
create table t2(id int, b char(255)) engine=ndbcluster;
|
||||
create table t3(id int, c char(255)) engine=ndbcluster;
|
||||
create table t4(id int) engine=myisam;
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (2, "table 2");
|
||||
insert into t3 values (3, "ndb table 3");
|
||||
insert into t4 values (4);
|
||||
flush tables;
|
||||
select * from t1, t2, t3, t4;
|
||||
id id b id c id
|
||||
1 2 table 2 3 ndb table 3 4
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 3
|
||||
drop table t1, t2, t3, t4;
|
||||
flush status;
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
create table t5(
|
||||
id int not null primary key,
|
||||
name char(200)
|
||||
) engine=ndb;
|
||||
insert into t5 values (1, "Magnus");
|
||||
select * from t5;
|
||||
id name
|
||||
1 Magnus
|
||||
ALTER TABLE t5 ADD COLUMN adress char(255) FIRST;
|
||||
select * from t5;
|
||||
adress id name
|
||||
NULL 1 Magnus
|
||||
insert into t5 values
|
||||
("Adress for record 2", 2, "Carl-Gustav"),
|
||||
("Adress for record 3", 3, "Karl-Emil");
|
||||
update t5 set name="Bertil" where id = 2;
|
||||
select * from t5 order by id;
|
||||
adress id name
|
||||
NULL 1 Magnus
|
||||
Adress for record 2 2 Bertil
|
||||
Adress for record 3 3 Karl-Emil
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
drop table t5;
|
||||
flush status;
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
create table t6(
|
||||
id int not null primary key,
|
||||
name char(20)
|
||||
) engine=ndb;
|
||||
insert into t6 values (1, "Magnus");
|
||||
select * from t6;
|
||||
id name
|
||||
1 Magnus
|
||||
ALTER TABLE t6 ADD COLUMN adress char(255) FIRST;
|
||||
select * from t6;
|
||||
adress id name
|
||||
NULL 1 Magnus
|
||||
insert into t6 values
|
||||
("Adress for record 2", 2, "Carl-Gustav"),
|
||||
("Adress for record 3", 3, "Karl-Emil");
|
||||
update t6 set name="Bertil" where id = 2;
|
||||
select * from t6 order by id;
|
||||
adress id name
|
||||
NULL 1 Magnus
|
||||
Adress for record 2 2 Bertil
|
||||
Adress for record 3 3 Karl-Emil
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
drop table t6;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
create table t1 (a int,b longblob) engine=ndb;
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
create database test2;
|
||||
use test2;
|
||||
show tables;
|
||||
Tables_in_test2
|
||||
select * from t1;
|
||||
ERROR 42S02: Table 'test2.t1' doesn't exist
|
||||
create table t2 (b int,c longblob) engine=ndb;
|
||||
use test;
|
||||
select * from t1;
|
||||
a b
|
||||
show tables;
|
||||
Tables_in_test
|
||||
t1
|
||||
drop table t1;
|
||||
use test2;
|
||||
drop table t2;
|
||||
drop database test2;
|
||||
use test;
|
||||
drop database if exists test_only_ndb_tables;
|
||||
create database test_only_ndb_tables;
|
||||
use test_only_ndb_tables;
|
||||
create table t1 (a int primary key) engine=ndb;
|
||||
select * from t1;
|
||||
a
|
||||
select * from t1;
|
||||
ERROR HY000: Can't lock file (errno: 157)
|
||||
use test;
|
||||
drop database test_only_ndb_tables;
|
||||
CREATE TABLE t9 (
|
||||
a int NOT NULL PRIMARY KEY,
|
||||
b int
|
||||
) engine=ndb;
|
||||
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
|
||||
create table t10 (
|
||||
a int not null primary key,
|
||||
b blob
|
||||
) engine=ndb;
|
||||
insert into t10 values (1, 'kalle');
|
||||
@@ -0,0 +1,13 @@
|
||||
select * from t9 order by a;
|
||||
a b
|
||||
1 2
|
||||
2 3
|
||||
3 4
|
||||
4 5
|
||||
show status like 'handler_discover%';
|
||||
Variable_name Value
|
||||
Handler_discover 0
|
||||
drop table t9;
|
||||
select * from t10;
|
||||
ERROR HY000: Got error 4263 'Invalid blob attributes or invalid blob parts table' from NDBCLUSTER
|
||||
drop table t10;
|
||||
@@ -0,0 +1,53 @@
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (a int key) engine=ndbcluster;
|
||||
begin;
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from NDBCLUSTER
|
||||
commit;
|
||||
ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
|
||||
drop table t1;
|
||||
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
|
||||
insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
|
||||
select * from t2 order by a limit 3;
|
||||
a b
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
show tables like 't2';
|
||||
Tables_in_test (t2)
|
||||
reset master;
|
||||
create table t2 (a int key) engine=ndbcluster;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
select * from t2 order by a limit 3;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
select * from t2 order by a limit 3;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
reset master;
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
show tables like 't2';
|
||||
Tables_in_test (t2)
|
||||
reset master;
|
||||
create table t2 (a int key) engine=ndbcluster;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
select * from t2 order by a limit 3;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
select * from t2 order by a limit 3;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
reset master;
|
||||
drop table t2;
|
||||
@@ -0,0 +1,65 @@
|
||||
use test;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
Connected to Management Server at: :
|
||||
Waiting for completed, this may take several minutes
|
||||
Node : Backup started from node
|
||||
Node : Backup started from node completed
|
||||
StartGCP: StopGCP:
|
||||
#Records: #LogRecords:
|
||||
Data: bytes Log: bytes
|
||||
create table t1
|
||||
(pk int key
|
||||
,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
|
||||
,b1 TINYINT, b2 TINYINT UNSIGNED
|
||||
,c1 SMALLINT, c2 SMALLINT UNSIGNED
|
||||
,d1 INT, d2 INT UNSIGNED
|
||||
,e1 BIGINT, e2 BIGINT UNSIGNED
|
||||
,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
|
||||
,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
|
||||
,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
|
||||
,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
|
||||
) engine ndb;
|
||||
insert into t1 values
|
||||
(1
|
||||
,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
|
||||
,127, 255
|
||||
,32767, 65535
|
||||
,2147483647, 4294967295
|
||||
,9223372036854775807, 18446744073709551615
|
||||
,'1','12345678901234567890123456789012','123456789'
|
||||
,'1','12345678901234567890123456789012','123456789'
|
||||
,0x12,0x123456789abcdef0, 0x012345
|
||||
,0x12,0x123456789abcdef0, 0x00123450
|
||||
);
|
||||
insert into t1 values
|
||||
(2
|
||||
,0, 0, 0, 0, 0
|
||||
,-128, 0
|
||||
,-32768, 0
|
||||
,-2147483648, 0
|
||||
,-9223372036854775808, 0
|
||||
,'','',''
|
||||
,'','',''
|
||||
,0x0,0x0,0x0
|
||||
,0x0,0x0,0x0
|
||||
);
|
||||
insert into t1 values
|
||||
(3
|
||||
,NULL,NULL,NULL,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
);
|
||||
Connected to Management Server at: :
|
||||
Waiting for completed, this may take several minutes
|
||||
Node : Backup started from node
|
||||
Node : Backup started from node completed
|
||||
StartGCP: StopGCP:
|
||||
#Records: #LogRecords:
|
||||
Data: bytes Log: bytes
|
||||
drop table t1;
|
||||
@@ -0,0 +1,512 @@
|
||||
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 CHAR(50) 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
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info
|
||||
(id INT, backup_id INT) ENGINE = MEMORY;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
|
||||
DROP TABLE test.backup_info;
|
||||
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;
|
||||
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 VARCHAR(200) 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 TEMPORARY TABLE IF NOT EXISTS test.backup_info
|
||||
(id INT, backup_id INT) ENGINE = MEMORY;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
|
||||
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 VARCHAR(150) 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 VARCHAR(180) 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 VARCHAR(202) 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 VARCHAR(220) 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` varchar(150) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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`)
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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` varchar(202) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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` varchar(180) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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
|
||||
/*!50100 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` varchar(220) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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 table_space1
|
||||
NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space1
|
||||
NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space1
|
||||
NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space1
|
||||
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 table_space2
|
||||
NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space2
|
||||
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 table_space2
|
||||
NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space2
|
||||
NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space2
|
||||
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 NULL
|
||||
NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default NULL
|
||||
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 NULL
|
||||
NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default NULL
|
||||
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 NULL
|
||||
NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default NULL
|
||||
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 TEMPORARY TABLE IF NOT EXISTS test.backup_info
|
||||
(id INT, backup_id INT) ENGINE = MEMORY;
|
||||
LOAD DATA INFILE '<MYSQLTEST_VARDIR>/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
|
||||
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` varchar(150) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) /*!50100 TABLESPACE table_space1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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`)
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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` varchar(202) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) /*!50100 TABLESPACE table_space2 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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` varchar(180) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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
|
||||
/*!50100 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` varchar(220) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` bit(1) NOT NULL,
|
||||
PRIMARY KEY (`pk1`,`c3`)
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
/*!50100 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 table_space1
|
||||
NULL test t1 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space1
|
||||
NULL test t1 p2 NULL 3 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space1
|
||||
NULL test t1 p3 NULL 4 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space1
|
||||
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 table_space2
|
||||
NULL test t2 p1 NULL 2 NULL KEY NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space2
|
||||
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 table_space2
|
||||
NULL test t3 x2 NULL 2 NULL RANGE NULL c3 NULL 333 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space2
|
||||
NULL test t3 x3 NULL 3 NULL RANGE NULL c3 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default table_space2
|
||||
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 NULL
|
||||
NULL test t4 p1 NULL 2 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default NULL
|
||||
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 NULL
|
||||
NULL test t5 p1 NULL 2 NULL KEY NULL pk1 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default NULL
|
||||
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 NULL
|
||||
NULL test t6 x2 NULL 2 NULL RANGE NULL pk1 NULL 720 0 0 0 NULL 0 0 NULL NULL NULL NULL default NULL
|
||||
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;
|
||||
@@ -0,0 +1,323 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
DROP TABLE IF EXISTS t1, t2, t3;
|
||||
***** Test 1 RPL of CDD and Alter *****
|
||||
***** Test 1 setup *****
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE 4M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile02.dat'
|
||||
INITIAL_SIZE 4M
|
||||
ENGINE=NDB;
|
||||
CREATE TABLE t1
|
||||
(c1 INT NOT NULL PRIMARY KEY,
|
||||
c2 INT NOT NULL,
|
||||
c3 INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
***** insert some data *****
|
||||
***** Select from Master *****
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
c1 c2 c3
|
||||
1 2 4
|
||||
2 4 5
|
||||
3 6 6
|
||||
4 8 7
|
||||
5 10 8
|
||||
***** Select from Slave *****
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
c1 c2 c3
|
||||
1 2 4
|
||||
2 4 5
|
||||
3 6 6
|
||||
4 8 7
|
||||
5 10 8
|
||||
FILE_NAME FILE_TYPE TABLESPACE_NAME LOGFILE_GROUP_NAME
|
||||
NULL UNDO LOG NULL lg1
|
||||
datafile.dat DATAFILE ts1 lg1
|
||||
datafile02.dat DATAFILE ts1 lg1
|
||||
undofile.dat UNDO LOG NULL lg1
|
||||
undofile02.dat UNDO LOG NULL lg1
|
||||
**** Do First Set of ALTERs in the master table ****
|
||||
CREATE INDEX t1_i ON t1(c2, c3);
|
||||
CREATE UNIQUE INDEX t1_i2 ON t1(c2);
|
||||
ALTER TABLE t1 ADD c4 TIMESTAMP;
|
||||
ALTER TABLE t1 ADD c5 DOUBLE;
|
||||
ALTER TABLE t1 ADD INDEX (c5);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`),
|
||||
KEY `c5` (`c5`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
**** Show first set of ALTERs on SLAVE ****
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`),
|
||||
KEY `c5` (`c5`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
**** Second set of alters test 1 ****
|
||||
ALTER TABLE t1 RENAME t2;
|
||||
ALTER TABLE t2 DROP INDEX c5;
|
||||
CREATE TABLE t1(c1 INT)ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
DROP TABLE t1;
|
||||
ALTER TABLE t2 RENAME t1;
|
||||
**** Show second set of ALTERs on MASTER ****
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
**** Show second set of ALTERs on SLAVE ****
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL,
|
||||
`c2` int(11) NOT NULL,
|
||||
`c3` int(11) NOT NULL,
|
||||
`c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`,`c3`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
**** Third and last set of alters for test1 ****
|
||||
ALTER TABLE t1 CHANGE c1 c1 DOUBLE;
|
||||
ALTER TABLE t1 CHANGE c2 c2 DECIMAL(10,2);
|
||||
ALTER TABLE t1 DROP COLUMN c3;
|
||||
ALTER TABLE t1 CHANGE c4 c4 TEXT CHARACTER SET utf8;
|
||||
ALTER TABLE t1 CHANGE c4 c4 BLOB;
|
||||
ALTER TABLE t1 CHANGE c4 c3 BLOB;
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
UPDATE t1 SET c3=@b1 where c1 = 1;
|
||||
UPDATE t1 SET c3=@b1 where c1 = 2;
|
||||
**** Show last set of ALTERs on MASTER ****
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` double NOT NULL DEFAULT '0',
|
||||
`c2` decimal(10,2) DEFAULT NULL,
|
||||
`c3` blob,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
c1 c2 c3 c5
|
||||
1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
2 4.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
3 6.00 0000-00-00 00:00:00 NULL
|
||||
4 8.00 0000-00-00 00:00:00 NULL
|
||||
5 10.00 0000-00-00 00:00:00 NULL
|
||||
**** Show last set of ALTERs on SLAVE ****
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` double NOT NULL DEFAULT '0',
|
||||
`c2` decimal(10,2) DEFAULT NULL,
|
||||
`c3` blob,
|
||||
`c5` double DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`),
|
||||
UNIQUE KEY `t1_i2` (`c2`),
|
||||
KEY `t1_i` (`c2`)
|
||||
) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
c1 c2 c3 c5
|
||||
1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
2 4.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
3 6.00 0000-00-00 00:00:00 NULL
|
||||
4 8.00 0000-00-00 00:00:00 NULL
|
||||
5 10.00 0000-00-00 00:00:00 NULL
|
||||
SELECT * FROM t1 where c1 = 1;
|
||||
c1 c2 c3 c5
|
||||
1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL
|
||||
DROP TABLE t1;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
RESET MASTER;
|
||||
START SLAVE;
|
||||
******** Create additional TABLESPACE test 2 **************
|
||||
CREATE TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile03.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 10M
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile04.dat'
|
||||
INITIAL_SIZE 5M
|
||||
ENGINE=NDB;
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
CREATE DATABASE tpcb;
|
||||
|
||||
CREATE TABLE tpcb.account
|
||||
(id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id))
|
||||
TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
CREATE TABLE tpcb.branch
|
||||
(bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid))TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
CREATE TABLE tpcb.teller
|
||||
(tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid)) TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
CREATE TABLE tpcb.history
|
||||
(id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id))
|
||||
TABLESPACE ts2 STORAGE DISK
|
||||
ENGINE=NDBCLUSTER;
|
||||
|
||||
--- Create stored procedures & functions ---
|
||||
|
||||
|
||||
*** Stored Procedures Created ***
|
||||
|
||||
****** TEST 2 test time *********************************
|
||||
USE tpcb;
|
||||
*********** Load up the database ******************
|
||||
CALL tpcb.load();
|
||||
********** Check load master and slave **************
|
||||
SELECT COUNT(*) FROM account;
|
||||
COUNT(*)
|
||||
1000
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM account;
|
||||
COUNT(*)
|
||||
1000
|
||||
******** Run in some transactions ***************
|
||||
***** Time to try slave sync ***********
|
||||
**** Must make sure slave is clean *****
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
DROP PROCEDURE IF EXISTS tpcb.load;
|
||||
DROP PROCEDURE IF EXISTS tpcb.trans;
|
||||
DROP TABLE IF EXISTS tpcb.account;
|
||||
DROP TABLE IF EXISTS tpcb.teller;
|
||||
DROP TABLE IF EXISTS tpcb.branch;
|
||||
DROP TABLE IF EXISTS tpcb.history;
|
||||
DROP DATABASE tpcb;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts1 ENGINE=NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile03.dat'
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile04.dat'
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts2 ENGINE=NDB;
|
||||
DROP LOGFILE GROUP lg1 ENGINE=NDB;
|
||||
********** Take a backup of the Master *************
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
100
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
200
|
||||
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
|
||||
LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
|
||||
DROP TABLE test.backup_info;
|
||||
************ Restore the slave ************************
|
||||
CREATE DATABASE tpcb;
|
||||
***** Check a few slave restore values ***************
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM account;
|
||||
COUNT(*)
|
||||
1000
|
||||
***** Add some more records to master *********
|
||||
***** Finsh the slave sync process *******
|
||||
@the_epoch:=MAX(epoch)
|
||||
<the_epoch>
|
||||
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
|
||||
<the_pos> master-bin.000001
|
||||
* 4. *
|
||||
* 5. *
|
||||
START SLAVE;
|
||||
**** We should be ready to continue on *************
|
||||
****** Let's make sure we match *******
|
||||
***** MASTER *******
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
400
|
||||
****** SLAVE ********
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM history;
|
||||
COUNT(*)
|
||||
400
|
||||
*** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
*************** TEST 2 CLEANUP SECTION ********************
|
||||
DROP PROCEDURE IF EXISTS tpcb.load;
|
||||
DROP PROCEDURE IF EXISTS tpcb.trans;
|
||||
DROP TABLE tpcb.account;
|
||||
DROP TABLE tpcb.teller;
|
||||
DROP TABLE tpcb.branch;
|
||||
DROP TABLE tpcb.history;
|
||||
DROP DATABASE tpcb;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts1 ENGINE=NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile03.dat'
|
||||
ENGINE=NDB;
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile04.dat'
|
||||
ENGINE=NDB;
|
||||
DROP TABLESPACE ts2 ENGINE=NDB;
|
||||
DROP LOGFILE GROUP lg1 ENGINE=NDB;
|
||||
****** Do dumps compare ************
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,143 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
|
||||
*** Test 1 ***
|
||||
|
||||
create table t1 (a int key, b int) engine innodb;
|
||||
create table t2 (a int key, b int) engine innodb;
|
||||
|
||||
alter table t1 engine ndb;
|
||||
alter table t2 engine ndb;
|
||||
|
||||
insert into t1 values (1,2);
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
# Now check that that is in the apply_status table is consistant
|
||||
# with what is in the binlog
|
||||
|
||||
# since insert is done with transactional engine, expect a BEGIN
|
||||
# at <start_pos>
|
||||
|
||||
show binlog events from <binlog_start> limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
|
||||
# Now the insert, one step after
|
||||
|
||||
show binlog events from <binlog_start> limit 1,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1,2)
|
||||
|
||||
# and the COMMIT should be at <end_pos>
|
||||
|
||||
show binlog events from <binlog_start> limit 2,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
begin;
|
||||
insert into t1 values (2,3);
|
||||
insert into t2 values (3,4);
|
||||
commit;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
show binlog events from <binlog_start> limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
|
||||
show binlog events from <binlog_start> limit 1,2;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (2,3)
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (3,4)
|
||||
|
||||
show binlog events from <binlog_start> limit 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
|
||||
DROP TABLE test.t1, test.t2;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
|
||||
*** Test 2 ***
|
||||
|
||||
DROP DATABASE IF EXISTS tpcb;
|
||||
CREATE DATABASE tpcb;
|
||||
|
||||
CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2),
|
||||
filler CHAR(255), PRIMARY KEY(id));
|
||||
|
||||
CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(bid));
|
||||
|
||||
CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255),
|
||||
PRIMARY KEY(tid));
|
||||
|
||||
CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT,
|
||||
tid INT, bid INT, amount DECIMAL(10,2),
|
||||
tdate DATETIME, teller CHAR(20), uuidf LONGBLOB,
|
||||
filler CHAR(80),PRIMARY KEY (id));
|
||||
|
||||
--- Create stored procedures & functions ---
|
||||
|
||||
|
||||
*** Stored Procedures Created ***
|
||||
|
||||
USE tpcb;
|
||||
ALTER TABLE account ENGINE NDB;
|
||||
ALTER TABLE branch ENGINE NDB;
|
||||
ALTER TABLE teller ENGINE NDB;
|
||||
ALTER TABLE history ENGINE NDB;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000001' from <start_pos> limit 9,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
** Test 3 **
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000002' from <start_pos> limit 9,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000002 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
** Test 4 **
|
||||
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
|
||||
select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos
|
||||
from mysql.ndb_apply_status;
|
||||
@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos
|
||||
<log_name> <start_pos> <end_pos>
|
||||
|
||||
show binlog events in 'master-bin.000001' from <start_pos> limit 9,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */
|
||||
|
||||
*** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
DROP DATABASE tpcb;
|
||||
****** Do dumps compare ************
|
||||
20
build/lib/mysql/mysql-test/suite/ndb_team/t/disabled.def
Normal file
20
build/lib/mysql/mysql-test/suite/ndb_team/t/disabled.def
Normal file
@@ -0,0 +1,20 @@
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
ndb_autodiscover : BUG#11745709 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
ndb_autodiscover2 : BUG#11745709 2006-02-16 jmiller Needs to be fixed w.r.t binlog
|
||||
|
||||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
#ndb_autodiscover3 : bug#21806
|
||||
#ndb_autodiscover3 : Bug#20872 2007-07-15 ingo master*.err: miscellaneous error messages
|
||||
#rpl_ndb_extraColMaster : BUG#30854 : Tables name show as binary in slave err msg on vm-win2003-64-b and Solaris
|
||||
#rpl_ndb_mix_innodb : Bug #32720 Test rpl_ndb_mix_innodb fails on SPARC and PowerPC
|
||||
#rpl_ndb_dd_advance : Bug #30222 rpl_ndb_dd_advance.test fails
|
||||
@@ -0,0 +1,555 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# Bug#41308: Test main.ndb_autodiscover.test doesn't work on Windows due
|
||||
# to 'grep' calls
|
||||
# Test is currently disabled on Windows via the next line until this bug
|
||||
# can be resolved.
|
||||
--source include/not_windows.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
--enable_warnings
|
||||
|
||||
################################################
|
||||
# Test that a table that does not exist as a
|
||||
# frm file on disk can be "discovered" from a
|
||||
# connected NDB Cluster
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
#
|
||||
# Test discover + SELECT
|
||||
#
|
||||
|
||||
create table t1(
|
||||
id int not null primary key,
|
||||
name char(20)
|
||||
) engine=ndb;
|
||||
|
||||
insert into t1 values(1, "Autodiscover");
|
||||
flush tables;
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
|
||||
select * from t1;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
#
|
||||
# Test discover + INSERT
|
||||
#
|
||||
|
||||
flush tables;
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
|
||||
insert into t1 values (2, "Auto 2");
|
||||
show status like 'handler_discover%';
|
||||
insert into t1 values (3, "Discover 3");
|
||||
show status like 'handler_discover%';
|
||||
flush tables;
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
|
||||
select * from t1 order by id;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
#
|
||||
# Test discover + UPDATE
|
||||
#
|
||||
|
||||
flush tables;
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
|
||||
update t1 set name="Autodiscover" where id = 2;
|
||||
show status like 'handler_discover%';
|
||||
select * from t1 order by id;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
#
|
||||
# Test discover + DELETE
|
||||
#
|
||||
|
||||
flush tables;
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
|
||||
delete from t1 where id = 3;
|
||||
select * from t1 order by id;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
######################################################
|
||||
# Test that a table that is outdated on disk
|
||||
# can be "discovered" from a connected NDB Cluster
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
create table t2(
|
||||
id int not null primary key,
|
||||
name char(22)
|
||||
) engine=ndb;
|
||||
insert into t2 values (1, "Discoverer");
|
||||
select * from t2;
|
||||
show status like 'handler_discover%';
|
||||
flush tables;
|
||||
|
||||
# Modify the frm file on disk
|
||||
system echo "blaj" >> $MYSQLTEST_VARDIR/master-data/test/t2.frm ;
|
||||
select * from t2;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t2;
|
||||
|
||||
|
||||
##################################################
|
||||
# Test that a table that already exists in NDB
|
||||
# is only discovered if CREATE TABLE IF NOT EXISTS
|
||||
# is used
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
create table t3(
|
||||
id int not null primary key,
|
||||
name char(255)
|
||||
) engine=ndb;
|
||||
insert into t3 values (1, "Explorer");
|
||||
select * from t3;
|
||||
show status like 'handler_discover%';
|
||||
flush tables;
|
||||
|
||||
# Remove the frm file from disk
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
|
||||
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
create table t3(
|
||||
id int not null primary key,
|
||||
name char(20), a int, b float, c char(24)
|
||||
) engine=ndb;
|
||||
|
||||
# The table shall not have been discovered since
|
||||
# IF NOT EXISTS wasn't specified
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
# now it should be discovered
|
||||
create table IF NOT EXISTS t3(
|
||||
id int not null primary key,
|
||||
id2 int not null,
|
||||
name char(20)
|
||||
) engine=ndb;
|
||||
|
||||
# NOTE! the table called t3 have now been updated to
|
||||
# use the same frm as in NDB, thus it's not certain that
|
||||
# the table schema is the same as was stated in the
|
||||
# CREATE TABLE statement above
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
SHOW CREATE TABLE t3;
|
||||
|
||||
select * from t3;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t3;
|
||||
|
||||
##################################################
|
||||
# Test that a table that already exists in NDB
|
||||
# is discovered when SHOW TABLES
|
||||
# is used
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
create table t7(
|
||||
id int not null primary key,
|
||||
name char(255)
|
||||
) engine=ndb;
|
||||
create table t6(
|
||||
id int not null primary key,
|
||||
name char(255)
|
||||
) engine=MyISAM;
|
||||
insert into t7 values (1, "Explorer");
|
||||
insert into t6 values (2, "MyISAM table");
|
||||
select * from t7;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
# Remove the frm file from disk
|
||||
flush tables;
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
|
||||
|
||||
show tables from test;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
# Remove the frm file from disk again
|
||||
flush tables;
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
|
||||
|
||||
--replace_column 6 # 7 # 8 # 9 # 12 # 13 # 15 # 18 #
|
||||
show table status;
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t6, t7;
|
||||
|
||||
|
||||
#######################################################
|
||||
# Test that a table that has been dropped from NDB
|
||||
# but still exists on disk, get a consistent error message
|
||||
# saying "No such table existed"
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
create table t4(
|
||||
id int not null primary key,
|
||||
name char(27)
|
||||
) engine=ndb;
|
||||
insert into t4 values (1, "Automatic");
|
||||
select * from t4;
|
||||
|
||||
# Remove the table from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
|
||||
|
||||
#
|
||||
# Test that correct error is returned
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t4;
|
||||
|
||||
create table t4(
|
||||
id int not null primary key,
|
||||
name char(27)
|
||||
) engine=ndb;
|
||||
insert into t4 values (1, "Automatic");
|
||||
select * from t4;
|
||||
|
||||
# Remove the table from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
|
||||
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
|
||||
drop table if exists t4;
|
||||
|
||||
# Test that dropping a table that does not exists
|
||||
# on disk or in NDB gives same result as above
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t5;
|
||||
drop table if exists t5;
|
||||
|
||||
|
||||
#######################################################
|
||||
# Test that a table that has been dropped from NDB
|
||||
# but still exists on disk is deleted from disk
|
||||
# when SHOW TABLES is called
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
create table t4(
|
||||
id int not null primary key,
|
||||
id2 int,
|
||||
name char(27)
|
||||
) engine=ndb;
|
||||
insert into t4 values (1, 76, "Automatic2");
|
||||
select * from t4;
|
||||
flush tables;
|
||||
|
||||
# Remove the table from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
|
||||
|
||||
SHOW TABLES;
|
||||
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t4;
|
||||
|
||||
#######################################################
|
||||
# Test SHOW TABLES ability to detect new and delete old
|
||||
# tables. Test all at once using many tables
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
# Create tables
|
||||
create table t1(id int) engine=ndbcluster;
|
||||
create table t2(id int, b char(255)) engine=myisam;
|
||||
create table t3(id int, c char(255)) engine=ndbcluster;
|
||||
create table t4(id int) engine=myisam;
|
||||
create table t5(id int, d char(56)) engine=ndbcluster;
|
||||
create table t6(id int) engine=ndbcluster;
|
||||
create table t7(id int) engine=ndbcluster;
|
||||
create table t8(id int, e char(34)) engine=myisam;
|
||||
create table t9(id int) engine=myisam;
|
||||
|
||||
# Populate tables
|
||||
insert into t2 values (2, "myisam table 2");
|
||||
insert into t3 values (3, "ndb table 3");
|
||||
insert into t5 values (5, "ndb table 5");
|
||||
insert into t6 values (6);
|
||||
insert into t8 values (8, "myisam table 8");
|
||||
insert into t9 values (9);
|
||||
|
||||
# Remove t3, t5 from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ;
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ;
|
||||
# Remove t6, t7 from disk
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
|
||||
|
||||
SHOW TABLES;
|
||||
|
||||
select * from t6;
|
||||
select * from t7;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t1, t2, t4, t6, t7, t8, t9;
|
||||
|
||||
#######################################################
|
||||
# Test SHOW TABLES LIKE ability to detect new and delete old
|
||||
# tables. Test all at once using many tables.
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
# Create tables
|
||||
create table t1(id int) engine=ndbcluster;
|
||||
create table t2(id int, b char(255)) engine=myisam;
|
||||
create table t3(id int, c char(255)) engine=ndbcluster;
|
||||
create table t4(id int) engine=myisam;
|
||||
create table t5(id int, d char(56)) engine=ndbcluster;
|
||||
create table t6(id int) engine=ndbcluster;
|
||||
create table t7(id int) engine=ndbcluster;
|
||||
create table t8(id int, e char(34)) engine=myisam;
|
||||
create table t9(id int) engine=myisam;
|
||||
|
||||
# Populate tables
|
||||
insert into t2 values (2, "myisam table 2");
|
||||
insert into t3 values (3, "ndb table 3");
|
||||
insert into t5 values (5, "ndb table 5");
|
||||
insert into t6 values (6);
|
||||
insert into t8 values (8, "myisam table 8");
|
||||
insert into t9 values (9);
|
||||
|
||||
# Remove t3, t5 from NDB
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
|
||||
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
|
||||
# Remove t6, t7 from disk
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
|
||||
|
||||
|
||||
SHOW TABLES LIKE 't6';
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
# Check that t3 or t5 can't be created
|
||||
# frm files for these tables is stilll on disk
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
create table t3(a int);
|
||||
--error ER_TABLE_EXISTS_ERROR
|
||||
create table t5(a int);
|
||||
|
||||
SHOW TABLES LIKE 't%';
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t1, t2, t4, t6, t7, t8, t9;
|
||||
|
||||
|
||||
|
||||
######################################################
|
||||
# Test that several tables can be discovered when
|
||||
# one statement access several table at once.
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
# Create tables
|
||||
create table t1(id int) engine=ndbcluster;
|
||||
create table t2(id int, b char(255)) engine=ndbcluster;
|
||||
create table t3(id int, c char(255)) engine=ndbcluster;
|
||||
create table t4(id int) engine=myisam;
|
||||
|
||||
# Populate tables
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (2, "table 2");
|
||||
insert into t3 values (3, "ndb table 3");
|
||||
insert into t4 values (4);
|
||||
|
||||
# Remove t1, t2, t3 from disk
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t2.frm
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
|
||||
flush tables;
|
||||
|
||||
# Select from the table which only exists in NDB.
|
||||
select * from t1, t2, t3, t4;
|
||||
|
||||
# 3 table should have been discovered
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t1, t2, t3, t4;
|
||||
|
||||
|
||||
#########################################################
|
||||
# Test that a table that has been changed in NDB
|
||||
# since it's been opened will be refreshed and discovered
|
||||
# again
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
create table t5(
|
||||
id int not null primary key,
|
||||
name char(200)
|
||||
) engine=ndb;
|
||||
insert into t5 values (1, "Magnus");
|
||||
select * from t5;
|
||||
|
||||
ALTER TABLE t5 ADD COLUMN adress char(255) FIRST;
|
||||
|
||||
select * from t5;
|
||||
|
||||
insert into t5 values
|
||||
("Adress for record 2", 2, "Carl-Gustav"),
|
||||
("Adress for record 3", 3, "Karl-Emil");
|
||||
update t5 set name="Bertil" where id = 2;
|
||||
select * from t5 order by id;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t5;
|
||||
|
||||
|
||||
################################################################
|
||||
# Test that a table that has been changed with ALTER TABLE
|
||||
# can be used from the same thread
|
||||
#
|
||||
|
||||
flush status;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
create table t6(
|
||||
id int not null primary key,
|
||||
name char(20)
|
||||
) engine=ndb;
|
||||
insert into t6 values (1, "Magnus");
|
||||
select * from t6;
|
||||
|
||||
ALTER TABLE t6 ADD COLUMN adress char(255) FIRST;
|
||||
|
||||
select * from t6;
|
||||
insert into t6 values
|
||||
("Adress for record 2", 2, "Carl-Gustav"),
|
||||
("Adress for record 3", 3, "Karl-Emil");
|
||||
update t6 set name="Bertil" where id = 2;
|
||||
select * from t6 order by id;
|
||||
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t6;
|
||||
|
||||
#####################################################
|
||||
# Test that only tables in the current database shows
|
||||
# up in SHOW TABLES
|
||||
#
|
||||
|
||||
show tables;
|
||||
|
||||
create table t1 (a int,b longblob) engine=ndb;
|
||||
show tables;
|
||||
create database test2;
|
||||
use test2;
|
||||
show tables;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t1;
|
||||
create table t2 (b int,c longblob) engine=ndb;
|
||||
use test;
|
||||
select * from t1;
|
||||
show tables;
|
||||
drop table t1;
|
||||
use test2;
|
||||
drop table t2;
|
||||
drop database test2;
|
||||
use test;
|
||||
|
||||
#########################################################
|
||||
# Bug#8035
|
||||
# mysqld would segfault on second select * before bug was fixed
|
||||
#
|
||||
--disable_warnings
|
||||
drop database if exists test_only_ndb_tables;
|
||||
--enable_warnings
|
||||
create database test_only_ndb_tables;
|
||||
use test_only_ndb_tables;
|
||||
create table t1 (a int primary key) engine=ndb;
|
||||
select * from t1;
|
||||
--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
|
||||
--error ER_CANT_LOCK
|
||||
select * from t1;
|
||||
--exec $NDB_MGM --no-defaults -e "all start" > /dev/null
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null
|
||||
--source include/ndb_wait_connected.inc
|
||||
use test;
|
||||
drop database test_only_ndb_tables;
|
||||
|
||||
#####################################################
|
||||
# Test that it's not possible to create tables
|
||||
# with same name as NDB internal tables
|
||||
# This will also test that it's not possible to create
|
||||
# a table with tha same name as a table that can't be
|
||||
# discovered( for example a table created via NDBAPI)
|
||||
|
||||
# Test disabled since it doesn't work on case insensitive systems
|
||||
#--error ER_TABLE_EXISTS_ERROR
|
||||
#CREATE TABLE sys.SYSTAB_0 (a int);
|
||||
#--error ER_UNKNOWN_ERROR
|
||||
#select * from sys.SYSTAB_0;
|
||||
|
||||
#CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
|
||||
#show warnings;
|
||||
#--error ER_UNKNOWN_ERROR
|
||||
#select * from sys.SYSTAB_0;
|
||||
|
||||
#--error ER_BAD_TABLE_ERROR
|
||||
#drop table sys.SYSTAB_0;
|
||||
#drop table IF EXISTS sys.SYSTAB_0;
|
||||
|
||||
######################################################
|
||||
# Note! This should always be the last step in this
|
||||
# file, the table t9 will be used and dropped
|
||||
# by ndb_autodiscover2
|
||||
#
|
||||
|
||||
CREATE TABLE t9 (
|
||||
a int NOT NULL PRIMARY KEY,
|
||||
b int
|
||||
) engine=ndb;
|
||||
|
||||
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
|
||||
|
||||
#Don't drop the table, instead remove the frm file
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/test/t9.frm
|
||||
|
||||
# Now leave test case, when ndb_autodiscover2 will run, this
|
||||
# MySQL Server will have been restarted because it has a
|
||||
# ndb_autodiscover2-master.opt file.
|
||||
|
||||
create table t10 (
|
||||
a int not null primary key,
|
||||
b blob
|
||||
) engine=ndb;
|
||||
|
||||
insert into t10 values (1, 'kalle');
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB | while read a b c d e f g; do echo $g; done` >> $NDB_TOOLS_OUTPUT 2>&1 || true
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,21 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Simple test to show use of discover when the server has been restarted
|
||||
# The previous step has simply removed the frm file
|
||||
# from disk, but left the table in NDB
|
||||
#
|
||||
--sleep 3
|
||||
select * from t9 order by a;
|
||||
|
||||
# handler_discover should be 1
|
||||
show status like 'handler_discover%';
|
||||
|
||||
drop table t9;
|
||||
|
||||
--error 1296
|
||||
select * from t10;
|
||||
drop table t10;
|
||||
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,104 @@
|
||||
-- source include/have_multi_ndb.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# see bug#21563
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (con2,127.0.0.1,root,,test,$MASTER_MYPORT1,);
|
||||
|
||||
# Workaround for Bug#27644
|
||||
# ndb: connecting api node/mysqld may "steal" node_id from running mysqld
|
||||
# - let ndb_waiter use a fixed node id so "steal" cannot happen
|
||||
--let connect_str = "nodeid=6;$NDB_CONNECTSTRING"
|
||||
|
||||
#
|
||||
# Transaction ongoing while cluster is restarted
|
||||
#
|
||||
--connection server1
|
||||
create table t1 (a int key) engine=ndbcluster;
|
||||
|
||||
begin;
|
||||
insert into t1 values (1);
|
||||
|
||||
--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
|
||||
# Wait for mysqld to reconnect and exit from readonly mode
|
||||
--disable_query_log
|
||||
--connection con1
|
||||
--source include/ndb_not_readonly.inc
|
||||
--connection con2
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection server1
|
||||
--error 1297
|
||||
insert into t1 values (2);
|
||||
--error 1296
|
||||
commit;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Stale cache after restart -i
|
||||
#
|
||||
--connection server1
|
||||
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
|
||||
insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
|
||||
select * from t2 order by a limit 3;
|
||||
|
||||
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
|
||||
# to ensure mysqld has connected again, and recreated system tables
|
||||
--disable_query_log
|
||||
--connection con1
|
||||
--source include/ndb_not_readonly.inc
|
||||
--connection con2
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection server2
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t2;
|
||||
show tables like 't2';
|
||||
reset master;
|
||||
create table t2 (a int key) engine=ndbcluster;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
select * from t2 order by a limit 3;
|
||||
|
||||
# server 1 should have a stale cache, and in this case wrong frm, transaction must be retried
|
||||
--connection server1
|
||||
select * from t2 order by a limit 3;
|
||||
reset master;
|
||||
|
||||
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT
|
||||
# to ensure mysqld has connected again, and recreated system tables
|
||||
--disable_query_log
|
||||
--connection con1
|
||||
--source include/ndb_not_readonly.inc
|
||||
--connection con2
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection server1
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t2;
|
||||
show tables like 't2';
|
||||
reset master;
|
||||
create table t2 (a int key) engine=ndbcluster;
|
||||
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
select * from t2 order by a limit 3;
|
||||
|
||||
# server 2 should have a stale cache, but with right frm, transaction need not be retried
|
||||
--connection server2
|
||||
select * from t2 order by a limit 3;
|
||||
reset master;
|
||||
|
||||
drop table t2;
|
||||
# End of 4.1 tests
|
||||
@@ -0,0 +1,68 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
use test;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
||||
--enable_warnings
|
||||
|
||||
#NO.1 test output of backup
|
||||
--exec $NDB_MGM --no-defaults -e "start backup" |sed -e 's/[0-9]//g' |sed -e 's/localhost//g' |sed -e 's/\.\.\.*//g'
|
||||
|
||||
create table t1
|
||||
(pk int key
|
||||
,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
|
||||
,b1 TINYINT, b2 TINYINT UNSIGNED
|
||||
,c1 SMALLINT, c2 SMALLINT UNSIGNED
|
||||
,d1 INT, d2 INT UNSIGNED
|
||||
,e1 BIGINT, e2 BIGINT UNSIGNED
|
||||
,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
|
||||
,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
|
||||
,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
|
||||
,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
|
||||
) engine ndb;
|
||||
|
||||
insert into t1 values
|
||||
(1
|
||||
,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
|
||||
,127, 255
|
||||
,32767, 65535
|
||||
,2147483647, 4294967295
|
||||
,9223372036854775807, 18446744073709551615
|
||||
,'1','12345678901234567890123456789012','123456789'
|
||||
,'1','12345678901234567890123456789012','123456789'
|
||||
,0x12,0x123456789abcdef0, 0x012345
|
||||
,0x12,0x123456789abcdef0, 0x00123450
|
||||
);
|
||||
|
||||
insert into t1 values
|
||||
(2
|
||||
,0, 0, 0, 0, 0
|
||||
,-128, 0
|
||||
,-32768, 0
|
||||
,-2147483648, 0
|
||||
,-9223372036854775808, 0
|
||||
,'','',''
|
||||
,'','',''
|
||||
,0x0,0x0,0x0
|
||||
,0x0,0x0,0x0
|
||||
);
|
||||
|
||||
insert into t1 values
|
||||
(3
|
||||
,NULL,NULL,NULL,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
,NULL,NULL,NULL
|
||||
);
|
||||
|
||||
#NO.2 test output of backup after some simple SQL operations
|
||||
--exec $NDB_MGM --no-defaults -e "start backup" |sed -e 's/[0-9]//g' |sed -e 's/localhost//g' |sed -e 's/\.\.\.*//g'
|
||||
|
||||
drop table t1;
|
||||
@@ -0,0 +1,349 @@
|
||||
########################################
|
||||
# Author: JBM
|
||||
# Date: 2006-01-24
|
||||
# Purpose: Test CDD backup and restore
|
||||
########################################
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_default_cluster.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_query_log
|
||||
set new=on;
|
||||
--enable_query_log
|
||||
|
||||
--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;
|
||||
###################### 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 VARCHAR(150) 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 VARCHAR(180) 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 VARCHAR(202) 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 VARCHAR(220) 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;
|
||||
|
||||
-- source include/ndb_backup.inc
|
||||
|
||||
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;
|
||||
|
||||
-- source include/ndb_restore_master.inc
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
###############################################
|
||||
# Purpose: To test advance DD and replication #
|
||||
###############################################
|
||||
|
||||
#### Include Section ####
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_default_cluster.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
######################################################
|
||||
# Requirment: Cluster DD and replication must be able#
|
||||
# to handle ALTER tables and indexes and must rpl #
|
||||
# to the slave correctly #
|
||||
######################################################
|
||||
|
||||
## Test #1 replication of CDD and Alter Tables #####
|
||||
--echo ***** Test 1 RPL of CDD and Alter *****
|
||||
--echo ***** Test 1 setup *****
|
||||
|
||||
CREATE LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile.dat'
|
||||
INITIAL_SIZE 16M
|
||||
UNDO_BUFFER_SIZE = 1M
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER LOGFILE GROUP lg1
|
||||
ADD UNDOFILE 'undofile02.dat'
|
||||
INITIAL_SIZE 4M
|
||||
ENGINE=NDB;
|
||||
|
||||
CREATE TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 12M
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts1
|
||||
ADD DATAFILE 'datafile02.dat'
|
||||
INITIAL_SIZE 4M
|
||||
ENGINE=NDB;
|
||||
|
||||
CREATE TABLE t1
|
||||
(c1 INT NOT NULL PRIMARY KEY,
|
||||
c2 INT NOT NULL,
|
||||
c3 INT NOT NULL)
|
||||
TABLESPACE ts1 STORAGE DISK
|
||||
ENGINE=NDB;
|
||||
|
||||
--echo ***** insert some data *****
|
||||
|
||||
let $j= 900;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
eval INSERT INTO t1 VALUES($j,$j*2,$j+3);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
--echo ***** Select from Master *****
|
||||
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
|
||||
--echo ***** Select from Slave *****
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
|
||||
###################################
|
||||
# Just to some File Schema check #
|
||||
###################################
|
||||
|
||||
--disable_query_log
|
||||
SELECT DISTINCT FILE_NAME, FILE_TYPE, TABLESPACE_NAME, LOGFILE_GROUP_NAME
|
||||
FROM INFORMATION_SCHEMA.FILES
|
||||
WHERE ENGINE="ndbcluster" ORDER BY FILE_NAME;
|
||||
--enable_query_log
|
||||
|
||||
--echo **** Do First Set of ALTERs in the master table ****
|
||||
###################################################
|
||||
# On this first set of alters I expect:
|
||||
# 1. To be able to create and index on 2 columns
|
||||
# 2. To be able to create a unique index
|
||||
# 3. To be able to add two columns and have
|
||||
# it all replicated correctly to the slave cluster.
|
||||
###################################################
|
||||
connection master;
|
||||
CREATE INDEX t1_i ON t1(c2, c3);
|
||||
#Bug 18039
|
||||
CREATE UNIQUE INDEX t1_i2 ON t1(c2);
|
||||
ALTER TABLE t1 ADD c4 TIMESTAMP;
|
||||
ALTER TABLE t1 ADD c5 DOUBLE;
|
||||
ALTER TABLE t1 ADD INDEX (c5);
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo **** Show first set of ALTERs on SLAVE ****
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo **** Second set of alters test 1 ****
|
||||
############################################
|
||||
# With this next set of alters we have had
|
||||
# Some issues with renames of tables. So this
|
||||
# test renames our main table, drop and index off
|
||||
# of it, creates another table with then name
|
||||
# of the orginal table, inserts a row, drops
|
||||
# the table and renames the orginal table back.
|
||||
# I want to make sure that 1) the cluster does
|
||||
# okay with this and 2) that it is replicated
|
||||
# correctly.
|
||||
#############################################
|
||||
connection master;
|
||||
ALTER TABLE t1 RENAME t2;
|
||||
ALTER TABLE t2 DROP INDEX c5;
|
||||
CREATE TABLE t1(c1 INT)ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
DROP TABLE t1;
|
||||
ALTER TABLE t2 RENAME t1;
|
||||
|
||||
--echo **** Show second set of ALTERs on MASTER ****
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo **** Show second set of ALTERs on SLAVE ****
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
--echo **** Third and last set of alters for test1 ****
|
||||
#########################################################
|
||||
# In this last set of alters, we are messing with the
|
||||
# cluster ability to rebuild indexes, drop a column that make up
|
||||
# an index with another column and change types several times in
|
||||
# a row. I have choosen the BLOB as it seems to have had many
|
||||
# issues in this release. I want to make sure that the cluster
|
||||
# deals with these radical changes and that the replication to
|
||||
# the slave cluster is dones correctly.
|
||||
###########################################################
|
||||
connection master;
|
||||
ALTER TABLE t1 CHANGE c1 c1 DOUBLE;
|
||||
ALTER TABLE t1 CHANGE c2 c2 DECIMAL(10,2);
|
||||
ALTER TABLE t1 DROP COLUMN c3;
|
||||
ALTER TABLE t1 CHANGE c4 c4 TEXT CHARACTER SET utf8;
|
||||
ALTER TABLE t1 CHANGE c4 c4 BLOB;
|
||||
ALTER TABLE t1 CHANGE c4 c3 BLOB;
|
||||
set @b1 = 'b1';
|
||||
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
|
||||
UPDATE t1 SET c3=@b1 where c1 = 1;
|
||||
UPDATE t1 SET c3=@b1 where c1 = 2;
|
||||
|
||||
--echo **** Show last set of ALTERs on MASTER ****
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
|
||||
--echo **** Show last set of ALTERs on SLAVE ****
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
SHOW CREATE TABLE t1;
|
||||
# Bug 18094
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
SELECT * FROM t1 where c1 = 1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
################### TEST 2 TPCB for disk data ###########################
|
||||
# Requirement: To have Stored Procedures and Functions that are used to #
|
||||
# populate and post transactions to the data base using CDD that span #
|
||||
# 2 tables spaces and also use a memory only cluster tables. In addition#
|
||||
# The slave is to be stopped, cleaned and restored and synced with the #
|
||||
# Master cluster #
|
||||
#########################################################################
|
||||
|
||||
--echo ******** Create additional TABLESPACE test 2 **************
|
||||
|
||||
connection master;
|
||||
CREATE TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile03.dat'
|
||||
USE LOGFILE GROUP lg1
|
||||
INITIAL_SIZE 10M
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts2
|
||||
ADD DATAFILE 'datafile04.dat'
|
||||
INITIAL_SIZE 5M
|
||||
ENGINE=NDB;
|
||||
|
||||
let engine_type=NDBCLUSTER;
|
||||
let table_space=ts2;
|
||||
let format='RBR';
|
||||
|
||||
--source include/tpcb_disk_data.inc
|
||||
|
||||
--echo ****** TEST 2 test time *********************************
|
||||
USE tpcb;
|
||||
|
||||
--echo *********** Load up the database ******************
|
||||
CALL tpcb.load();
|
||||
|
||||
--echo ********** Check load master and slave **************
|
||||
SELECT COUNT(*) FROM account;
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM account;
|
||||
|
||||
--echo ******** Run in some transactions ***************
|
||||
|
||||
connection master;
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
|
||||
--echo ***** Time to try slave sync ***********
|
||||
--echo **** Must make sure slave is clean *****
|
||||
--connection slave
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
DROP PROCEDURE IF EXISTS tpcb.load;
|
||||
DROP PROCEDURE IF EXISTS tpcb.trans;
|
||||
DROP TABLE IF EXISTS tpcb.account;
|
||||
DROP TABLE IF EXISTS tpcb.teller;
|
||||
DROP TABLE IF EXISTS tpcb.branch;
|
||||
DROP TABLE IF EXISTS tpcb.history;
|
||||
DROP DATABASE tpcb;
|
||||
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
DROP TABLESPACE ts1 ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile03.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile04.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
DROP TABLESPACE ts2 ENGINE=NDB;
|
||||
|
||||
DROP LOGFILE GROUP lg1 ENGINE=NDB;
|
||||
|
||||
--echo ********** Take a backup of the Master *************
|
||||
connection master;
|
||||
|
||||
SELECT COUNT(*) FROM history;
|
||||
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
SELECT COUNT(*) FROM history;
|
||||
|
||||
--source include/ndb_backup.inc
|
||||
|
||||
--echo ************ Restore the slave ************************
|
||||
connection slave;
|
||||
CREATE DATABASE tpcb;
|
||||
--source include/ndb_restore_slave_eoption.inc
|
||||
|
||||
--echo ***** Check a few slave restore values ***************
|
||||
connection slave;
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM account;
|
||||
|
||||
--echo ***** Add some more records to master *********
|
||||
connection master;
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
#
|
||||
# now setup replication to continue from last epoch
|
||||
# 1. get apply_status epoch from slave
|
||||
# 2. get corresponding _next_ binlog postition from master
|
||||
# 3. change master on slave
|
||||
# 4. add some transaction for slave to process
|
||||
# 5. start the replication
|
||||
|
||||
--echo ***** Finsh the slave sync process *******
|
||||
--disable_query_log
|
||||
# 1. 2. 3.
|
||||
--sync_slave_with_master
|
||||
--source include/ndb_setup_slave.inc
|
||||
--enable_query_log
|
||||
|
||||
# 4.
|
||||
--echo * 4. *
|
||||
connection master;
|
||||
let $j= 100;
|
||||
--disable_query_log
|
||||
while ($j)
|
||||
{
|
||||
eval CALL tpcb.trans($format);
|
||||
dec $j;
|
||||
}
|
||||
--enable_query_log
|
||||
|
||||
# 5.
|
||||
--echo * 5. *
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
--echo **** We should be ready to continue on *************
|
||||
|
||||
connection master;
|
||||
--echo ****** Let's make sure we match *******
|
||||
--echo ***** MASTER *******
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM history;
|
||||
|
||||
--echo ****** SLAVE ********
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
USE tpcb;
|
||||
SELECT COUNT(*) FROM history;
|
||||
|
||||
--echo *** DUMP MASTER & SLAVE FOR COMPARE ********
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql
|
||||
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql
|
||||
|
||||
--echo *************** TEST 2 CLEANUP SECTION ********************
|
||||
connection master;
|
||||
DROP PROCEDURE IF EXISTS tpcb.load;
|
||||
DROP PROCEDURE IF EXISTS tpcb.trans;
|
||||
DROP TABLE tpcb.account;
|
||||
DROP TABLE tpcb.teller;
|
||||
DROP TABLE tpcb.branch;
|
||||
DROP TABLE tpcb.history;
|
||||
DROP DATABASE tpcb;
|
||||
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts1
|
||||
DROP DATAFILE 'datafile02.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
DROP TABLESPACE ts1 ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile03.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
ALTER TABLESPACE ts2
|
||||
DROP DATAFILE 'datafile04.dat'
|
||||
ENGINE=NDB;
|
||||
|
||||
DROP TABLESPACE ts2 ENGINE=NDB;
|
||||
|
||||
DROP LOGFILE GROUP lg1 ENGINE=NDB;
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
connection master;
|
||||
|
||||
--echo ****** Do dumps compare ************
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql;
|
||||
|
||||
## Note: Ths files should only get removed, if the above diff succeeds.
|
||||
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql;
|
||||
|
||||
# End 5.1 test case
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,16 @@
|
||||
#############################################################
|
||||
# Purpose: To test having extra columns on the master WL#3915
|
||||
#############################################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
|
||||
let $engine_type = 'NDB';
|
||||
|
||||
set binlog_format=row;
|
||||
-- source extra/rpl_tests/rpl_extraMaster_Col.test
|
||||
|
||||
set binlog_format=mixed;
|
||||
-- source extra/rpl_tests/rpl_extraMaster_Col.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,35 @@
|
||||
#############################################
|
||||
#Purpose: Generic replication to cluster
|
||||
# and ensuring that the ndb_apply_status
|
||||
# table is updated.
|
||||
#############################################
|
||||
# Notes:
|
||||
# include/select_ndb_apply_status.inc
|
||||
# Selects out the log name, start & end pos
|
||||
# from the ndb_apply_status table
|
||||
#
|
||||
# include/show_binlog_using_logname.inc
|
||||
# To select out 1 row from offset 1
|
||||
# from the start position in the binlog whose
|
||||
# name is = log_name
|
||||
#
|
||||
# include/tpcb.inc
|
||||
# Creates DATABASE tpcb, the tables and
|
||||
# stored procedures for loading the DB
|
||||
# and for running transactions against DB.
|
||||
##############################################
|
||||
|
||||
|
||||
## Includes ##
|
||||
|
||||
--disable_query_log
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
--enable_query_log
|
||||
let $off_set = 9;
|
||||
let $rpl_format = 'MIX';
|
||||
--source extra/rpl_tests/rpl_ndb_apply_status.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
Reference in New Issue
Block a user