diff options
author | Andrei <andrei.elkin@mariadb.com> | 2023-05-02 15:52:36 +0300 |
---|---|---|
committer | Andrei <andrei.elkin@mariadb.com> | 2023-05-02 15:52:36 +0300 |
commit | 495f1ecac20dd94719ec24332c4c56c806b54269 (patch) | |
tree | b29a870e07568fcbf9bbce71ee039d981d0254f1 | |
parent | edf8ce5b9741520cd5b3e559af2dd7cace6b4af9 (diff) | |
download | mariadb-git-495f1ecac20dd94719ec24332c4c56c806b54269.tar.gz |
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.
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_parallel_seq.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_parallel_seq.test | 2 | ||||
-rw-r--r-- | sql/log_event_server.cc | 27 |
3 files changed, 26 insertions, 5 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_seq.result b/mysql-test/suite/rpl/r/rpl_parallel_seq.result index 60061049ed4..ae4041f470d 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_seq.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_seq.result @@ -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 diff --git a/mysql-test/suite/rpl/t/rpl_parallel_seq.test b/mysql-test/suite/rpl/t/rpl_parallel_seq.test index 741859bc588..2a4fd96ff34 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_seq.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_seq.test @@ -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'; diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index f19bebd9863..b93c892dc02 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -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; } |