| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/not_windows.inc |
| 3 |
|
| 4 |
--echo ### create tables and insert/load data |
| 5 |
create table t1(id int NOT NULL PRIMARY KEY, data char(8), other int, |
| 6 |
unique(other)) engine=ndb; |
| 7 |
create table t2(id int, data char(8), id2 binary(80), primary key (id, id2)) |
| 8 |
engine=ndb; |
| 9 |
create table t3(id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb; |
| 10 |
create table t4(id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb; |
| 11 |
create table t5(id int primary key, data int, other int, unique(other)) |
| 12 |
engine=ndb; |
| 13 |
create table t6(id int primary key, data int, other int, unique(other)) |
| 14 |
engine=ndb; |
| 15 |
|
| 16 |
|
| 17 |
insert into t1 values (1,"data",1), (2,"data",2), (3,"data",3), (4,"data",4), |
| 18 |
(5,"data",5), (6,"data",6),(7,"data",7), (8,"data",8); |
| 19 |
|
| 20 |
load data local infile 'suite/ndb/data/table_data10000.dat' into table t2 |
| 21 |
fields terminated by ' ' lines terminated by '\n' (id, @data) set data = @data, |
| 22 |
id2 = repeat(@data,10); |
| 23 |
load data local infile 'suite/ndb/data/table_data10000.dat' into table t3 |
| 24 |
fields terminated by ' ' lines terminated by '\n'; |
| 25 |
load data local infile 'suite/ndb/data/table_data10000.dat' into table t4 |
| 26 |
fields terminated by ' ' lines terminated by '\n'; |
| 27 |
|
| 28 |
insert into t5 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5), |
| 29 |
(6,6,6),(7,7,7), (8,8,8); |
| 30 |
insert into t6 values (1,1,1), (2,2,2), (3,3,3), |
| 31 |
(4,4,4), (5,5,5), (6,6,6),(7,7,7), (8,8,8); |
| 32 |
|
| 33 |
|
| 34 |
echo ### verify that the number of preferred primary is equal on each |
| 35 |
node (2 nodes); |
| 36 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 37 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 38 |
and root_name like '%t1' and type = 2 group by preferred_primary; |
| 39 |
|
| 40 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 41 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 42 |
and root_name like '%t2' and type = 2 group by preferred_primary; |
| 43 |
|
| 44 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 45 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 46 |
and root_name like '%t3' and type = 2 group by preferred_primary; |
| 47 |
|
| 48 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 49 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 50 |
and root_name like '%t4' and type = 2 group by preferred_primary; |
| 51 |
|
| 52 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 53 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 54 |
and root_name like '%t5' and type = 2 group by preferred_primary; |
| 55 |
|
| 56 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 57 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 58 |
and root_name like '%t6' and type = 2 group by preferred_primary; |
| 59 |
|
| 60 |
echo ### verify that the Unique hash index fragments are balanced across all |
| 61 |
data nodes (2 nodes); |
| 62 |
select fragment_num,parent_fq_name,type,node_id from ndbinfo.memory_per_fragment |
| 63 |
where type like 'Unique hash index' and parent_fq_name like '%t1%' |
| 64 |
order by fragment_num; |
| 65 |
|
| 66 |
--echo ### Create nodegroup for nodes 3 and 4 |
| 67 |
--exec $NDB_MGM -e "create nodegroup 3,4" |
| 68 |
--sleep 5 |
| 69 |
|
| 70 |
--echo ### Create one more table and insert data |
| 71 |
create table t7(id int primary key, data int, other int, unique(other)) |
| 72 |
engine=ndb; |
| 73 |
insert into t7 values (1,1,1), (2,2,2), (3,3,3), |
| 74 |
(4,4,4), (5,5,5), (6,6,6),(7,7,7), (8,8,8); |
| 75 |
|
| 76 |
--echo ### Cluster running after adding two data nodes |
| 77 |
--source ndb_mgm_show_table.inc |
| 78 |
|
| 79 |
--echo ### Reorganize partitions |
| 80 |
ALTER TABLE t1 ALGORITHM=INPLACE, REORGANIZE PARTITION; |
| 81 |
ALTER TABLE t2 ALGORITHM=INPLACE, REORGANIZE PARTITION; |
| 82 |
ALTER TABLE t3 ALGORITHM=INPLACE, REORGANIZE PARTITION; |
| 83 |
ALTER TABLE t4 ALGORITHM=COPY, REORGANIZE PARTITION; |
| 84 |
ALTER TABLE t5 ALGORITHM=COPY, REORGANIZE PARTITION; |
| 85 |
ALTER TABLE t6 ALGORITHM=COPY, REORGANIZE PARTITION; |
| 86 |
|
| 87 |
echo ### verify that the number of preferred primary is equal on each node |
| 88 |
(2 nodes +2 nodes online); |
| 89 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 90 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 91 |
and root_name like '%t1' and type = 2 group by preferred_primary; |
| 92 |
|
| 93 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 94 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 95 |
and root_name like '%t2' and type = 2 group by preferred_primary; |
| 96 |
|
| 97 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 98 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 99 |
and root_name like '%t3' and type = 2 group by preferred_primary; |
| 100 |
|
| 101 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 102 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 103 |
and root_name like '%t4' and type = 2 group by preferred_primary; |
| 104 |
|
| 105 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 106 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 107 |
and root_name like '%t5' and type = 2 group by preferred_primary; |
| 108 |
|
| 109 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 110 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 111 |
and root_name like '%t6' and type = 2 group by preferred_primary; |
| 112 |
|
| 113 |
select preferred_primary, count(*) from ndbinfo.table_fragments as tf join |
| 114 |
ndbinfo.dict_obj_tree as dot where tf.table_id = dot.id |
| 115 |
and root_name like '%t7' and type = 2 group by preferred_primary; |
| 116 |
|
| 117 |
echo ### verify that the Unique hash index fragments are balanced across all |
| 118 |
data nodes (2 nodes +2 nodes online); |
| 119 |
select fragment_num,parent_fq_name,type,node_id from ndbinfo.memory_per_fragment |
| 120 |
where type like 'Unique hash index' and parent_fq_name like '%t1%' |
| 121 |
order by fragment_num, node_id; |
| 122 |
|
| 123 |
drop table t1,t2,t3,t4,t5,t6,t7; |
| 124 |
|
| 125 |
--echo ### Drop nodegroup with "new" nodes |
| 126 |
--exec $NDB_MGM -e "drop nodegroup 1" |