polardbxengine/mysql-test/suite/ndb/t/ndb_fully_replicated_restar...

253 lines
7.2 KiB
Plaintext

--source include/have_ndb.inc
--source include/not_windows.inc
# Ignore the warning generated by ndbcluster's binlog thread
# when cluster is restarted
--disable_query_log ONCE
call mtr.add_suppression("cluster disconnect An incident event has been written");
# Ignore the warning generated by ndbcluster's binlog thread
# when cluster is restarted - also on the second mysqld
connect(mysqld2,127.0.0.1,root,,test,$MASTER_MYPORT1);
connection mysqld2;
--disable_query_log ONCE
call mtr.add_suppression("cluster disconnect An incident event has been written");
connection default;
CREATE TABLE t1 (
a int,
b varchar(255),
c int,
d blob,
primary key(a,b),
key(b),
unique (c)) engine=ndb character set latin1 comment='NDB_TABLE=FULLY_REPLICATED=1,PARTITION_BALANCE=FOR_RA_BY_NODE' partition by key(a) ;
show warnings;
# Test that invalid table comment creates a warning
# Todo put in a different 'syntax check' testcase?
--error 1478
CREATE TABLE t2 (
a int,
b varchar(255),
c int,
d blob,
primary key(a,b),
key(b),
unique (c)) engine=ndb comment='NDB_TABLE=JUNK' partition by key(a) ;
CREATE TABLE t2 (
a int,
b varchar(255),
c int,
primary key(a,b),
key(b),
unique (c)) engine=ndb comment='NDB_TABLE=FULLY_REPLICATED=1,PARTITION_BALANCE=FOR_RA_BY_LDM' partition by key(a) ;
DROP TABLE t2;
# bug#23330359 - a DICT bug on alter table
# done in same restart test to save runtime
CREATE TABLE t2 (
a int,
b varchar(255),
c int not null,
primary key (a,b),
unique key (b,a)
) engine=ndb
comment='NDB_TABLE=FULLY_REPLICATED=1'
partition by key(a);
alter table t2 algorithm=inplace, add unique index (c);
let $ndb_desc_opts= -b -i -d test t1;
source suite/ndb/include/ndb_desc_print.inc;
insert into t1 values
(0, "row 0", 0, REPEAT("qubit#0",500)),
(1, "row 1", 1, REPEAT("qubit#1",500)),
(2, "row 2", 2, REPEAT("qubit#2",500)),
(3, "row 3", 3, REPEAT("qubit#3",500)),
(4, "row 4", 4, REPEAT("qubit#4",500)),
(5, "row 5", 5, REPEAT("qubit#5",500)),
(6, "row 6", 6, REPEAT("qubit#6",500)),
(7, "row 7", 7, REPEAT("qubit#7",500)),
(8, "row 8", 8, REPEAT("qubit#8",500)),
(9, "row 9", 9, REPEAT("qubit#9",500));
select a,b,c,LENGTH(d) from t1 order by 1;
begin;
# pk lookup
select a,b,c,LENGTH(d) from t1 where a = 7;
# uk lookup
select a,b,c,LENGTH(d) from t1 where c = 9;
# table scan
select a,b,c,LENGTH(d) from t1 order by 1;
# index scan
select a,b,c,LENGTH(d) from t1 where a < 5 order by a;
# pk update
update t1 set b = 'pk update' where a = 3;
# scan update
update t1 set c = c + 10;
# uk update
update t1 set b = 'uk update' where c = 16;
# pk delete
delete from t1 where a = 7;
# uk delete
delete from t1 where c = 17;
# index scan delete
delete from t1 where a < 5;
select a,b,c,LENGTH(d) from t1 order by 1;
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500));
select a,b,c,LENGTH(d) from t1 order by 1;
rollback;
--echo "Stop node 1"
# Restart 1 node "nostart"
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "1 restart -n" >> $NDB_TOOLS_OUTPUT
# Wait for node to enter "nostart"
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --not-started --wait-nodes=1 >> $NDB_TOOLS_OUTPUT
begin;
# pk lookup
select a,b,c,LENGTH(d) from t1 where a = 7;
# uk lookup
select a,b,c,LENGTH(d) from t1 where c = 9;
# table scan
select a,b,c,LENGTH(d) from t1 order by 1;
# index scan
select a,b,c,LENGTH(d) from t1 where a < 5 order by a;
# pk update
update t1 set b = 'pk update' where a = 3;
# scan update
update t1 set c = c + 10;
# uk update
update t1 set b = 'uk update' where c = 16;
# pk delete
delete from t1 where a = 7;
# uk delete
delete from t1 where c = 17;
# index scan delete
delete from t1 where a < 5;
select a,b,c,LENGTH(d) from t1 order by 1;
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500));
select a,b,c,LENGTH(d) from t1 order by 1;
rollback;
--echo "Start node 1"
# Start node again
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "1 start" >> $NDB_TOOLS_OUTPUT
# Wait for all nodes to enter "started"
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" >> $NDB_TOOLS_OUTPUT
begin;
# pk lookup
select a,b,c,LENGTH(d) from t1 where a = 7;
# uk lookup
select a,b,c,LENGTH(d) from t1 where c = 9;
# table scan
select a,b,c,LENGTH(d) from t1 order by 1;
# index scan
select a,b,c,LENGTH(d) from t1 where a < 5 order by a;
# pk update
update t1 set b = 'pk update' where a = 3;
# scan update
update t1 set c = c + 10;
# uk update
update t1 set b = 'uk update' where c = 16;
# pk delete
delete from t1 where a = 7;
# uk delete
delete from t1 where c = 17;
# index scan delete
delete from t1 where a < 5;
select a,b,c,LENGTH(d) from t1 order by 1;
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500));
select a,b,c,LENGTH(d) from t1 order by 1;
rollback;
drop table t1,t2;
CREATE TABLE t1 (
a int,
b varchar(255),
c int,
d blob,
primary key(a,b),
key(b),
unique (c)) engine=ndb comment='NDB_TABLE=FULLY_REPLICATED=1' partition by key(a) ;
CREATE TABLE t2 (
a int,
b varchar(255),
c int not null,
primary key (a,b),
unique key (b,a)
) engine=ndb
comment='NDB_TABLE=FULLY_REPLICATED=1'
partition by key(a);
alter table t2 algorithm=inplace, add unique index (c);
insert into t1 values
(0, "row 0", 0, REPEAT("qubit#0",500)),
(1, "row 1", 1, REPEAT("qubit#1",500)),
(2, "row 2", 2, REPEAT("qubit#2",500)),
(3, "row 3", 3, REPEAT("qubit#3",500)),
(4, "row 4", 4, REPEAT("qubit#4",500)),
(5, "row 5", 5, REPEAT("qubit#5",500)),
(6, "row 6", 6, REPEAT("qubit#6",500)),
(7, "row 7", 7, REPEAT("qubit#7",500)),
(8, "row 8", 8, REPEAT("qubit#8",500)),
(9, "row 9", 9, REPEAT("qubit#9",500));
--echo "Restart cluster"
# Restart cluster nodes "nostart"
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all restart -n" >> $NDB_TOOLS_OUTPUT
# Wait for all nodes to enter "nostart"
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --not-started >> $NDB_TOOLS_OUTPUT
# Start cluster nodes again
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all start" >> $NDB_TOOLS_OUTPUT
# Wait for all nodes to enter "started"
--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" >> $NDB_TOOLS_OUTPUT
#
# Wait until the connection to the
# cluster has been restored or timeout occurs
#
--echo "Wait reconnect"
--source include/ndb_not_readonly.inc
begin;
# pk lookup
select a,b,c,LENGTH(d) from t1 where a = 7;
# uk lookup
select a,b,c,LENGTH(d) from t1 where c = 9;
# table scan
select a,b,c,LENGTH(d) from t1 order by 1;
# index scan
select a,b,c,LENGTH(d) from t1 where a < 5 order by a;
# pk update
update t1 set b = 'pk update' where a = 3;
# scan update
update t1 set c = c + 10;
# uk update
update t1 set b = 'uk update' where c = 16;
# pk delete
delete from t1 where a = 7;
# uk delete
delete from t1 where c = 17;
# index scan delete
delete from t1 where a < 5;
select a,b,c,LENGTH(d) from t1 order by 1;
insert into t1 values (0, "row 0", 0, REPEAT("qubit#0",500)),(1, "row 1", 1, REPEAT("qubit#1",500));
select a,b,c,LENGTH(d) from t1 order by 1;
rollback;
# cleanup
drop table t1,t2;
--remove_file $NDB_TOOLS_OUTPUT