Commit 495f1eca authored by Andrei's avatar Andrei

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.
parent edf8ce5b
......@@ -74,7 +74,7 @@ connection slave;
include/stop_slave.inc
SET debug_sync = RESET;
SET @@global.slave_parallel_threads= 0;
SET @@global.slave_parallel_mode= conservative;
SET @@global.slave_parallel_mode= optimistic;
SET @@global.debug_dbug = "";
SET @@global.gtid_strict_mode=0;
include/start_slave.inc
......
......@@ -28,7 +28,7 @@ SET @@global.slave_parallel_mode=optimistic;
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
--source include/start_slave.inc
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit before starting%"
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit"
--source include/wait_condition.inc
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
......
......@@ -7493,8 +7493,14 @@ Rows_log_event::write_row(rpl_group_info *rgi,
int Rows_log_event::update_sequence()
{
TABLE *table= m_table; // pointer to event's table
bool old_master= false;
int err= 0;
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO))
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO) ||
(!(table->in_use->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_DDL) &&
!(old_master=
rpl_master_has_bug(thd->rgi_slave->rli,
29621, FALSE, FALSE, FALSE, TRUE))))
{
/* This event come from a setval function executed on the master.
Update the sequence next_number and round, like we do with setval()
......@@ -7507,12 +7513,27 @@ int Rows_log_event::update_sequence()
return table->s->sequence->set_value(table, nextval, round, 0) > 0;
}
if (thd->rgi_slave->is_parallel_exec && old_master)
{
DBUG_ASSERT(thd->rgi_slave->parallel_entry);
/*
With parallel replication enabled, we can't execute alongside any other
transaction in which we may depend, so we force retry to release
the server layer table lock for possible prior in binlog order
same table transactions.
*/
if (thd->rgi_slave->parallel_entry->last_committed_sub_id <
thd->rgi_slave->wait_commit_sub_id)
{
err= ER_LOCK_DEADLOCK;
my_error(err, MYF(0));
}
}
/*
Update all fields in table and update the active sequence, like with
ALTER SEQUENCE
*/
return table->file->ha_write_row(table->record[0]);
return err == 0 ? table->file->ha_write_row(table->record[0]) : err;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment