Skip to content

Commit ae79646

Browse files
author
Maitrayi Sabaratnam
committed
Bug#18845822 - DEADLOCK AND TIMEOUT IN BINLOG INJECTOR DUE TO WAITING FOR ITSELF
1 parent f9b522a commit ae79646

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
SET @start_value = @@global.max_binlog_size;
2+
set global max_binlog_size=8192;
3+
SELECT @@global.max_binlog_size;
4+
@@global.max_binlog_size
5+
8192
6+
create table test.t1 (a varchar(10000)) engine=ndb;
7+
insert into test.t1 values (repeat('B', 10000));
8+
show binlog events;
9+
insert into test.t1 values (repeat('B', 10000));
10+
show binlog events;
11+
insert into test.t1 values (repeat('B', 10000));
12+
show binlog events;
13+
insert into test.t1 values (repeat('B', 10000));
14+
show binlog events;
15+
insert into test.t1 values (repeat('B', 10000));
16+
show binlog events;
17+
insert into test.t1 values (repeat('B', 10000));
18+
show binlog events;
19+
insert into test.t1 values (repeat('B', 10000));
20+
show binlog events;
21+
insert into test.t1 values (repeat('B', 10000));
22+
show binlog events;
23+
insert into test.t1 values (repeat('B', 10000));
24+
show binlog events;
25+
insert into test.t1 values (repeat('B', 10000));
26+
show binlog events;
27+
insert into test.t1 values (repeat('B', 10000));
28+
show binlog events;
29+
insert into test.t1 values (repeat('B', 10000));
30+
show binlog events;
31+
insert into test.t1 values (repeat('B', 10000));
32+
show binlog events;
33+
insert into test.t1 values (repeat('B', 10000));
34+
show binlog events;
35+
insert into test.t1 values (repeat('B', 10000));
36+
show binlog events;
37+
insert into test.t1 values (repeat('B', 10000));
38+
show binlog events;
39+
insert into test.t1 values (repeat('B', 10000));
40+
show binlog events;
41+
insert into test.t1 values (repeat('B', 10000));
42+
show binlog events;
43+
insert into test.t1 values (repeat('B', 10000));
44+
show binlog events;
45+
insert into test.t1 values (repeat('B', 10000));
46+
show binlog events;
47+
insert into test.t1 values (repeat('B', 10000));
48+
show binlog events;
49+
insert into test.t1 values (repeat('B', 10000));
50+
show binlog events;
51+
insert into test.t1 values (repeat('B', 10000));
52+
show binlog events;
53+
insert into test.t1 values (repeat('B', 10000));
54+
show binlog events;
55+
insert into test.t1 values (repeat('B', 10000));
56+
show binlog events;
57+
insert into test.t1 values (repeat('B', 10000));
58+
show binlog events;
59+
insert into test.t1 values (repeat('B', 10000));
60+
show binlog events;
61+
insert into test.t1 values (repeat('B', 10000));
62+
show binlog events;
63+
insert into test.t1 values (repeat('B', 10000));
64+
show binlog events;
65+
insert into test.t1 values (repeat('B', 10000));
66+
show binlog events;
67+
insert into test.t1 values (repeat('B', 10000));
68+
show binlog events;
69+
insert into test.t1 values (repeat('B', 10000));
70+
show binlog events;
71+
insert into test.t1 values (repeat('B', 10000));
72+
show binlog events;
73+
insert into test.t1 values (repeat('B', 10000));
74+
show binlog events;
75+
insert into test.t1 values (repeat('B', 10000));
76+
show binlog events;
77+
drop table test.t1;
78+
set global max_binlog_size= @start_value;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-- source include/have_ndb.inc
2+
-- source include/have_binlog_format_mixed_or_row.inc
3+
4+
SET @start_value = @@global.max_binlog_size;
5+
set global max_binlog_size=8192;
6+
SELECT @@global.max_binlog_size;
7+
8+
create table test.t1 (a varchar(10000)) engine=ndb;
9+
10+
# Repeat in a loop enough to cause buggy code to exceed testcase timeout.
11+
# Fix for bug#18845822 will eliminate the timeout.
12+
13+
let $1=35;
14+
while ($1)
15+
{
16+
insert into test.t1 values (repeat('B', 10000));
17+
--disable_result_log
18+
show binlog events;
19+
--enable_result_log
20+
21+
dec $1;
22+
}
23+
24+
drop table test.t1;
25+
26+
set global max_binlog_size= @start_value;
27+

sql/ha_ndbcluster_binlog.cc

+8
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,14 @@ static void ndbcluster_binlog_wait(THD *thd)
501501
*/
502502
if (!wait_epoch)
503503
DBUG_VOID_RETURN;
504+
505+
/*
506+
Binlog Injector should not wait for itself
507+
*/
508+
if (thd &&
509+
thd->system_thread == SYSTEM_THREAD_NDBCLUSTER_BINLOG)
510+
DBUG_VOID_RETURN;
511+
504512
const char *save_info= thd ? thd->proc_info : 0;
505513
int count= 30;
506514
if (thd)

0 commit comments

Comments
 (0)