Skip to content

Commit b01baef

Browse files
Merge branch 'mysql-8.0' into mysql-trunk
Change-Id: I2c0a5b04e5b511dc7c9d892c38a77cb9b78ba829
2 parents f83f4d6 + 94148af commit b01baef

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

sql/rpl_replica.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5011,6 +5011,16 @@ static int exec_relay_log_event(THD *thd, Relay_log_info *rli,
50115011
return 1;
50125012
}
50135013

5014+
DBUG_EXECUTE_IF("wait_on_exec_relay_log_event", {
5015+
if (ev->get_type_code() == mysql::binlog::event::WRITE_ROWS_EVENT) {
5016+
const char act[] =
5017+
"now SIGNAL signal.waiting_on_event_execution "
5018+
"WAIT_FOR signal.can_continue_execution";
5019+
assert(opt_debug_sync_timeout > 0);
5020+
assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act)));
5021+
}
5022+
};);
5023+
50145024
/* ptr_ev can change to NULL indicating MTS coorinator passed to a Worker */
50155025
exec_res = apply_event_and_update_pos(ptr_ev, thd, rli);
50165026
/*

sql/sql_class.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3620,6 +3620,11 @@ void Transactional_ddl_context::init(dd::String_type db,
36203620
dd::String_type tablename,
36213621
const handlerton *hton) {
36223622
assert(m_hton == nullptr);
3623+
/*
3624+
Currently, Transactional_ddl_context is used only for CREATE TABLE ... START
3625+
TRANSACTION statement.
3626+
*/
3627+
assert(m_thd->lex->sql_command == SQLCOM_CREATE_TABLE);
36233628
m_db = db;
36243629
m_tablename = tablename;
36253630
m_hton = hton;
@@ -3631,7 +3636,15 @@ void Transactional_ddl_context::init(dd::String_type db,
36313636
*/
36323637
void Transactional_ddl_context::rollback() {
36333638
if (!inited()) return;
3639+
/*
3640+
Since the transaction is being rolledback, We need to unlock and close the
3641+
table belonging to this transaction.
3642+
*/
3643+
if (m_thd->lock) mysql_unlock_tables(m_thd, m_thd->lock);
3644+
m_thd->lock = nullptr;
3645+
if (m_thd->open_tables) close_thread_table(m_thd, &m_thd->open_tables);
36343646
table_cache_manager.lock_all_and_tdc();
3647+
36353648
TABLE_SHARE *share =
36363649
get_cached_table_share(m_db.c_str(), m_tablename.c_str());
36373650
if (share) {

0 commit comments

Comments
 (0)