Debian Codegraph @

mysql-test/suite/ndb/t/ndb_fragment_count_addnode.test

raw
1 -- source include/have_ndb.inc
2
3 --source suite/ndb/include/turn_off_ndb_read_backup.inc
4
5 create table t1 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb;
6 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
7 where fq_name = 'test/def/t1' order by node_id, fragment_num, block_instance;
8
9 create table t2 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
10 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
11 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
12 where fq_name = 'test/def/t2' order by node_id, fragment_num, block_instance;
13
14 create table t3 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
15 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM";
16 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
17 where fq_name = 'test/def/t3' order by node_id, fragment_num, block_instance;
18
19 create table t4 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
20 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_NODE";
21 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
22 where fq_name = 'test/def/t4' order by node_id, fragment_num, block_instance;
23
24 create table t5 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
25 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_NODE";
26 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
27 where fq_name = 'test/def/t5' order by node_id, fragment_num, block_instance;
28
29 create table t6 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
30 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_2";
31 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
32 where fq_name = 'test/def/t6' order by node_id, fragment_num, block_instance;
33
34 create table t7 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
35 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_3";
36 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
37 where fq_name = 'test/def/t7' order by node_id, fragment_num, block_instance;
38
39 create table t8 (id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb
40 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RA_BY_LDM_X_4";
41 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
42 where fq_name = 'test/def/t8' order by node_id, fragment_num, block_instance;
43
44 select count(*) into @cnt_t1_0
45 from information_schema.partitions
46 where table_schema = 'test' and table_name = 't1';
47
48 select count(*) into @cnt_t2_0
49 from information_schema.partitions
50 where table_schema = 'test' and table_name = 't2';
51
52 select count(*) into @cnt_t3_0
53 from information_schema.partitions
54 where table_schema = 'test' and table_name = 't3';
55
56 select count(*) into @cnt_t4_0
57 from information_schema.partitions
58 where table_schema = 'test' and table_name = 't4';
59
60 select count(*) into @cnt_t5_0
61 from information_schema.partitions
62 where table_schema = 'test' and table_name = 't5';
63
64 select count(*) into @cnt_t6_0
65 from information_schema.partitions
66 where table_schema = 'test' and table_name = 't6';
67
68 select count(*) into @cnt_t7_0
69 from information_schema.partitions
70 where table_schema = 'test' and table_name = 't7';
71
72 select count(*) into @cnt_t8_0
73 from information_schema.partitions
74 where table_schema = 'test' and table_name = 't8';
75
76 ##
77 ## skip showing exact counts
78 ##
79 select @cnt_t1_0 = @cnt_t2_0;
80 select @cnt_t2_0 > @cnt_t3_0;
81 select @cnt_t3_0 > @cnt_t4_0;
82 select @cnt_t4_0 > @cnt_t5_0;
83 select @cnt_t6_0 = 2 * @cnt_t3_0;
84 select @cnt_t7_0 = 3 * @cnt_t3_0;
85 select @cnt_t8_0 = 4 * @cnt_t3_0;
86
87 ## Create nodegroup for "new" nodes
88 --echo Creating nodegroup
89 --exec $NDB_MGM -e "create nodegroup 5,6" > /dev/null
90
91 alter table t1 algorithm=inplace, reorganize partition;
92 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
93 where fq_name = 'test/def/t1' order by node_id, fragment_num, block_instance;
94
95 alter table t2 algorithm=inplace, reorganize partition;
96 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
97 where fq_name = 'test/def/t2' order by node_id, fragment_num, block_instance;
98
99 alter table t3 algorithm=inplace, reorganize partition;
100 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
101 where fq_name = 'test/def/t3' order by node_id, fragment_num, block_instance;
102
103 alter table t4 algorithm=inplace, reorganize partition;
104 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
105 where fq_name = 'test/def/t4' order by node_id, fragment_num, block_instance;
106
107 alter table t5 algorithm=inplace, reorganize partition;
108 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
109 where fq_name = 'test/def/t5' order by node_id, fragment_num, block_instance;
110
111 alter table t6 algorithm=inplace, reorganize partition;
112 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
113 where fq_name = 'test/def/t6' order by node_id, fragment_num, block_instance;
114
115 alter table t7 algorithm=inplace, reorganize partition;
116 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
117 where fq_name = 'test/def/t7' order by node_id, fragment_num, block_instance;
118
119 alter table t8 algorithm=inplace, reorganize partition;
120 select node_id, fragment_num, block_instance from ndbinfo.memory_per_fragment
121 where fq_name = 'test/def/t8' order by node_id, fragment_num, block_instance;
122
123 select count(*) into @cnt_t1_1
124 from information_schema.partitions
125 where table_schema = 'test' and table_name = 't1';
126
127 select count(*) into @cnt_t2_1
128 from information_schema.partitions
129 where table_schema = 'test' and table_name = 't2';
130
131 select count(*) into @cnt_t3_1
132 from information_schema.partitions
133 where table_schema = 'test' and table_name = 't3';
134
135 select count(*) into @cnt_t4_1
136 from information_schema.partitions
137 where table_schema = 'test' and table_name = 't4';
138
139 select count(*) into @cnt_t5_1
140 from information_schema.partitions
141 where table_schema = 'test' and table_name = 't5';
142
143 select count(*) into @cnt_t6_0
144 from information_schema.partitions
145 where table_schema = 'test' and table_name = 't6';
146
147 select count(*) into @cnt_t7_0
148 from information_schema.partitions
149 where table_schema = 'test' and table_name = 't7';
150
151 select count(*) into @cnt_t8_0
152 from information_schema.partitions
153 where table_schema = 'test' and table_name = 't8';
154
155 ##
156 ## skip showing exact counts
157 ##
158 select @cnt_t1_1 = @cnt_t2_1;
159 select @cnt_t2_1 > @cnt_t3_1;
160 select @cnt_t3_1 > @cnt_t4_1;
161 select @cnt_t4_1 > @cnt_t5_1;
162 select @cnt_t6_1 = 2 * @cnt_t3_1;
163 select @cnt_t7_1 = 3 * @cnt_t3_1;
164 select @cnt_t8_1 = 4 * @cnt_t3_1;
165
166 select @cnt_t1_1 > @cnt_t1_0;
167 select @cnt_t2_1 > @cnt_t2_0;
168 select @cnt_t3_1 > @cnt_t3_0;
169 select @cnt_t4_1 > @cnt_t4_0;
170 select @cnt_t5_1 > @cnt_t5_0;
171 select @cnt_t6_1 > @cnt_t6_0;
172 select @cnt_t7_1 > @cnt_t7_0;
173 select @cnt_t8_1 > @cnt_t8_0;
174
175 let $i = 200;
176 --disable_query_log
177 while ($i) {
178 eval insert into t1 values ($i, '$i');
179 dec $i;
180 }
181 --enable_query_log
182 --let ndb_desc_opts= -p -d test t1
183 --source suite/ndb/include/ndb_desc_print.inc
184
185 drop table t1,t2,t3,t4,t5,t6,t7,t8;
186
187 --exec $NDB_MGM -e "drop nodegroup 2"
188
189 --source suite/ndb/include/restore_ndb_read_backup.inc