Debian Codegraph @

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

raw
1 --source include/have_ndb.inc
2 #
3 # Fragment type: HashMapPartition
4 # PartitionCount: 8
5 # FragmentCount: 8
6 # PartitionBalance: FOR_RP_BY_LDM
7 # Table options:
8 # HashMap: DEFAULT-HASHMAP-3840-8
9
10 set @old_new = @@global.new;
11 set @old_ndb_read_backup = @@global.ndb_read_backup;
12 set @old_ndb_fully_replicated = @@global.ndb_fully_replicated;
13
14 set @@new = 1;
15
16 set global ndb_read_backup = 1;
17 set global ndb_fully_replicated = 1;
18
19 # Turn of fully replicated when using user defined partitioning
20 set global ndb_fully_replicated = 0;
21
22 CREATE TABLE t01 (x int primary key, y int) engine=ndb
23 partition by list(x) (
24 partition p0 values in (0),
25 partition p1 values in (1),
26 partition p2 values in (2),
27 partition p3 values in (3));
28
29 ALTER TABLE t01 ALGORITHM=INPLACE, ADD UNIQUE KEY (y);
30 let $ndb_desc_opts= -i -d test t01;
31 source suite/ndb/include/ndb_desc_print.inc;
32
33 CREATE TABLE t02 (x int primary key, y int, unique key (y)) engine=ndb
34 partition by list(x) (
35 partition p0 values in (0),
36 partition p1 values in (1),
37 partition p2 values in (2),
38 partition p3 values in (3));
39 let $ndb_desc_opts= -i -d test t02;
40 source suite/ndb/include/ndb_desc_print.inc;
41
42 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
43 ALTER TABLE t02 ALGORITHM=INPLACE, ADD PARTITION (partition p4 values in (4));
44 show warnings;
45
46 --error 1521
47 ALTER TABLE t02 ALGORITHM=INPLACE, DROP PARTITION p0;
48 show warnings;
49
50 set global ndb_fully_replicated = 1;
51
52
53 CREATE TABLE t03 (x int primary key) engine=ndb;
54 let $ndb_desc_opts= -d test t03;
55 source suite/ndb/include/ndb_desc_print.inc;
56
57 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
58 ALTER TABLE t03 ALGORITHM=INPLACE, ADD PARTITION PARTITIONS 1;
59 show warnings;
60
61 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
62 ALTER TABLE t03 ALGORITHM=INPLACE, COALESCE PARTITION 2;
63 show warnings;
64
65 #
66 # Blob tables
67 #
68 CREATE TABLE t04 (x int primary key) engine=ndb;
69 ALTER TABLE t04 ALGORITHM=COPY, ADD COLUMN y blob;
70 let $ndb_desc_opts= -b -d test t04;
71 source suite/ndb/include/ndb_desc_print.inc;
72
73 CREATE TABLE t05 (x int primary key, y blob) engine=ndb;
74 let $ndb_desc_opts= -b -d test t05;
75 source suite/ndb/include/ndb_desc_print.inc;
76
77 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
78 ALTER TABLE t05 ALGORITHM=INPLACE, ADD PARTITION PARTITIONS 1;
79 show warnings;
80
81 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
82 ALTER TABLE t05 ALGORITHM=INPLACE, COALESCE PARTITION 2;
83 show warnings;
84
85 CREATE TABLE t06 (x int primary key, y int) engine=ndb;
86 ALTER TABLE t06 ALGORITHM=INPLACE, ADD UNIQUE KEY (y);
87 let $ndb_desc_opts= -i -d test t06;
88 source suite/ndb/include/ndb_desc_print.inc;
89
90 CREATE TABLE t07 (x int primary key, y int, unique key (y)) engine=ndb;
91 let $ndb_desc_opts= -i -d test t07;
92 source suite/ndb/include/ndb_desc_print.inc;
93
94 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
95 ALTER TABLE t07 ALGORITHM=INPLACE, ADD PARTITION PARTITIONS 1;
96 show warnings;
97
98 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
99 ALTER TABLE t07 ALGORITHM=INPLACE, COALESCE PARTITION 2;
100 show warnings;
101
102 CREATE TABLE t10 (x int primary key, y blob, z int, unique key (z)) engine=ndb;
103 let $ndb_desc_opts= -b -i -d test t10;
104 source suite/ndb/include/ndb_desc_print.inc;
105
106 set global ndb_fully_replicated=0;
107 CREATE TABLE t12 (x int primary key, y blob, z int, unique key (z)) engine=ndb partition by key(x) partitions 4;
108 let $ndb_desc_opts= -b -i -d test t12;
109 source suite/ndb/include/ndb_desc_print.inc;
110
111 set global ndb_fully_replicated=0;
112 CREATE TABLE t11 (x int primary key, y blob, z int, unique key (z)) engine=ndb;
113 let $ndb_desc_opts= -b -i -d test t11;
114 source suite/ndb/include/ndb_desc_print.inc;
115
116 exec $NDB_MGM -e"create nodegroup 5,6";
117
118 set global ndb_fully_replicated=0; # FR fails user defined partitioning
119
120 CREATE TABLE t08 (x int primary key, y int) engine=ndb
121 partition by list(x) (
122 partition p0 values in (0),
123 partition p1 values in (1),
124 partition p2 values in (2),
125 partition p3 values in (3));
126
127 ALTER TABLE t08 ALGORITHM=INPLACE, ADD UNIQUE KEY (y);
128 let $ndb_desc_opts= -i -d test t08;
129 source suite/ndb/include/ndb_desc_print.inc;
130
131 CREATE TABLE t09 (x int primary key, y int, unique key (y)) engine=ndb
132 partition by list(x) (
133 partition p0 values in (0),
134 partition p1 values in (1),
135 partition p2 values in (2),
136 partition p3 values in (3));
137 let $ndb_desc_opts= -i -d test t09;
138 source suite/ndb/include/ndb_desc_print.inc;
139
140 set global ndb_fully_replicated=1; # FR fails user defined partitioning
141
142 alter table t03 algorithm=inplace, reorganize partition;
143 let $ndb_desc_opts= -d test t03;
144 source suite/ndb/include/ndb_desc_print.inc;
145
146 alter table t04 algorithm=inplace, reorganize partition;
147 let $ndb_desc_opts= -b -d test t04;
148 source suite/ndb/include/ndb_desc_print.inc;
149
150 alter table t05 algorithm=inplace, reorganize partition;
151 let $ndb_desc_opts= -b -d test t05;
152 source suite/ndb/include/ndb_desc_print.inc;
153
154 alter table t06 algorithm=inplace, reorganize partition;
155 # Bug#13714258 UNIQUE INDEXES NOT REORGANISED BY ONLINE TABLE REORG
156 # Use commented row below instead when bug fixed.
157 #let $ndb_desc_opts= -i -d test t06;
158 let $ndb_desc_opts= -d test t06;
159 source suite/ndb/include/ndb_desc_print.inc;
160
161 alter table t07 algorithm=inplace, reorganize partition;
162 # Bug#13714258 UNIQUE INDEXES NOT REORGANISED BY ONLINE TABLE REORG
163 # Use commented row below instead when bug fixed.
164 #let $ndb_desc_opts= -i -d test t07;
165 let $ndb_desc_opts= -d test t07;
166 source suite/ndb/include/ndb_desc_print.inc;
167
168 alter table t10 algorithm=inplace, reorganize partition;
169 # Bug#13714258 UNIQUE INDEXES NOT REORGANISED BY ONLINE TABLE REORG
170 # Use commented row below instead when bug fixed.
171 #let $ndb_desc_opts= -b -i -d test t10;
172 let $ndb_desc_opts= -b -d test t10;
173 source suite/ndb/include/ndb_desc_print.inc;
174
175 alter table t11 algorithm=inplace, reorganize partition;
176 # Bug#13714258 UNIQUE INDEXES NOT REORGANISED BY ONLINE TABLE REORG
177 # Use commented row below instead when bug fixed.
178 #let $ndb_desc_opts= -b -i -d test t11;
179 let $ndb_desc_opts= -b -d test t11;
180 source suite/ndb/include/ndb_desc_print.inc;
181
182 set global ndb_fully_replicated = 0;
183
184 --error 1296
185 alter table t12 algorithm=inplace, add partition partitions 4;
186 show warnings;
187
188 alter table t12 algorithm=copy, add partition partitions 4;
189 let $ndb_desc_opts= -b -i -d test t12;
190 source suite/ndb/include/ndb_desc_print.inc;
191
192 drop tables t01,t02,t03,t04,t05,t06,t07,t08,t09,t10,t11,t12;
193
194 set global new = @old_new;
195 set global ndb_read_backup = @old_ndb_read_backup;
196 set global ndb_fully_replicated = @old_ndb_fully_replicated;
197
198 exec $NDB_MGM -e"drop nodegroup 2";