| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/not_windows.inc |
| 3 |
|
| 4 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 5 |
# when cluster is restarted |
| 6 |
--disable_query_log ONCE |
| 7 |
call mtr.add_suppression("cluster disconnect An incident event has been written"); |
| 8 |
|
| 9 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 10 |
# when cluster is restarted - also on the second mysqld |
| 11 |
connect(mysqld2,127.0.0.1,root,,test,$MASTER_MYPORT1); |
| 12 |
connection mysqld2; |
| 13 |
--disable_query_log ONCE |
| 14 |
call mtr.add_suppression("cluster disconnect An incident event has been written"); |
| 15 |
connection default; |
| 16 |
|
| 17 |
CREATE TABLE t1 ( |
| 18 |
a int, |
| 19 |
b varchar(255), |
| 20 |
c int, |
| 21 |
d blob, |
| 22 |
primary key(a,b), |
| 23 |
key(b), |
| 24 |
unique (c)) engine=ndb character set latin1 comment='NDB_TABLE=FULLY_REPLICATED=1,PARTITION_BALANCE=FOR_RA_BY_NODE' partition by key(a) ; |
| 25 |
show warnings; |
| 26 |
|
| 27 |
# Test that invalid table comment creates a warning |
| 28 |
# Todo put in a different 'syntax check' testcase? |
| 29 |
--error 1478 |
| 30 |
CREATE TABLE t2 ( |
| 31 |
a int, |
| 32 |
b varchar(255), |
| 33 |
c int, |
| 34 |
d blob, |
| 35 |
primary key(a,b), |
| 36 |
key(b), |
| 37 |
unique (c)) engine=ndb comment='NDB_TABLE=JUNK' partition by key(a) ; |
| 38 |
|
| 39 |
CREATE TABLE t2 ( |
| 40 |
a int, |
| 41 |
b varchar(255), |
| 42 |
c int, |
| 43 |
primary key(a,b), |
| 44 |
key(b), |
| 45 |
unique (c)) engine=ndb comment='NDB_TABLE=FULLY_REPLICATED=1,PARTITION_BALANCE=FOR_RA_BY_LDM' partition by key(a) ; |
| 46 |
DROP TABLE t2; |
| 47 |
|
| 48 |
# bug#23330359 - a DICT bug on alter table |
| 49 |
# done in same restart test to save runtime |
| 50 |
CREATE TABLE t2 ( |
| 51 |
a int, |
| 52 |
b varchar(255), |
| 53 |
c int not null, |
| 54 |
primary key (a,b), |
| 55 |
unique key (b,a) |
| 56 |
) engine=ndb |
| 57 |
comment='NDB_TABLE=FULLY_REPLICATED=1' |
| 58 |
partition by key(a); |
| 59 |
|
| 60 |
alter table t2 algorithm=inplace, add unique index (c); |
| 61 |
|
| 62 |
let $ndb_describe_table= t1; |
| 63 |
let $ndb_describe_blobs= 1; |
| 64 |
let $ndb_describe_indexes= 1; |
| 65 |
source suite/ndb/include/ndb_describe_table.inc; |
| 66 |
|
| 67 |
insert into t1 values |
| 68 |
(0, "row 0", 0, REPEAT("qubit#0",500)), |
| 69 |
(1, "row 1", 1, REPEAT("qubit#1",500)), |
| 70 |
(2, "row 2", 2, REPEAT("qubit#2",500)), |
| 71 |
(3, "row 3", 3, REPEAT("qubit#3",500)), |
| 72 |
(4, "row 4", 4, REPEAT("qubit#4",500)), |
| 73 |
(5, "row 5", 5, REPEAT("qubit#5",500)), |
| 74 |
(6, "row 6", 6, REPEAT("qubit#6",500)), |
| 75 |
(7, "row 7", 7, REPEAT("qubit#7",500)), |
| 76 |
(8, "row 8", 8, REPEAT("qubit#8",500)), |
| 77 |
(9, "row 9", 9, REPEAT("qubit#9",500)); |
| 78 |
|
| 79 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 80 |
|
| 81 |
begin; |
| 82 |
# pk lookup |
| 83 |
select a,b,c,LENGTH(d) from t1 where a = 7; |
| 84 |
# uk lookup |
| 85 |
select a,b,c,LENGTH(d) from t1 where c = 9; |
| 86 |
# table scan |
| 87 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 88 |
# index scan |
| 89 |
select a,b,c,LENGTH(d) from t1 where a < 5 order by a; |
| 90 |
# pk update |
| 91 |
update t1 set b = 'pk update' where a = 3; |
| 92 |
# scan update |
| 93 |
update t1 set c = c + 10; |
| 94 |
# uk update |
| 95 |
update t1 set b = 'uk update' where c = 16; |
| 96 |
# pk delete |
| 97 |
delete from t1 where a = 7; |
| 98 |
# uk delete |
| 99 |
delete from t1 where c = 17; |
| 100 |
# index scan delete |
| 101 |
delete from t1 where a < 5; |
| 102 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 103 |
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500)); |
| 104 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 105 |
rollback; |
| 106 |
|
| 107 |
--echo "Stop node 1" |
| 108 |
|
| 109 |
# Restart 1 node "nostart" |
| 110 |
--exec $NDB_MGM -e "1 restart -n" >> $NDB_TOOLS_OUTPUT |
| 111 |
# Wait for node to enter "nostart" |
| 112 |
--exec $NDB_WAITER --not-started --wait-nodes=1 |
| 113 |
|
| 114 |
begin; |
| 115 |
# pk lookup |
| 116 |
select a,b,c,LENGTH(d) from t1 where a = 7; |
| 117 |
# uk lookup |
| 118 |
select a,b,c,LENGTH(d) from t1 where c = 9; |
| 119 |
# table scan |
| 120 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 121 |
# index scan |
| 122 |
select a,b,c,LENGTH(d) from t1 where a < 5 order by a; |
| 123 |
# pk update |
| 124 |
update t1 set b = 'pk update' where a = 3; |
| 125 |
# scan update |
| 126 |
update t1 set c = c + 10; |
| 127 |
# uk update |
| 128 |
update t1 set b = 'uk update' where c = 16; |
| 129 |
# pk delete |
| 130 |
delete from t1 where a = 7; |
| 131 |
# uk delete |
| 132 |
delete from t1 where c = 17; |
| 133 |
# index scan delete |
| 134 |
delete from t1 where a < 5; |
| 135 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 136 |
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500)); |
| 137 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 138 |
rollback; |
| 139 |
|
| 140 |
--echo "Start node 1" |
| 141 |
|
| 142 |
# Start node again |
| 143 |
--exec $NDB_MGM -e "1 start" >> $NDB_TOOLS_OUTPUT |
| 144 |
# Wait for all nodes to enter "started" |
| 145 |
--exec $NDB_WAITER |
| 146 |
|
| 147 |
begin; |
| 148 |
# pk lookup |
| 149 |
select a,b,c,LENGTH(d) from t1 where a = 7; |
| 150 |
# uk lookup |
| 151 |
select a,b,c,LENGTH(d) from t1 where c = 9; |
| 152 |
# table scan |
| 153 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 154 |
# index scan |
| 155 |
select a,b,c,LENGTH(d) from t1 where a < 5 order by a; |
| 156 |
# pk update |
| 157 |
update t1 set b = 'pk update' where a = 3; |
| 158 |
# scan update |
| 159 |
update t1 set c = c + 10; |
| 160 |
# uk update |
| 161 |
update t1 set b = 'uk update' where c = 16; |
| 162 |
# pk delete |
| 163 |
delete from t1 where a = 7; |
| 164 |
# uk delete |
| 165 |
delete from t1 where c = 17; |
| 166 |
# index scan delete |
| 167 |
delete from t1 where a < 5; |
| 168 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 169 |
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500)); |
| 170 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 171 |
rollback; |
| 172 |
|
| 173 |
drop table t1,t2; |
| 174 |
|
| 175 |
CREATE TABLE t1 ( |
| 176 |
a int, |
| 177 |
b varchar(255), |
| 178 |
c int, |
| 179 |
d blob, |
| 180 |
primary key(a,b), |
| 181 |
key(b), |
| 182 |
unique (c)) engine=ndb comment='NDB_TABLE=FULLY_REPLICATED=1' partition by key(a) ; |
| 183 |
|
| 184 |
CREATE TABLE t2 ( |
| 185 |
a int, |
| 186 |
b varchar(255), |
| 187 |
c int not null, |
| 188 |
primary key (a,b), |
| 189 |
unique key (b,a) |
| 190 |
) engine=ndb |
| 191 |
comment='NDB_TABLE=FULLY_REPLICATED=1' |
| 192 |
partition by key(a); |
| 193 |
|
| 194 |
alter table t2 algorithm=inplace, add unique index (c); |
| 195 |
|
| 196 |
insert into t1 values |
| 197 |
(0, "row 0", 0, REPEAT("qubit#0",500)), |
| 198 |
(1, "row 1", 1, REPEAT("qubit#1",500)), |
| 199 |
(2, "row 2", 2, REPEAT("qubit#2",500)), |
| 200 |
(3, "row 3", 3, REPEAT("qubit#3",500)), |
| 201 |
(4, "row 4", 4, REPEAT("qubit#4",500)), |
| 202 |
(5, "row 5", 5, REPEAT("qubit#5",500)), |
| 203 |
(6, "row 6", 6, REPEAT("qubit#6",500)), |
| 204 |
(7, "row 7", 7, REPEAT("qubit#7",500)), |
| 205 |
(8, "row 8", 8, REPEAT("qubit#8",500)), |
| 206 |
(9, "row 9", 9, REPEAT("qubit#9",500)); |
| 207 |
|
| 208 |
--echo "Restart cluster" |
| 209 |
|
| 210 |
# Restart cluster nodes "nostart" |
| 211 |
--exec $NDB_MGM -e "all restart -n" >> $NDB_TOOLS_OUTPUT |
| 212 |
# Wait for all nodes to enter "nostart" |
| 213 |
--exec $NDB_WAITER --not-started |
| 214 |
# Start cluster nodes again |
| 215 |
--exec $NDB_MGM -e "all start" >> $NDB_TOOLS_OUTPUT |
| 216 |
# Wait for all nodes to enter "started" |
| 217 |
--exec $NDB_WAITER |
| 218 |
|
| 219 |
# |
| 220 |
# Wait until the connection to the |
| 221 |
# cluster has been restored or timeout occurs |
| 222 |
# |
| 223 |
--echo "Wait reconnect" |
| 224 |
--source include/ndb_not_readonly.inc |
| 225 |
connection mysqld2; |
| 226 |
--source include/ndb_not_readonly.inc |
| 227 |
connection default; |
| 228 |
|
| 229 |
begin; |
| 230 |
# pk lookup |
| 231 |
select a,b,c,LENGTH(d) from t1 where a = 7; |
| 232 |
# uk lookup |
| 233 |
select a,b,c,LENGTH(d) from t1 where c = 9; |
| 234 |
# table scan |
| 235 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 236 |
# index scan |
| 237 |
select a,b,c,LENGTH(d) from t1 where a < 5 order by a; |
| 238 |
# pk update |
| 239 |
update t1 set b = 'pk update' where a = 3; |
| 240 |
# scan update |
| 241 |
update t1 set c = c + 10; |
| 242 |
# uk update |
| 243 |
update t1 set b = 'uk update' where c = 16; |
| 244 |
# pk delete |
| 245 |
delete from t1 where a = 7; |
| 246 |
# uk delete |
| 247 |
delete from t1 where c = 17; |
| 248 |
# index scan delete |
| 249 |
delete from t1 where a < 5; |
| 250 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 251 |
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500)); |
| 252 |
select a,b,c,LENGTH(d) from t1 order by 1; |
| 253 |
rollback; |
| 254 |
|
| 255 |
# cleanup |
| 256 |
drop table t1,t2; |
| 257 |
--remove_file $NDB_TOOLS_OUTPUT |