| 1 |
--source include/have_ndb.inc |
| 2 |
|
| 3 |
|
| 4 |
# No need to include the setup commands in .result file |
| 5 |
--disable_query_log |
| 6 |
|
| 7 |
# Create one connection to each mysqld |
| 8 |
let $i = $NUM_MYSQLDS; |
| 9 |
while($i) |
| 10 |
{ |
| 11 |
let $_port= \$MYSQLD_PORT_$i; |
| 12 |
if (!$_port) |
| 13 |
{ |
| 14 |
die Not all $MYSQLD_PORT_* env. variables are configured; |
| 15 |
} |
| 16 |
--connect(mysqld$i,127.0.0.1,root,,test,$_port) |
| 17 |
|
| 18 |
dec $i; |
| 19 |
} |
| 20 |
|
| 21 |
# Create special ndb_ddl_test databases |
| 22 |
CREATE DATABASE ndb_ddl_test; |
| 23 |
CREATE DATABASE ndb_ddl_test2; |
| 24 |
|
| 25 |
# Always use the ndb_ddl_test database |
| 26 |
USE ndb_ddl_test; |
| 27 |
|
| 28 |
eval |
| 29 |
CREATE TABLE t1( |
| 30 |
a INT, |
| 31 |
b INT, |
| 32 |
PRIMARY KEY(a,b), |
| 33 |
KEY(b) |
| 34 |
) |
| 35 |
$t1_table_options |
| 36 |
ENGINE=ndb; |
| 37 |
|
| 38 |
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5); |
| 39 |
|
| 40 |
eval |
| 41 |
CREATE TABLE t2( |
| 42 |
a INT PRIMARY KEY, |
| 43 |
b VARCHAR(255), |
| 44 |
c DATETIME, |
| 45 |
KEY(b), |
| 46 |
KEY(b,c) |
| 47 |
) |
| 48 |
$t2_table_options |
| 49 |
ENGINE=ndb; |
| 50 |
|
| 51 |
INSERT INTO t2 VALUES |
| 52 |
(1,'1','2015-03-01 00:00:01'), |
| 53 |
(2,'1','2015-03-02 00:00:02'), |
| 54 |
(3,'1','2015-03-03 00:00:03'), |
| 55 |
(4,'1','2015-03-04 00:00:04'), |
| 56 |
(5,'1','2015-03-05 00:00:05'); |
| 57 |
|
| 58 |
eval |
| 59 |
CREATE TABLE t3( |
| 60 |
a INT PRIMARY KEY, |
| 61 |
b VARCHAR(255), |
| 62 |
c DATETIME, |
| 63 |
KEY(b), |
| 64 |
INDEX(a,b,c) |
| 65 |
) |
| 66 |
$t3_table_options |
| 67 |
ENGINE=ndb; |
| 68 |
|
| 69 |
INSERT INTO t3 VALUES |
| 70 |
(1,'1','2015-03-01 00:00:01'), |
| 71 |
(2,'1','2015-03-02 00:00:02'), |
| 72 |
(3,'1','2015-03-03 00:00:03'), |
| 73 |
(4,'1','2015-03-04 00:00:04'), |
| 74 |
(5,'1','2015-03-05 00:00:05'); |
| 75 |
|
| 76 |
eval |
| 77 |
CREATE TABLE t4 ( |
| 78 |
a INT UNSIGNED NOT NULL PRIMARY KEY, |
| 79 |
b INT UNSIGNED, |
| 80 |
c INT UNSIGNED, |
| 81 |
UNIQUE bc_unieuq_index(b,c), |
| 82 |
UNIQUE b_unique(c) |
| 83 |
) |
| 84 |
$t4_table_options |
| 85 |
ENGINE=ndb; |
| 86 |
|
| 87 |
INSERT INTO t4 VALUES (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5); |
| 88 |
|
| 89 |
eval |
| 90 |
CREATE TABLE t5 ( |
| 91 |
a int NOT NULL, |
| 92 |
b int NOT NULL, |
| 93 |
c int NOT NULL, |
| 94 |
d int NOT NULL, |
| 95 |
e int, |
| 96 |
PRIMARY KEY (c, b, a, d), |
| 97 |
INDEX(d), |
| 98 |
INDEX(c) |
| 99 |
) |
| 100 |
$t5_table_options |
| 101 |
ENGINE=ndb; |
| 102 |
|
| 103 |
INSERT INTO t5 VALUES |
| 104 |
(1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4), (5,5,5,5,5); |
| 105 |
|
| 106 |
eval |
| 107 |
CREATE TABLE t6 ( |
| 108 |
a varchar(37) |
| 109 |
) |
| 110 |
$t6_table_options |
| 111 |
ENGINE=ndb; |
| 112 |
|
| 113 |
INSERT INTO t6 VALUES |
| 114 |
('value1'), |
| 115 |
('value2'), |
| 116 |
('value3'), |
| 117 |
('value4'), |
| 118 |
('value5'); |
| 119 |
|
| 120 |
# blob table |
| 121 |
eval |
| 122 |
CREATE TABLE t7 ( |
| 123 |
a INT NOT NULL PRIMARY KEY, |
| 124 |
b TEXT NOT NULL, |
| 125 |
c INT NOT NULL, |
| 126 |
d LONGBLOB, |
| 127 |
KEY index_c(c) |
| 128 |
) |
| 129 |
$t7_table_options |
| 130 |
engine=ndbcluster; |
| 131 |
|
| 132 |
INSERT INTO t7 VALUES |
| 133 |
(1,REPEAT('1b', 371),1,REPEAT('1d', 65531)), |
| 134 |
(2,REPEAT('2b', 372),2,REPEAT('2d', 65532)), |
| 135 |
(3,REPEAT('3b', 373),3,REPEAT('3d', 65533)), |
| 136 |
(4,REPEAT('4b', 374),4,REPEAT('4d', 65534)), |
| 137 |
(5,REPEAT('5b', 375),5,REPEAT('5d', 65535)); |
| 138 |
|
| 139 |
# hidden pk table |
| 140 |
eval |
| 141 |
CREATE TABLE t8 ( |
| 142 |
a INT, |
| 143 |
b VARCHAR(255), |
| 144 |
c DATETIME NOT NULL, |
| 145 |
d INT UNSIGNED, |
| 146 |
e INT NOT NULL |
| 147 |
) |
| 148 |
$t8_table_options |
| 149 |
engine=ndbcluster; |
| 150 |
|
| 151 |
INSERT INTO t8 VALUES |
| 152 |
(1, "1-t8", '2017-10-20 09:13:01', NULL, 1), |
| 153 |
(2, "2-t8", '2017-10-20 09:13:02', NULL, 2), |
| 154 |
(3, "3-t8", '2017-10-20 09:13:03', NULL, 3), |
| 155 |
(4, "4-t8", '2017-10-20 09:13:04', NULL, 4), |
| 156 |
(5, "5-t8", '2017-10-20 09:13:05', NULL, 5); |
| 157 |
|
| 158 |
# hidden pk and blobs |
| 159 |
|
| 160 |
# ignore the warning about binlogging not supported on this table |
| 161 |
--disable_warnings ER_ILLEGAL_HA_CREATE_OPTION ONCE |
| 162 |
eval |
| 163 |
CREATE TABLE t9 ( |
| 164 |
a INT, |
| 165 |
b VARCHAR(255), |
| 166 |
c TEXT, |
| 167 |
d MEDIUMBLOB, |
| 168 |
e INT NOT NULL |
| 169 |
) |
| 170 |
$t9_table_options |
| 171 |
engine=ndbcluster; |
| 172 |
|
| 173 |
INSERT INTO t9 VALUES |
| 174 |
(1, "1-t9", REPEAT('1f', 41), REPEAT('1g', 31), 1), |
| 175 |
(2, "2-t9", REPEAT('1f', 42), REPEAT('1g', 32), 2), |
| 176 |
(3, "3-t9", REPEAT('1f', 43), REPEAT('1g', 33), 3), |
| 177 |
(4, "4-t9", REPEAT('1f', 44), REPEAT('1g', 34), 4), |
| 178 |
(5, "5-t9", REPEAT('1f', 45), REPEAT('1g', 35), 5); |
| 179 |
|
| 180 |
# Create a view on top of ndbinfo.ndb$dict_obj_info (as otherwise |
| 181 |
# the dollar sign is evaluated as a dollar-variable and there seem |
| 182 |
# to be no way to escape it) |
| 183 |
CREATE VIEW test.ndbinfo_dict_obj_info as |
| 184 |
SELECT id, type, version, state, parent_obj_type, parent_obj_id, fq_name |
| 185 |
FROM ndbinfo.ndb$dict_obj_info; |
| 186 |
|
| 187 |
--enable_query_log |
| 188 |
|
| 189 |
# |
| 190 |
# List all objects for the created tables and store them |
| 191 |
# in temporary tables in the test database |
| 192 |
let $num_tables = `select count(*) from information_schema.tables |
| 193 |
where TABLE_SCHEMA = 'ndb_ddl_test'`; |
| 194 |
if (!$num_tables) |
| 195 |
{ |
| 196 |
die Could not figure out number of tables in ndb_ddl_test database; |
| 197 |
} |
| 198 |
|
| 199 |
let $counter = 1; |
| 200 |
while ($counter <= $num_tables) |
| 201 |
{ |
| 202 |
|
| 203 |
let $create_table_name = test.pre_t$counter; |
| 204 |
let $list_table_name = ndb_ddl_test.t$counter; |
| 205 |
--source list_objects.inc |
| 206 |
|
| 207 |
inc $counter; |
| 208 |
} |