Skip to content

Commit b511096

Browse files
committed
MDEV-10630 rpl.rpl_mdev6020 fails in buildbot with timeout
The issue was that when running with valgrind the wait for master_pos_Wait() was not long enough. This patch also fixes two other failures that could affect rpl_mdev6020: - check_if_conflicting_replication_locks() didn't properly check domains - 'did_mark_start_commit' was after signals to other threads was sent which could get the variable read too early.
1 parent 5932fa7 commit b511096

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

client/mysqltest.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ static uint my_end_arg= 0;
181181
static uint opt_tail_lines= 0;
182182

183183
static uint opt_connect_timeout= 0;
184+
static uint opt_wait_for_pos_timeout= 0;
184185

185186
static char delimiter[MAX_DELIMITER_LENGTH]= ";";
186187
static uint delimiter_length= 1;
@@ -4659,7 +4660,7 @@ void do_sync_with_master2(struct st_command *command, long offset,
46594660
MYSQL_ROW row;
46604661
MYSQL *mysql= cur_con->mysql;
46614662
char query_buf[FN_REFLEN+128];
4662-
int timeout= 300; /* seconds */
4663+
int timeout= opt_wait_for_pos_timeout;
46634664

46644665
if (!master_pos.file[0])
46654666
die("Calling 'sync_with_master' without calling 'save_master_pos'");
@@ -7098,6 +7099,10 @@ static struct my_option my_long_options[] =
70987099
"Number of seconds before connection timeout.",
70997100
&opt_connect_timeout, &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
71007101
120, 0, 3600 * 12, 0, 0, 0},
7102+
{"wait_for_pos_timeout", 0,
7103+
"Number of seconds to wait for master_pos_wait",
7104+
&opt_wait_for_pos_timeout, &opt_wait_for_pos_timeout, 0, GET_UINT,
7105+
REQUIRED_ARG, 300, 0, 3600 * 12, 0, 0, 0},
71017106
{"plugin_dir", 0, "Directory for client-side plugins.",
71027107
&opt_plugin_dir, &opt_plugin_dir, 0,
71037108
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

mysql-test/mysql-test-run.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5899,7 +5899,7 @@ ($)
58995899
{
59005900
# We are running server under valgrind, which causes some replication
59015901
# test to be much slower, notable rpl_mdev6020. Increase timeout.
5902-
mtr_add_arg($args, "--wait-for-pos-timeout=1500");
5902+
mtr_add_arg($args, "--wait-for-pos-timeout=0");
59035903
}
59045904

59055905
if ( $opt_ssl )

mysql-test/suite/rpl/t/rpl_mdev6020.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# Running this with valgrind can take > 5000 seconds with xtradb
2+
--source include/not_valgrind.inc
3+
14
--source include/have_innodb.inc
25
--source include/have_partition.inc
36
--source include/have_binlog_format_mixed_or_row.inc
47
--source include/master-slave.inc
5-
68
--connection slave
79
--source include/stop_slave.inc
810

sql/mdl.cc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,9 @@ class MDL_lock
443443
virtual void notify_conflicting_locks(MDL_context *ctx) = 0;
444444

445445
virtual bitmap_t hog_lock_types_bitmap() const = 0;
446+
#ifndef DBUG_OFF
446447
bool check_if_conflicting_replication_locks(MDL_context *ctx);
448+
#endif
447449

448450
/** List of granted tickets for this lock. */
449451
Ticket_list m_granted;
@@ -2303,32 +2305,42 @@ void MDL_scoped_lock::notify_conflicting_locks(MDL_context *ctx)
23032305
and trying to get an exclusive lock for the table.
23042306
*/
23052307

2308+
#ifndef DBUG_OFF
23062309
bool MDL_lock::check_if_conflicting_replication_locks(MDL_context *ctx)
23072310
{
23082311
Ticket_iterator it(m_granted);
23092312
MDL_ticket *conflicting_ticket;
2313+
rpl_group_info *rgi_slave= ctx->get_thd()->rgi_slave;
2314+
2315+
if (!rgi_slave->gtid_sub_id)
2316+
return 0;
23102317

23112318
while ((conflicting_ticket= it++))
23122319
{
23132320
if (conflicting_ticket->get_ctx() != ctx)
23142321
{
23152322
MDL_context *conflicting_ctx= conflicting_ticket->get_ctx();
2323+
rpl_group_info *conflicting_rgi_slave;
2324+
conflicting_rgi_slave= conflicting_ctx->get_thd()->rgi_slave;
23162325

23172326
/*
23182327
If the conflicting thread is another parallel replication
23192328
thread for the same master and it's not in commit stage, then
23202329
the current transaction has started too early and something is
23212330
seriously wrong.
23222331
*/
2323-
if (conflicting_ctx->get_thd()->rgi_slave &&
2324-
conflicting_ctx->get_thd()->rgi_slave->rli ==
2325-
ctx->get_thd()->rgi_slave->rli &&
2326-
!conflicting_ctx->get_thd()->rgi_slave->did_mark_start_commit)
2332+
if (conflicting_rgi_slave &&
2333+
conflicting_rgi_slave->gtid_sub_id &&
2334+
conflicting_rgi_slave->rli == rgi_slave->rli &&
2335+
conflicting_rgi_slave->current_gtid.domain_id ==
2336+
rgi_slave->current_gtid.domain_id &&
2337+
!conflicting_rgi_slave->did_mark_start_commit)
23272338
return 1; // Fatal error
23282339
}
23292340
}
23302341
return 0;
23312342
}
2343+
#endif
23322344

23332345

23342346
/**

sql/rpl_rli.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,8 +1921,8 @@ rpl_group_info::mark_start_commit_no_lock()
19211921
{
19221922
if (did_mark_start_commit)
19231923
return;
1924-
mark_start_commit_inner(parallel_entry, gco, this);
19251924
did_mark_start_commit= true;
1925+
mark_start_commit_inner(parallel_entry, gco, this);
19261926
}
19271927

19281928

@@ -1933,12 +1933,12 @@ rpl_group_info::mark_start_commit()
19331933

19341934
if (did_mark_start_commit)
19351935
return;
1936+
did_mark_start_commit= true;
19361937

19371938
e= this->parallel_entry;
19381939
mysql_mutex_lock(&e->LOCK_parallel_entry);
19391940
mark_start_commit_inner(e, gco, this);
19401941
mysql_mutex_unlock(&e->LOCK_parallel_entry);
1941-
did_mark_start_commit= true;
19421942
}
19431943

19441944

@@ -1981,12 +1981,12 @@ rpl_group_info::unmark_start_commit()
19811981

19821982
if (!did_mark_start_commit)
19831983
return;
1984+
did_mark_start_commit= false;
19841985

19851986
e= this->parallel_entry;
19861987
mysql_mutex_lock(&e->LOCK_parallel_entry);
19871988
--e->count_committing_event_groups;
19881989
mysql_mutex_unlock(&e->LOCK_parallel_entry);
1989-
did_mark_start_commit= false;
19901990
}
19911991

19921992

0 commit comments

Comments
 (0)