Debian Codegraph @

mysql-test/suite/ndb_big/ndb_big_addnode.test

raw
1 -- source include/have_ndb.inc
2
3 --result_format 2
4 --enable_connect_log
5
6 connect (j1,localhost,root,,test);
7 connect (j2,localhost,root,,test);
8 connect (j3,localhost,root,,test);
9 connect (j4,localhost,root,,test);
10
11 connect (ddl,localhost,root,,test,$MASTER_MYPORT1,);
12
13 connection ddl;
14
15 CREATE LOGFILE GROUP lg_1
16 ADD UNDOFILE 'undo_1.dat'
17 INITIAL_SIZE 4M
18 UNDO_BUFFER_SIZE 2M
19 ENGINE NDB;
20
21 CREATE TABLESPACE ts_1
22 ADD DATAFILE 'data_1.dat'
23 USE LOGFILE GROUP lg_1
24 INITIAL_SIZE 16M
25 ENGINE NDB;
26
27 create table t1(id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb;
28 create table t2(id int NOT NULL PRIMARY KEY, data char(8))
29 TABLESPACE ts_1 STORAGE DISK engine=ndb;
30 create table t5(id int NOT NULL PRIMARY KEY, data char(8)) max_rows=50000000 engine=ndb;
31 create table t6(id int not null primary key, val int unique key, dat blob, txt text) engine=ndb;
32
33 # Get blob tables table test.t6
34 let ndb_database= test;
35 let ndb_table= t6;
36 --source suite/ndb/include/ndb_get_blob_tables.inc
37
38 load data local infile 'suite/ndb/data/table_data10000.dat' into table t1 fields terminated by ' ' lines terminated by '\n';
39 load data local infile 'suite/ndb/data/table_data10000.dat' into table t2 fields terminated by ' ' lines terminated by '\n';
40 load data local infile 'suite/ndb/data/table_data10000.dat' into table t5 fields terminated by ' ' lines terminated by '\n';
41 load data local infile 'suite/ndb/data/table_data10000.dat' into table t6 fields terminated by ' ' lines terminated by '\n' ignore 9000 lines (@id, @data) set id = (@id - 9000)*10 - 9, val = (@id - 9000)*10 - 9, dat = repeat(@data, 10000), txt = repeat(@data,10000);
42
43 select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
44 select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
45 select @init_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
46 select count(1) as t6_part_count from information_schema.partitions where table_schema='test' and table_name='t6';
47
48 connection default;
49 # connection j1;
50
51 --replace_column 9 ###
52 explain
53 select count(*)
54 from t6 join t1
55 on (t6.val = t1.id)
56 where t6.val < 25;
57
58 --disable_query_log
59 delimiter %;
60 create procedure queryload (seconds int, o int)
61 begin
62 set @laps := 0;
63 set @x=time_to_sec(current_time()) + seconds;
64 set @off = o;
65 repeat
66 select count(*)
67 from t6 join t1
68 on (t6.val = t1.id)
69 where t6.val between @off and @off + 24;
70 set @off := o + ((@off + 25) mod 1000);
71 until @x <= time_to_sec(current_time())
72 end repeat;
73 end%
74 create procedure updateload (seconds int, o int)
75 begin
76 set @laps := 0;
77 set @x=time_to_sec(current_time()) + seconds;
78 set @off = o;
79 repeat
80 select count(*)
81 from t6 join t1
82 on (t6.val = t1.id)
83 where t6.val between @off and @off + 24;
84 set @blob := repeat(@off mod 1000,10000);
85 update t6 set dat = @blob, txt = @blob where val between @off and @off + 24;
86 update t6 set id = -id where id mod 2 and val between @off and @off + 24;
87 set @off := o + ((@off + 25) mod 1000);
88 until @x <= time_to_sec(current_time())
89 end repeat;
90 end%
91
92 delimiter ;%
93 --enable_query_log
94
95 --echo Starting engines...
96
97 connection j1;
98 send call updateload(300,0);
99
100 connection j2;
101 send call queryload(300,2000);
102
103 connection j3;
104 send call updateload(300,4000);
105
106 connection j4;
107 send call queryload(300,6000);
108
109 connection default;
110 sleep 10;
111
112 connection ddl;
113
114 sleep 3;
115
116 ## Check details of t5 partitioning
117 --replace_regex /FragmentCount:/FragmentCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*//
118 --exec $NDB_DESC -dtest -n t5
119
120 ## Check details of t6 partitioning
121 --replace_regex /FragmentCount:/FragmentCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*//
122 --exec $NDB_DESC -dtest -n t6 '$bt_test_t6_dat' '$bt_test_t6_txt'
123
124 ## Create nodegroup for "new" nodes
125 --replace_regex /Connected to Management Server at: .*//
126 --exec $NDB_MGM -e "create nodegroup 3,4"
127
128 ## Drop
129 --replace_regex /Connected to Management Server at: .*//
130 --exec $NDB_MGM -e "drop nodegroup 1"
131 ## and create
132 --replace_regex /Connected to Management Server at: .*//
133 --exec $NDB_MGM -e "create nodegroup 3,4"
134
135 # Cluster running after adding two ndbd nodes
136
137 create table t3(id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb;
138 create table t4(id int NOT NULL PRIMARY KEY, data char(8))
139 TABLESPACE ts_1 STORAGE DISK engine=ndb;
140
141 insert into t3(id, data) VALUES
142 (1,'new'), (2,'new'),(3,'new'),(4,'new'),(5,'new'),
143 (6,'new'),(7,'new'),(8,'new'),(9,'new'),(10,'new');
144 insert into t4(id, data) VALUES
145 (1,'new'), (2,'new'),(3,'new'),(4,'new'),(5,'new'),
146 (6,'new'),(7,'new'),(8,'new'),(9,'new'),(10,'new');
147
148 connection ddl;
149
150 alter table t1 algorithm=inplace, reorganize partition;
151 alter online table t2 algorithm=inplace, reorganize partition;
152 alter online table t5 algorithm=inplace, max_rows=300000000;
153 #alter online table t6 algorithm=inplace, reorganize partition;
154 send alter online table t6 algorithm=inplace, reorganize partition;
155
156 connection default;
157 #send call updateload(300,0);
158
159 connection ddl;
160 reap;
161 select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
162 select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
163 select count(1) as t3_part_count from information_schema.partitions where table_schema='test' and table_name='t3';
164 select count(1) as t4_part_count from information_schema.partitions where table_schema='test' and table_name='t4';
165 select @reorg_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
166 select count(1) as t6_part_count from information_schema.partitions where table_schema='test' and table_name='t6';
167
168 ## Check details of t5 partitioning
169 --replace_regex /FragmentCount:/FragmentCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*//
170 --exec $NDB_DESC -dtest -n t5
171
172 --let $t5_part_diff=query_get_value('select @reorg_t5_part_count-@init_t5_part_count as Value',Value,1)
173
174 if (!$t5_part_diff)
175 {
176 --die Table t5 was not reorganised
177 }
178
179 ## Simple blob usage of t6
180 select count(0) as row_count, min(abs(id)) as id_min, max(id) as id_max, sum(length(dat)) as data_length, sum(length(txt)) as text_length from t6;
181 select count(0) from t6 where val = abs(id) and (id between -4991 and -4001 or id between -991 and 9991);
182 let $count= `select count(0) from t6 where abs(id) <> val or (left(dat,if(val mod 1000 < 100, 2, 3)) div 25 <> (val mod 1000) div 25 and left(dat,3) <> 'old') or length(dat) <> length(txt)` ;
183 if ($count)
184 {
185 select id, val, length(dat), left(dat,12), length(txt), left(txt,12) from t6 where abs(id) <> val or (left(dat,if(val mod 1000 < 100, 2, 3)) div 25 <> (val mod 1000) div 25 and left(dat,3) <> 'old') or length(dat) <> length(txt);
186 # die Inconsistent data in t6;
187 }
188
189 ## Check details of t6 partitioning
190 --replace_regex /FragmentCount:/FragmentCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*//
191 --exec $NDB_DESC -dtest -n t6 '$bt_test_t6_dat' '$bt_test_t6_txt'
192
193 # Check that main table and blob tables have same hashmap.
194 let ndb_database= test;
195 let ndb_table= t6;
196 let ndb_die_on_error= 1;
197 --replace_regex /FragmentCount:/FragmentCount/ /HashMap:/HashMap/ /.*[=:#].*// /.*- .*//
198 --source suite/ndb/include/ndb_check_blob_tables.inc
199
200 send drop table t1,t2,t3,t4,t5,t6;
201
202 connection default;
203 #--error 0,ER_NO_SUCH_TABLE,ER_TABLE_DEF_CHANGED
204 #reap;
205
206 connection j1;
207 --disable_result_log
208 --error 0,ER_NO_SUCH_TABLE,ER_TABLE_DEF_CHANGED
209 reap;
210 --enable_result_log
211
212 connection j2;
213 --disable_result_log
214 --error 0,ER_NO_SUCH_TABLE,ER_TABLE_DEF_CHANGED
215 reap;
216 --enable_result_log
217
218 connection j3;
219 --disable_result_log
220 --error 0,ER_NO_SUCH_TABLE,ER_TABLE_DEF_CHANGED
221 reap;
222 --enable_result_log
223
224 connection j4;
225 --disable_result_log
226 --error 0,ER_NO_SUCH_TABLE,ER_TABLE_DEF_CHANGED
227 reap;
228 --enable_result_log
229
230 connection ddl;
231 reap;
232
233 connection default;
234
235 disconnect j1;
236 disconnect j2;
237 disconnect j3;
238 disconnect j4;
239
240 connection default;
241
242 drop procedure queryload;
243 drop procedure updateload;
244
245 connection ddl;
246 ## Drop nodegroup with "new" nodes
247 --replace_regex /Connected to Management Server at: .*//
248 --exec $NDB_MGM -e "drop nodegroup 1"
249
250 # Cleanup
251 ALTER TABLESPACE ts_1 DROP DATAFILE 'data_1.dat';
252 DROP TABLESPACE ts_1;
253 DROP LOGFILE GROUP lg_1 ENGINE NDB;
254 disconnect ddl;
255
256 connection default;