Skip to content

Commit 495f1ec

Browse files
committed
MDEV-29621 manual merge from 10.4 -> 10.5
1. log_event.cc stuff should go into log_event_server.cc 2. the test's wait condition is textually different in 10.5, fixed. 3. pre-exec 'optimistic' global var value is correct for 10.5 indeed.
1 parent edf8ce5 commit 495f1ec

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

mysql-test/suite/rpl/r/rpl_parallel_seq.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ connection slave;
7474
include/stop_slave.inc
7575
SET debug_sync = RESET;
7676
SET @@global.slave_parallel_threads= 0;
77-
SET @@global.slave_parallel_mode= conservative;
77+
SET @@global.slave_parallel_mode= optimistic;
7878
SET @@global.debug_dbug = "";
7979
SET @@global.gtid_strict_mode=0;
8080
include/start_slave.inc

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ SET @@global.slave_parallel_mode=optimistic;
2828
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
2929
--source include/start_slave.inc
3030

31-
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit before starting%"
31+
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit"
3232
--source include/wait_condition.inc
3333
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
3434

sql/log_event_server.cc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7493,8 +7493,14 @@ Rows_log_event::write_row(rpl_group_info *rgi,
74937493
int Rows_log_event::update_sequence()
74947494
{
74957495
TABLE *table= m_table; // pointer to event's table
7496+
bool old_master= false;
7497+
int err= 0;
74967498

7497-
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO))
7499+
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO) ||
7500+
(!(table->in_use->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_DDL) &&
7501+
!(old_master=
7502+
rpl_master_has_bug(thd->rgi_slave->rli,
7503+
29621, FALSE, FALSE, FALSE, TRUE))))
74987504
{
74997505
/* This event come from a setval function executed on the master.
75007506
Update the sequence next_number and round, like we do with setval()
@@ -7507,12 +7513,27 @@ int Rows_log_event::update_sequence()
75077513

75087514
return table->s->sequence->set_value(table, nextval, round, 0) > 0;
75097515
}
7510-
7516+
if (thd->rgi_slave->is_parallel_exec && old_master)
7517+
{
7518+
DBUG_ASSERT(thd->rgi_slave->parallel_entry);
7519+
/*
7520+
With parallel replication enabled, we can't execute alongside any other
7521+
transaction in which we may depend, so we force retry to release
7522+
the server layer table lock for possible prior in binlog order
7523+
same table transactions.
7524+
*/
7525+
if (thd->rgi_slave->parallel_entry->last_committed_sub_id <
7526+
thd->rgi_slave->wait_commit_sub_id)
7527+
{
7528+
err= ER_LOCK_DEADLOCK;
7529+
my_error(err, MYF(0));
7530+
}
7531+
}
75117532
/*
75127533
Update all fields in table and update the active sequence, like with
75137534
ALTER SEQUENCE
75147535
*/
7515-
return table->file->ha_write_row(table->record[0]);
7536+
return err == 0 ? table->file->ha_write_row(table->record[0]) : err;
75167537
}
75177538

75187539

0 commit comments

Comments
 (0)