File: ndb_binlog_index.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (241 lines) | stat: -rw-r--r-- 8,469 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
-------------------------------------------------
First run using ndb_binlog_index table containing
epoch end position information
-------------------------------------------------
show create table mysql.ndb_binlog_index;
Table	Create Table
ndb_binlog_index	CREATE TABLE `ndb_binlog_index` (
  `Position` bigint unsigned NOT NULL,
  `File` varchar(255) NOT NULL,
  `epoch` bigint unsigned NOT NULL,
  `inserts` int unsigned NOT NULL,
  `updates` int unsigned NOT NULL,
  `deletes` int unsigned NOT NULL,
  `schemaops` int unsigned NOT NULL,
  `orig_server_id` int unsigned NOT NULL,
  `orig_epoch` bigint unsigned NOT NULL,
  `gci` int unsigned NOT NULL,
  `next_position` bigint unsigned NOT NULL,
  `next_file` varchar(255) NOT NULL,
  PRIMARY KEY (`epoch`,`orig_server_id`,`orig_epoch`)
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
mysql.ndb_binlog_index has next_file column? 1
create table t1 (a int, b varchar(400)) engine=ndb;
Test pure epochs
----------------
insert into t1 values(1, repeat('B', 400));
insert into t1 values(1, repeat('F', 400));
insert into t1 values(1, repeat('E', 400));
flush logs;
---------------------------------------------------------------------------
Mismatches between Binlog index next_pos and Binlog COMMIT event pos
---------------------------------------------------------------------------
epoch	calculated_pos	stored_pos
Done
reset master;
Test interleaved epochs and DDL
------------------------------
insert into t1 values(1, repeat('R', 400));
create table t2 (a int) engine=ndb;
insert into t1 values(1, repeat('A', 400));
create table t3 (a int) engine=ndb;
insert into t1 value(1, repeat('A', 400));
flush logs;
---------------------------------------------------------------------------
Mismatches between Binlog index next_pos and Binlog COMMIT event pos
---------------------------------------------------------------------------
epoch	calculated_pos	stored_pos
Done
Test multithreaded interleaved epochs and DDL
---------------------------------------------
Issue DDL and DML concurrently on server1
They will interleave in the Binlog according to Binlog mutex
interactions between DDL executing server thread and binlog injector

Check Binlog on DDL-source MySQLD to ensure that binlog index positions
'cover' the Binlog
Check Binlog on other MySQLD to ensure that binlog index positions
'cover' the Binlog (DDL here is 'fabricated' by Binlog injector thread

reset master;
reset master;
set sql_log_bin=0;
create table dmlload_stop (
value int primary key
);
create procedure dmlload ()
begin
declare stop int default 0;
repeat
start transaction;
insert into t1 values (2, repeat('I', 400));
commit;
start transaction;
update t1 set b=repeat('Z', 400) where a=2;
commit;
start transaction;
delete from t1 where a=2;
commit;
select value from dmlload_stop where value = 1 into stop;
until stop
end repeat;
end%
set sql_log_bin=1;
call dmlload();
insert into dmlload_stop values(1);
Now check binlog index vs binlog itself on Server1
flush logs;
---------------------------------------------------------------------------
Mismatches between Binlog index next_pos and Binlog COMMIT event pos
---------------------------------------------------------------------------
epoch	calculated_pos	stored_pos
Done
Now check binlog index vs binlog itself on Server2
flush logs;
---------------------------------------------------------------------------
Mismatches between Binlog index next_pos and Binlog COMMIT event pos
---------------------------------------------------------------------------
epoch	calculated_pos	stored_pos
Done
drop procedure dmlload;
drop table dmlload_stop;
Cleanup
drop table t1;
drop table t2;
drop table t3;
------------------------------------------------
Second run using ndb_binlog_index table without
epoch end position information
------------------------------------------------
alter table mysql.ndb_binlog_index drop column next_file;
alter table mysql.ndb_binlog_index drop column next_position;
reset master;
show create table mysql.ndb_binlog_index;
Table	Create Table
ndb_binlog_index	CREATE TABLE `ndb_binlog_index` (
  `Position` bigint unsigned NOT NULL,
  `File` varchar(255) NOT NULL,
  `epoch` bigint unsigned NOT NULL,
  `inserts` int unsigned NOT NULL,
  `updates` int unsigned NOT NULL,
  `deletes` int unsigned NOT NULL,
  `schemaops` int unsigned NOT NULL,
  `orig_server_id` int unsigned NOT NULL,
  `orig_epoch` bigint unsigned NOT NULL,
  `gci` int unsigned NOT NULL,
  PRIMARY KEY (`epoch`,`orig_server_id`,`orig_epoch`)
) /*!50100 TABLESPACE `mysql` */ ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC
mysql.ndb_binlog_index has next_file column? 0
create table t1 (a int, b varchar(400)) engine=ndb;
Test pure epochs
----------------
insert into t1 values(1, repeat('B', 400));
insert into t1 values(1, repeat('F', 400));
insert into t1 values(1, repeat('E', 400));
flush logs;
Nothing to verify
reset master;
Test interleaved epochs and DDL
------------------------------
insert into t1 values(1, repeat('R', 400));
create table t2 (a int) engine=ndb;
insert into t1 values(1, repeat('A', 400));
create table t3 (a int) engine=ndb;
insert into t1 value(1, repeat('A', 400));
flush logs;
Nothing to verify
Test multithreaded interleaved epochs and DDL
---------------------------------------------
Issue DDL and DML concurrently on server1
They will interleave in the Binlog according to Binlog mutex
interactions between DDL executing server thread and binlog injector

Check Binlog on DDL-source MySQLD to ensure that binlog index positions
'cover' the Binlog
Check Binlog on other MySQLD to ensure that binlog index positions
'cover' the Binlog (DDL here is 'fabricated' by Binlog injector thread

reset master;
reset master;
set sql_log_bin=0;
create table dmlload_stop (
value int primary key
);
create procedure dmlload ()
begin
declare stop int default 0;
repeat
start transaction;
insert into t1 values (2, repeat('I', 400));
commit;
start transaction;
update t1 set b=repeat('Z', 400) where a=2;
commit;
start transaction;
delete from t1 where a=2;
commit;
select value from dmlload_stop where value = 1 into stop;
until stop
end repeat;
end%
set sql_log_bin=1;
call dmlload();
insert into dmlload_stop values(1);
Now check binlog index vs binlog itself on Server1
flush logs;
Nothing to verify
Now check binlog index vs binlog itself on Server2
flush logs;
---------------------------------------------------------------------------
Mismatches between Binlog index next_pos and Binlog COMMIT event pos
---------------------------------------------------------------------------
epoch	calculated_pos	stored_pos
Done
drop procedure dmlload;
drop table dmlload_stop;
Cleanup
drop table t1;
drop table t2;
drop table t3;
Now restore original schema
reset master;
alter table mysql.ndb_binlog_index add column next_position bigint unsigned not null;
alter table mysql.ndb_binlog_index add column next_file varchar(255) not null;
reset master;
--------------------------------------
Quick test of ndb-log-empty-epochs = 1
--------------------------------------
select * from mysql.ndb_binlog_index order by epoch;
Position	File	epoch	inserts	updates	deletes	schemaops	orig_server_id	orig_epoch	gci	next_position	next_file
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
show variables like 'ndb_log_empty_epochs';
Variable_name	Value
ndb_log_empty_epochs	OFF
set global ndb_log_empty_epochs=1;
show variables like 'ndb_log_empty_epochs';
Variable_name	Value
ndb_log_empty_epochs	ON
Allow some empty epochs to pass...
Show that we have entries in ndb_binlog_index
select count(1) > 0 from mysql.ndb_binlog_index;
count(1) > 0
1
Show that all ndb_binlog_index entries have the same file + position
select bi1.epoch, bi1.Position, bi1.File, bi1.next_position, bi1.next_file,
bi2.epoch, bi2.Position, bi2.File, bi2.next_position, bi2.next_file
from mysql.ndb_binlog_index as bi1,
mysql.ndb_binlog_index as bi2
where
# Start and Next not same
bi1.Position != bi1.next_position OR
bi1.File != bi1.next_file OR
# All epochs not the same
bi1.Position != bi2.Position OR
bi1.File != bi2.File;
epoch	Position	File	next_position	next_file	epoch	Position	File	next_position	next_file
Show that we have no epochs in the Binlog
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
Disable
set global ndb_log_empty_epochs=0;