Skip to content

Commit ed57a56

Browse files
committed
Bug#19912988 NDB : ONLINE REORG RELATED ROW CHANGES ARE BINLOGGED
A new value of the reorg flag is passed down to LQH to allow it to differentiate between : - Reorg copy driven operations - All other operations Reorg copy driven operations should not result in SUMA triggers being fired. Test ndb_addnode_withbinlog improved to show behaviour with binlogging : - Reorg of table with no concurrent activity results in no binlogging Change-Id: I3cd46575871f720569f521d497d3a6d6b0a860c9
1 parent ddacb02 commit ed57a56

File tree

9 files changed

+548
-71
lines changed

9 files changed

+548
-71
lines changed
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
result_format: 2
2+
"Create nodegroup with out-of-range node ID"
3+
"Create nodegroup with in-range but inactive node ID"
4+
CREATE LOGFILE GROUP lg_1
5+
ADD UNDOFILE 'undo_1.dat'
6+
INITIAL_SIZE 4M
7+
UNDO_BUFFER_SIZE 2M
8+
ENGINE NDB;
9+
10+
CREATE TABLESPACE ts_1
11+
ADD DATAFILE 'data_1.dat'
12+
USE LOGFILE GROUP lg_1
13+
INITIAL_SIZE 16M
14+
ENGINE NDB;
15+
16+
create table t1(id int, data char(8), id2 binary(80), primary key (id, id2)) engine=ndb;
17+
create table t2(id int NOT NULL PRIMARY KEY, data char(8))
18+
TABLESPACE ts_1 STORAGE DISK engine=ndb;
19+
create table t5(id int NOT NULL PRIMARY KEY, data char(8)) max_rows=50000000 engine=ndb;
20+
create table t6(id int not null primary key, dat blob, txt text) engine=ndb;
21+
22+
23+
24+
load data local infile 'suite/ndb/data/table_data10000.dat' into table t1 fields terminated by ' ' lines terminated by '\n';
25+
Warnings:
26+
Warning 1261 Row 1 doesn't contain data for all columns
27+
Warning 1261 Row 2 doesn't contain data for all columns
28+
Warning 1261 Row 3 doesn't contain data for all columns
29+
Warning 1261 Row 4 doesn't contain data for all columns
30+
Warning 1261 Row 5 doesn't contain data for all columns
31+
Warning 1261 Row 6 doesn't contain data for all columns
32+
Warning 1261 Row 7 doesn't contain data for all columns
33+
Warning 1261 Row 8 doesn't contain data for all columns
34+
Warning 1261 Row 9 doesn't contain data for all columns
35+
Warning 1261 Row 10 doesn't contain data for all columns
36+
Warning 1261 Row 11 doesn't contain data for all columns
37+
Warning 1261 Row 12 doesn't contain data for all columns
38+
Warning 1261 Row 13 doesn't contain data for all columns
39+
Warning 1261 Row 14 doesn't contain data for all columns
40+
Warning 1261 Row 15 doesn't contain data for all columns
41+
Warning 1261 Row 16 doesn't contain data for all columns
42+
Warning 1261 Row 17 doesn't contain data for all columns
43+
Warning 1261 Row 18 doesn't contain data for all columns
44+
Warning 1261 Row 19 doesn't contain data for all columns
45+
Warning 1261 Row 20 doesn't contain data for all columns
46+
Warning 1261 Row 21 doesn't contain data for all columns
47+
Warning 1261 Row 22 doesn't contain data for all columns
48+
Warning 1261 Row 23 doesn't contain data for all columns
49+
Warning 1261 Row 24 doesn't contain data for all columns
50+
Warning 1261 Row 25 doesn't contain data for all columns
51+
Warning 1261 Row 26 doesn't contain data for all columns
52+
Warning 1261 Row 27 doesn't contain data for all columns
53+
Warning 1261 Row 28 doesn't contain data for all columns
54+
Warning 1261 Row 29 doesn't contain data for all columns
55+
Warning 1261 Row 30 doesn't contain data for all columns
56+
Warning 1261 Row 31 doesn't contain data for all columns
57+
Warning 1261 Row 32 doesn't contain data for all columns
58+
Warning 1261 Row 33 doesn't contain data for all columns
59+
Warning 1261 Row 34 doesn't contain data for all columns
60+
Warning 1261 Row 35 doesn't contain data for all columns
61+
Warning 1261 Row 36 doesn't contain data for all columns
62+
Warning 1261 Row 37 doesn't contain data for all columns
63+
Warning 1261 Row 38 doesn't contain data for all columns
64+
Warning 1261 Row 39 doesn't contain data for all columns
65+
Warning 1261 Row 40 doesn't contain data for all columns
66+
Warning 1261 Row 41 doesn't contain data for all columns
67+
Warning 1261 Row 42 doesn't contain data for all columns
68+
Warning 1261 Row 43 doesn't contain data for all columns
69+
Warning 1261 Row 44 doesn't contain data for all columns
70+
Warning 1261 Row 45 doesn't contain data for all columns
71+
Warning 1261 Row 46 doesn't contain data for all columns
72+
Warning 1261 Row 47 doesn't contain data for all columns
73+
Warning 1261 Row 48 doesn't contain data for all columns
74+
Warning 1261 Row 49 doesn't contain data for all columns
75+
Warning 1261 Row 50 doesn't contain data for all columns
76+
Warning 1261 Row 51 doesn't contain data for all columns
77+
Warning 1261 Row 52 doesn't contain data for all columns
78+
Warning 1261 Row 53 doesn't contain data for all columns
79+
Warning 1261 Row 54 doesn't contain data for all columns
80+
Warning 1261 Row 55 doesn't contain data for all columns
81+
Warning 1261 Row 56 doesn't contain data for all columns
82+
Warning 1261 Row 57 doesn't contain data for all columns
83+
Warning 1261 Row 58 doesn't contain data for all columns
84+
Warning 1261 Row 59 doesn't contain data for all columns
85+
Warning 1261 Row 60 doesn't contain data for all columns
86+
Warning 1261 Row 61 doesn't contain data for all columns
87+
Warning 1261 Row 62 doesn't contain data for all columns
88+
Warning 1261 Row 63 doesn't contain data for all columns
89+
Warning 1261 Row 64 doesn't contain data for all columns
90+
load data local infile 'suite/ndb/data/table_data10000.dat' into table t2 fields terminated by ' ' lines terminated by '\n';
91+
load data local infile 'suite/ndb/data/table_data10000.dat' into table t5 fields terminated by ' ' lines terminated by '\n';
92+
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);
93+
94+
select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
95+
t1_part_count
96+
8
97+
select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
98+
t2_part_count
99+
8
100+
select @init_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
101+
t5_part_count
102+
8
103+
select count(1) as t6_part_count from information_schema.partitions where table_schema='test' and table_name='t6';
104+
t6_part_count
105+
8
106+
107+
## Check details of t5 partitioning
108+
109+
TABLE_INFO
110+
PartitionCount: 8
111+
112+
select count(0) as row_count from t5;
113+
row_count
114+
10000
115+
116+
## Check details of t6 partitioning
117+
T6
118+
119+
TABLE_INFO
120+
PartitionCount: 8
121+
122+
NDB$BLOB_20_1
123+
124+
TABLE_INFO
125+
PartitionCount: 8
126+
127+
NDB$BLOB_20_2
128+
129+
TABLE_INFO
130+
PartitionCount: 8
131+
132+
133+
select count(0) as row_count from t6;
134+
row_count
135+
10000
136+
137+
## Create nodegroup for "new" nodes
138+
## Drop
139+
## and create
140+
set @@new = 1;
141+
142+
create table t7(id int primary key, uk int) engine=ndb
143+
partition by list(id) (
144+
partition p0 values in (0),
145+
partition p1 values in (1),
146+
partition p2 values in (2),
147+
partition p3 values in (3),
148+
partition p4 values in (4)
149+
);
150+
drop table t7;
151+
152+
create table t3(id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb;
153+
create table t4(id int NOT NULL PRIMARY KEY, data char(8))
154+
TABLESPACE ts_1 STORAGE DISK engine=ndb;
155+
156+
insert into t3(id, data) VALUES
157+
(1,'new'), (2,'new'),(3,'new'),(4,'new'),(5,'new'),
158+
(6,'new'),(7,'new'),(8,'new'),(9,'new'),(10,'new');
159+
insert into t4(id, data) VALUES
160+
(1,'new'), (2,'new'),(3,'new'),(4,'new'),(5,'new'),
161+
(6,'new'),(7,'new'),(8,'new'),(9,'new'),(10,'new');
162+
163+
alter table t1 algorithm=inplace, add column c int unsigned default null;
164+
Warnings:
165+
Warning 1478 Converted FIXED field 'c' to DYNAMIC to enable online ADD COLUMN
166+
alter table t1 reorganize partition;
167+
alter table t2 reorganize partition;
168+
alter table t5 algorithm=inplace, max_rows=300000000;
169+
alter table t6 reorganize partition;
170+
171+
select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
172+
t1_part_count
173+
16
174+
select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
175+
t2_part_count
176+
16
177+
select count(1) as t3_part_count from information_schema.partitions where table_schema='test' and table_name='t3';
178+
t3_part_count
179+
16
180+
select count(1) as t4_part_count from information_schema.partitions where table_schema='test' and table_name='t4';
181+
t4_part_count
182+
16
183+
select @reorg_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
184+
t5_part_count
185+
16
186+
select count(1) as t6_part_count from information_schema.partitions where table_schema='test' and table_name='t6';
187+
t6_part_count
188+
16
189+
190+
## Check details of t5 partitioning
191+
192+
TABLE_INFO
193+
PartitionCount: 16
194+
195+
select count(0) as row_count from t5;
196+
row_count
197+
10000
198+
199+
200+
## Simple blob usage of t6
201+
select count(0) as row_count, sum(length(dat)) as data_length, sum(length(txt)) as text_length from t6;
202+
row_count data_length text_length
203+
10000 3000000 3000000
204+
205+
## Check details of t6 partitioning
206+
T6
207+
208+
TABLE_INFO
209+
PartitionCount: 16
210+
211+
NDB$BLOB_20_1
212+
213+
TABLE_INFO
214+
PartitionCount: 16
215+
216+
NDB$BLOB_20_2
217+
218+
TABLE_INFO
219+
PartitionCount: 16
220+
221+
222+
Table: test.t6
223+
HashMap: DEFAULT-HASHMAP-3840-16
224+
dat Blob(256,2000,0) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_20_1
225+
HashMap: DEFAULT-HASHMAP-3840-16
226+
txt Text(256,2000,0;latin1_swedish_ci) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_20_2
227+
HashMap: DEFAULT-HASHMAP-3840-16
228+
229+
230+
## Drop nodegroup with "new" nodes is not allowed with data one those nodes
231+
## Nodegroup with "new" nodes still exist after dropping it as shown:
232+
drop table t1,t2,t3,t4,t5,t6;
233+
234+
## Drop nodegroup with "new" nodes
235+
## Nodegroup with "new" nodes still exists after dropping it as shown:
236+
ALTER TABLESPACE ts_1 DROP DATAFILE 'data_1.dat' ENGINE NDB;
237+
DROP TABLESPACE ts_1 ENGINE NDB;
238+
DROP LOGFILE GROUP lg_1 ENGINE NDB;
239+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
show variables like 'log_bin';
2+
Variable_name Value
3+
log_bin ON
4+
show variables like 'ndb_log_bin';
5+
Variable_name Value
6+
ndb_log_bin ON
7+
Test 1 : Show that reorg of table being Binlogged does not result
8+
in any Binlog content
9+
create table t1 (a int primary key, b blob, c int, unique(c)) engine=ndb;
10+
Insert 8192 rows
11+
Show t1 distribution prior to reorg
12+
TABLE_INFO
13+
PartitionCount: 8
14+
Add new nodes
15+
Show empty binlog prior to reorg
16+
reset master;
17+
select count(1), sum(inserts), sum(updates), sum(deletes) from mysql.ndb_binlog_index;
18+
count(1) sum(inserts) sum(updates) sum(deletes)
19+
0 NULL NULL NULL
20+
Reorg table to use new nodes
21+
alter table t1 reorganize partition;
22+
Show t1 distribution after reorg
23+
TABLE_INFO
24+
PartitionCount: 16
25+
Show empty binlog after reorg
26+
select count(1), sum(inserts), sum(updates), sum(deletes) from mysql.ndb_binlog_index;
27+
count(1) sum(inserts) sum(updates) sum(deletes)
28+
0 NULL NULL NULL
29+
Cleanup
30+
drop table t1;

0 commit comments

Comments
 (0)