1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-15532 after-merge fixes from Monty

The Galera tests were massively failing with debug assertions.
This commit is contained in:
Marko Mäkelä
2020-12-02 16:16:29 +02:00
parent 589cf8dbf3
commit 24ec8eaf66
15 changed files with 22 additions and 22 deletions

View File

@ -471,9 +471,7 @@ dbcontext::close_tables_if()
unlock_tables_if();
DENA_VERBOSE(100, fprintf(stderr, "HNDSOCK close tables\n"));
close_thread_tables(thd);
#if MYSQL_VERSION_ID >= 50505
thd->mdl_context.release_transactional_locks();
#endif
thd->mdl_context.release_transactional_locks(thd);
if (!table_vec.empty()) {
statistic_increment(close_tables_count, &LOCK_status);
table_vec.clear();

View File

@ -3033,18 +3033,17 @@ void MDL_context::rollback_to_savepoint(const MDL_savepoint &mdl_savepoint)
implementation of COMMIT (implicit or explicit) and ROLLBACK.
*/
void MDL_context::release_transactional_locks()
void MDL_context::release_transactional_locks(THD *thd)
{
DBUG_ENTER("MDL_context::release_transactional_locks");
/* Fail if there are active transactions */
DBUG_ASSERT(!(current_thd->server_status &
DBUG_ASSERT(!(thd->server_status &
(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY)));
release_locks_stored_before(MDL_STATEMENT, NULL);
release_locks_stored_before(MDL_TRANSACTION, NULL);
DBUG_VOID_RETURN;
}
void MDL_context::release_statement_locks()
{
DBUG_ENTER("MDL_context::release_transactional_locks");

View File

@ -901,7 +901,7 @@ public:
void set_lock_duration(MDL_ticket *mdl_ticket, enum_mdl_duration duration);
void release_statement_locks();
void release_transactional_locks();
void release_transactional_locks(THD *thd);
void release_explicit_locks();
void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint);

View File

@ -733,7 +733,7 @@ end:
if (in_transaction)
thd->mdl_context.release_statement_locks();
else
thd->mdl_context.release_transactional_locks();
thd->release_transactional_locks();
}
thd->lex->restore_backup_query_tables_list(&lex_backup);
thd->variables.option_bits= thd_saved_option;

View File

@ -1675,7 +1675,7 @@ end:
{
*out_hton= table->s->db_type();
close_thread_tables(thd);
thd->mdl_context.release_transactional_locks();
thd->mdl_context.release_transactional_locks(thd);
}
return err;
}

View File

@ -1544,7 +1544,7 @@ void THD::cleanup(void)
and left the mode a few lines above), there will be outstanding
metadata locks. Release them.
*/
mdl_context.release_transactional_locks();
mdl_context.release_transactional_locks(this);
backup_end(this);
backup_unlock(this);

View File

@ -4579,7 +4579,7 @@ public:
{
if (!(server_status &
(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY)))
mdl_context.release_transactional_locks();
mdl_context.release_transactional_locks(this);
}
int decide_logging_format(TABLE_LIST *tables);
/*

View File

@ -2241,7 +2241,7 @@ public:
if (table)
{
close_thread_tables(&thd);
thd.mdl_context.release_transactional_locks();
thd.mdl_context.release_transactional_locks(&thd);
}
mysql_mutex_destroy(&mutex);
mysql_cond_destroy(&cond);

View File

@ -345,7 +345,7 @@ int Wsrep_client_service::bf_rollback()
{
m_thd->global_read_lock.unlock_global_read_lock(m_thd);
}
m_thd->mdl_context.release_transactional_locks();
m_thd->release_transactional_locks();
m_thd->mdl_context.release_explicit_locks();
DBUG_RETURN(ret);

View File

@ -274,7 +274,7 @@ int Wsrep_high_priority_service::append_fragment_and_commit(
ret= ret || trans_commit(m_thd);
m_thd->wsrep_cs().after_applying();
m_thd->mdl_context.release_transactional_locks();
m_thd->release_transactional_locks();
free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC));
@ -316,7 +316,7 @@ int Wsrep_high_priority_service::commit(const wsrep::ws_handle& ws_handle,
m_rgi->cleanup_context(thd, 0);
}
m_thd->mdl_context.release_transactional_locks();
m_thd->release_transactional_locks();
thd_proc_info(thd, "wsrep applier committed");
@ -354,7 +354,7 @@ int Wsrep_high_priority_service::rollback(const wsrep::ws_handle& ws_handle,
DBUG_ENTER("Wsrep_high_priority_service::rollback");
m_thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, false);
int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd));
m_thd->mdl_context.release_transactional_locks();
m_thd->release_transactional_locks();
m_thd->mdl_context.release_explicit_locks();
free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC));

View File

@ -1187,7 +1187,7 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key
if (!WSREP(thd) || !WSREP_CLIENT(thd)) return;
TABLE_LIST *table;
thd->mdl_context.release_transactional_locks();
thd->release_transactional_locks();
uint counter;
MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();

View File

@ -855,7 +855,7 @@ Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const {
close_thread_tables(thd);
}
}
thd->mdl_context.release_transactional_locks();
thd->release_transactional_locks();
thd->variables.wsrep_sync_wait= wsrep_sync_wait_saved;

View File

@ -248,7 +248,7 @@ void Wsrep_server_service::log_view(
WSREP_WARN("Failed to commit transaction for store view");
}
}
applier->m_thd->mdl_context.release_transactional_locks();
applier->m_thd->release_transactional_locks();
}
/*

View File

@ -176,7 +176,7 @@ int Wsrep_storage_service::commit(const wsrep::ws_handle& ws_handle,
trans_rollback(m_thd);
}
m_thd->wsrep_cs().after_applying();
m_thd->mdl_context.release_transactional_locks();
m_thd->release_transactional_locks();
DBUG_RETURN(ret);
}
@ -191,7 +191,7 @@ int Wsrep_storage_service::rollback(const wsrep::ws_handle& ws_handle,
ws_handle, ws_meta, false) ||
trans_rollback(m_thd));
m_thd->wsrep_cs().after_applying();
m_thd->mdl_context.release_transactional_locks();
m_thd->release_transactional_locks();
DBUG_RETURN(ret);
}

View File

@ -399,6 +399,7 @@ static bool xa_trans_force_rollback(THD *thd)
xid_cache_delete(thd, &thd->transaction.xid_state);
trans_track_end_trx(thd);
thd->mdl_context.release_transactional_locks(thd);
return rc;
}
@ -603,7 +604,7 @@ bool trans_xa_commit(THD *thd)
xid_cache_delete(thd, &thd->transaction.xid_state);
trans_track_end_trx(thd);
thd->mdl_context.release_transactional_locks();
thd->mdl_context.release_transactional_locks(thd);
DBUG_RETURN(res);
}
@ -677,6 +678,8 @@ bool trans_xa_detach(THD *thd)
thd->transaction.all.no_2pc= 0;
thd->server_status&= ~(SERVER_STATUS_IN_TRANS |
SERVER_STATUS_IN_TRANS_READONLY);
thd->mdl_context.release_transactional_locks(thd);
return false;
#endif
}