| 1 |
-- source include/have_ndb.inc |
| 2 |
--source include/not_windows.inc |
| 3 |
|
| 4 |
|
| 5 |
--echo "Create nodegroup with out-of-range node ID" |
| 6 |
--error 255 |
| 7 |
--exec $NDB_MGM -e "create nodegroup 147,148" |
| 8 |
--error 255 |
| 9 |
--exec $NDB_MGM -e "create nodegroup 4,147" |
| 10 |
|
| 11 |
--echo "Create nodegroup with in-range but inactive node ID" |
| 12 |
--error 255 |
| 13 |
--exec $NDB_MGM -e "create nodegroup 48,3" |
| 14 |
--error 255 |
| 15 |
--exec $NDB_MGM -e "create nodegroup 4,48" |
| 16 |
--error 255 |
| 17 |
--exec $NDB_MGM -e "create nodegroup 3,3" |
| 18 |
|
| 19 |
--source ndb_mgm_show_table.inc |
| 20 |
|
| 21 |
CREATE LOGFILE GROUP lg_1 |
| 22 |
ADD UNDOFILE 'undo_1.dat' |
| 23 |
INITIAL_SIZE 4M |
| 24 |
UNDO_BUFFER_SIZE 2M |
| 25 |
ENGINE NDB; |
| 26 |
|
| 27 |
CREATE TABLESPACE ts_1 |
| 28 |
ADD DATAFILE 'data_1.dat' |
| 29 |
USE LOGFILE GROUP lg_1 |
| 30 |
INITIAL_SIZE 16M |
| 31 |
ENGINE NDB; |
| 32 |
|
| 33 |
# Using a pk bigger than 80 bytes, see bug#25152165. |
| 34 |
create table t1(id int, data char(8), id2 binary(80), primary key (id, id2)) engine=ndb; |
| 35 |
create table t2(id int NOT NULL PRIMARY KEY, data char(8)) |
| 36 |
TABLESPACE ts_1 STORAGE DISK engine=ndb; |
| 37 |
# BUG#13714648 |
| 38 |
create table t5(id int NOT NULL PRIMARY KEY, data char(8)) max_rows=50000000 engine=ndb; |
| 39 |
create table t6(id int not null primary key, dat blob, txt text) engine=ndb; |
| 40 |
create table t10 (id int primary key, data int, other int, unique(other)) engine=ndb; |
| 41 |
|
| 42 |
# Get blob tables |
| 43 |
let $bt_test_t6_dat=`SELECT blob_table_name FROM ndbinfo.blobs |
| 44 |
WHERE table_name="t6" AND column_name="dat"`; |
| 45 |
let $bt_test_t6_txt=`SELECT blob_table_name FROM ndbinfo.blobs |
| 46 |
WHERE table_name="t6" AND column_name="txt"`; |
| 47 |
|
| 48 |
load data local infile 'suite/ndb/data/table_data10000.dat' into table t1 fields terminated by ' ' lines terminated by '\n' (id, @data) set data = @data, id2 = repeat(@data,10); |
| 49 |
load data local infile 'suite/ndb/data/table_data10000.dat' into table t2 fields terminated by ' ' lines terminated by '\n'; |
| 50 |
load data local infile 'suite/ndb/data/table_data10000.dat' into table t5 fields terminated by ' ' lines terminated by '\n'; |
| 51 |
load data local infile 'suite/ndb/data/table_data10000.dat' into table t6 fields terminated by ' ' lines terminated by '\n' (id, @data) set dat = repeat(@data, 100), txt = repeat(@data,100); |
| 52 |
|
| 53 |
insert into t10 values (1,1,1), (2,2,2), (3,3,3), (4,4,4), (5,5,5), (6,6,6),(7,7,7), (8,8,8); |
| 54 |
|
| 55 |
## Check details of t1 partitioning |
| 56 |
--echo "Table t1 Partition info" |
| 57 |
let ndb_table= t1; |
| 58 |
--source show_partition_info.inc |
| 59 |
select count(0) as row_count from t1; |
| 60 |
|
| 61 |
## Check details of t2 partitioning |
| 62 |
--echo "Table t2 Partition info" |
| 63 |
let ndb_table= t2; |
| 64 |
--source show_partition_info.inc |
| 65 |
select count(0) as row_count from t2; |
| 66 |
|
| 67 |
## Check details of t5 partitioning |
| 68 |
--echo "Table t5 Partition info" |
| 69 |
let ndb_table= t5; |
| 70 |
--source show_partition_info.inc |
| 71 |
select count(0) as row_count from t5; |
| 72 |
|
| 73 |
## Check details of t6 partitioning |
| 74 |
--echo "Table t6 Partition info" |
| 75 |
let ndb_table= t6; |
| 76 |
--source show_partition_info.inc |
| 77 |
select count(0) as row_count from t6; |
| 78 |
|
| 79 |
## Check details of t6 blob table partitioning |
| 80 |
--echo "Table t6 blob dat Partition info" |
| 81 |
let $ndb_table= $bt_test_t6_dat; |
| 82 |
--source show_partition_info.inc |
| 83 |
|
| 84 |
--echo "Table t6 blob txt Partition info" |
| 85 |
let $ndb_table= $bt_test_t6_txt; |
| 86 |
--source show_partition_info.inc |
| 87 |
|
| 88 |
# Verify that the Unique hash index fragments are balanced across all data nodes |
| 89 |
select parent_fq_name, type, table_id, node_id, block_instance, fragment_num |
| 90 |
from ndbinfo.memory_per_fragment where parent_fq_name like '%t10%'; |
| 91 |
## Create nodegroup for "new" nodes |
| 92 |
--exec $NDB_MGM -e "create nodegroup 3,4" |
| 93 |
--sleep 5 |
| 94 |
# Cluster running after adding two ndbd nodes |
| 95 |
--source ndb_mgm_show_table.inc |
| 96 |
|
| 97 |
## Drop |
| 98 |
--exec $NDB_MGM -e "drop nodegroup 1" |
| 99 |
## and create |
| 100 |
--exec $NDB_MGM -e "create nodegroup 3,4" |
| 101 |
|
| 102 |
set @@new = 1; |
| 103 |
|
| 104 |
#create table t7(id int primary key, uk int, unique key (uk)) engine=ndb |
| 105 |
create table t7(id int primary key, uk int) engine=ndb |
| 106 |
partition by list(id) ( |
| 107 |
partition p0 values in (0), |
| 108 |
partition p1 values in (1), |
| 109 |
partition p2 values in (2), |
| 110 |
partition p3 values in (3), |
| 111 |
partition p4 values in (4) |
| 112 |
); |
| 113 |
drop table t7; |
| 114 |
|
| 115 |
create table t3(id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb; |
| 116 |
create table t4(id int NOT NULL PRIMARY KEY, data char(8)) |
| 117 |
TABLESPACE ts_1 STORAGE DISK engine=ndb; |
| 118 |
|
| 119 |
insert into t3(id, data) VALUES |
| 120 |
(1,'new'), (2,'new'),(3,'new'),(4,'new'),(5,'new'), |
| 121 |
(6,'new'),(7,'new'),(8,'new'),(9,'new'),(10,'new'); |
| 122 |
insert into t4(id, data) VALUES |
| 123 |
(1,'new'), (2,'new'),(3,'new'),(4,'new'),(5,'new'), |
| 124 |
(6,'new'),(7,'new'),(8,'new'),(9,'new'),(10,'new'); |
| 125 |
|
| 126 |
alter table t1 algorithm=inplace, add column c int unsigned default null; |
| 127 |
alter table t1 reorganize partition; |
| 128 |
alter table t2 reorganize partition; |
| 129 |
alter table t5 algorithm=inplace, max_rows=300000000; |
| 130 |
alter table t6 reorganize partition; |
| 131 |
alter table t10 reorganize partition; |
| 132 |
# Verify that the Unique hash index fragments are balanced across all data nodes |
| 133 |
select parent_fq_name, type, table_id, node_id, block_instance, fragment_num |
| 134 |
from ndbinfo.memory_per_fragment where parent_fq_name like '%t10%'; |
| 135 |
show create table t10; |
| 136 |
alter table t10 add unique(other); |
| 137 |
alter table t10 drop index other; |
| 138 |
|
| 139 |
# Verify that the Unique hash index fragments are balanced across all data nodes |
| 140 |
select parent_fq_name, type, table_id, node_id, block_instance, fragment_num |
| 141 |
from ndbinfo.memory_per_fragment where parent_fq_name like '%t10%'; |
| 142 |
|
| 143 |
## Check details of t1 partitioning |
| 144 |
--echo "Table t1 Partition info" |
| 145 |
let ndb_table= t1; |
| 146 |
--source show_partition_info.inc |
| 147 |
select count(0) as row_count from t1; |
| 148 |
|
| 149 |
## Check details of t2 partitioning |
| 150 |
--echo "Table t2 Partition info" |
| 151 |
let ndb_table= t2; |
| 152 |
--source show_partition_info.inc |
| 153 |
select count(0) as row_count from t2; |
| 154 |
|
| 155 |
## Check details of t3 partitioning |
| 156 |
--echo "Table t3 Partition info" |
| 157 |
let ndb_table= t3; |
| 158 |
--source show_partition_info.inc |
| 159 |
|
| 160 |
## Check details of t4 partitioning |
| 161 |
--echo "Table t4 Partition info" |
| 162 |
let ndb_table= t4; |
| 163 |
--source show_partition_info.inc |
| 164 |
|
| 165 |
## Check details of t5 partitioning |
| 166 |
--echo "Table t5 Partition info" |
| 167 |
let ndb_table= t5; |
| 168 |
--source show_partition_info.inc |
| 169 |
select count(0) as row_count from t5; |
| 170 |
|
| 171 |
## Simple blob usage of t6 |
| 172 |
select count(0) as row_count from t6; |
| 173 |
|
| 174 |
## Check details of t6 partitioning |
| 175 |
--echo "Table t6 Partition info" |
| 176 |
let ndb_table= t6; |
| 177 |
--source show_partition_info.inc |
| 178 |
|
| 179 |
## Check details of t6 blob table partitioning |
| 180 |
--echo "Table t6 blob dat Partition info" |
| 181 |
let ndb_table= $bt_test_t6_dat; |
| 182 |
--source show_partition_info.inc |
| 183 |
|
| 184 |
--echo "Table t6 blob txt Partition info" |
| 185 |
let ndb_table= $bt_test_t6_txt; |
| 186 |
--source show_partition_info.inc |
| 187 |
|
| 188 |
# Check that main table and blob tables have same hashmap. |
| 189 |
let ndb_database= test; |
| 190 |
let ndb_table= t6; |
| 191 |
let ndb_die_on_error= 1; |
| 192 |
--replace_regex /.* BT=.*// |
| 193 |
--source suite/ndb/include/ndb_check_blob_tables.inc |
| 194 |
|
| 195 |
## Drop nodegroup with "new" nodes is not allowed with data one those nodes |
| 196 |
# NOTE: --error=0 is due to return codes doesnt work on windoze |
| 197 |
--error 0,255 |
| 198 |
--exec $NDB_MGM -e "drop nodegroup 1" |
| 199 |
|
| 200 |
## Nodegroup with "new" nodes still exist after dropping it as shown: |
| 201 |
--source ndb_mgm_show_table.inc |
| 202 |
|
| 203 |
drop table t1,t2,t3,t4,t5,t6,t10; |
| 204 |
|
| 205 |
## Drop nodegroup with "new" nodes |
| 206 |
--exec $NDB_MGM -e "drop nodegroup 1" |
| 207 |
|
| 208 |
## Nodegroup with "new" nodes still exists after dropping it as shown: |
| 209 |
--source ndb_mgm_show_table.inc |
| 210 |
|
| 211 |
# Cleanup |
| 212 |
ALTER TABLESPACE ts_1 DROP DATAFILE 'data_1.dat'; |
| 213 |
DROP TABLESPACE ts_1; |
| 214 |
DROP LOGFILE GROUP lg_1 ENGINE NDB; |
| 215 |
|