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:
@ -471,9 +471,7 @@ dbcontext::close_tables_if()
|
|||||||
unlock_tables_if();
|
unlock_tables_if();
|
||||||
DENA_VERBOSE(100, fprintf(stderr, "HNDSOCK close tables\n"));
|
DENA_VERBOSE(100, fprintf(stderr, "HNDSOCK close tables\n"));
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
#if MYSQL_VERSION_ID >= 50505
|
thd->mdl_context.release_transactional_locks(thd);
|
||||||
thd->mdl_context.release_transactional_locks();
|
|
||||||
#endif
|
|
||||||
if (!table_vec.empty()) {
|
if (!table_vec.empty()) {
|
||||||
statistic_increment(close_tables_count, &LOCK_status);
|
statistic_increment(close_tables_count, &LOCK_status);
|
||||||
table_vec.clear();
|
table_vec.clear();
|
||||||
|
@ -3033,18 +3033,17 @@ void MDL_context::rollback_to_savepoint(const MDL_savepoint &mdl_savepoint)
|
|||||||
implementation of COMMIT (implicit or explicit) and ROLLBACK.
|
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");
|
DBUG_ENTER("MDL_context::release_transactional_locks");
|
||||||
/* Fail if there are active transactions */
|
/* 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)));
|
(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY)));
|
||||||
release_locks_stored_before(MDL_STATEMENT, NULL);
|
release_locks_stored_before(MDL_STATEMENT, NULL);
|
||||||
release_locks_stored_before(MDL_TRANSACTION, NULL);
|
release_locks_stored_before(MDL_TRANSACTION, NULL);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MDL_context::release_statement_locks()
|
void MDL_context::release_statement_locks()
|
||||||
{
|
{
|
||||||
DBUG_ENTER("MDL_context::release_transactional_locks");
|
DBUG_ENTER("MDL_context::release_transactional_locks");
|
||||||
|
@ -901,7 +901,7 @@ public:
|
|||||||
void set_lock_duration(MDL_ticket *mdl_ticket, enum_mdl_duration duration);
|
void set_lock_duration(MDL_ticket *mdl_ticket, enum_mdl_duration duration);
|
||||||
|
|
||||||
void release_statement_locks();
|
void release_statement_locks();
|
||||||
void release_transactional_locks();
|
void release_transactional_locks(THD *thd);
|
||||||
void release_explicit_locks();
|
void release_explicit_locks();
|
||||||
void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint);
|
void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint);
|
||||||
|
|
||||||
|
@ -733,7 +733,7 @@ end:
|
|||||||
if (in_transaction)
|
if (in_transaction)
|
||||||
thd->mdl_context.release_statement_locks();
|
thd->mdl_context.release_statement_locks();
|
||||||
else
|
else
|
||||||
thd->mdl_context.release_transactional_locks();
|
thd->release_transactional_locks();
|
||||||
}
|
}
|
||||||
thd->lex->restore_backup_query_tables_list(&lex_backup);
|
thd->lex->restore_backup_query_tables_list(&lex_backup);
|
||||||
thd->variables.option_bits= thd_saved_option;
|
thd->variables.option_bits= thd_saved_option;
|
||||||
|
@ -1675,7 +1675,7 @@ end:
|
|||||||
{
|
{
|
||||||
*out_hton= table->s->db_type();
|
*out_hton= table->s->db_type();
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
thd->mdl_context.release_transactional_locks();
|
thd->mdl_context.release_transactional_locks(thd);
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1544,7 +1544,7 @@ void THD::cleanup(void)
|
|||||||
and left the mode a few lines above), there will be outstanding
|
and left the mode a few lines above), there will be outstanding
|
||||||
metadata locks. Release them.
|
metadata locks. Release them.
|
||||||
*/
|
*/
|
||||||
mdl_context.release_transactional_locks();
|
mdl_context.release_transactional_locks(this);
|
||||||
|
|
||||||
backup_end(this);
|
backup_end(this);
|
||||||
backup_unlock(this);
|
backup_unlock(this);
|
||||||
|
@ -4579,7 +4579,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (!(server_status &
|
if (!(server_status &
|
||||||
(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY)))
|
(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);
|
int decide_logging_format(TABLE_LIST *tables);
|
||||||
/*
|
/*
|
||||||
|
@ -2241,7 +2241,7 @@ public:
|
|||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
close_thread_tables(&thd);
|
close_thread_tables(&thd);
|
||||||
thd.mdl_context.release_transactional_locks();
|
thd.mdl_context.release_transactional_locks(&thd);
|
||||||
}
|
}
|
||||||
mysql_mutex_destroy(&mutex);
|
mysql_mutex_destroy(&mutex);
|
||||||
mysql_cond_destroy(&cond);
|
mysql_cond_destroy(&cond);
|
||||||
|
@ -345,7 +345,7 @@ int Wsrep_client_service::bf_rollback()
|
|||||||
{
|
{
|
||||||
m_thd->global_read_lock.unlock_global_read_lock(m_thd);
|
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();
|
m_thd->mdl_context.release_explicit_locks();
|
||||||
|
|
||||||
DBUG_RETURN(ret);
|
DBUG_RETURN(ret);
|
||||||
|
@ -274,7 +274,7 @@ int Wsrep_high_priority_service::append_fragment_and_commit(
|
|||||||
ret= ret || trans_commit(m_thd);
|
ret= ret || trans_commit(m_thd);
|
||||||
|
|
||||||
m_thd->wsrep_cs().after_applying();
|
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));
|
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_rgi->cleanup_context(thd, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_thd->mdl_context.release_transactional_locks();
|
m_thd->release_transactional_locks();
|
||||||
|
|
||||||
thd_proc_info(thd, "wsrep applier committed");
|
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");
|
DBUG_ENTER("Wsrep_high_priority_service::rollback");
|
||||||
m_thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, false);
|
m_thd->wsrep_cs().prepare_for_ordering(ws_handle, ws_meta, false);
|
||||||
int ret= (trans_rollback_stmt(m_thd) || trans_rollback(m_thd));
|
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();
|
m_thd->mdl_context.release_explicit_locks();
|
||||||
|
|
||||||
free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC));
|
free_root(m_thd->mem_root, MYF(MY_KEEP_PREALLOC));
|
||||||
|
@ -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;
|
if (!WSREP(thd) || !WSREP_CLIENT(thd)) return;
|
||||||
TABLE_LIST *table;
|
TABLE_LIST *table;
|
||||||
|
|
||||||
thd->mdl_context.release_transactional_locks();
|
thd->release_transactional_locks();
|
||||||
uint counter;
|
uint counter;
|
||||||
MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
|
MDL_savepoint mdl_savepoint= thd->mdl_context.mdl_savepoint();
|
||||||
|
|
||||||
|
@ -855,7 +855,7 @@ Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const {
|
|||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thd->mdl_context.release_transactional_locks();
|
thd->release_transactional_locks();
|
||||||
|
|
||||||
thd->variables.wsrep_sync_wait= wsrep_sync_wait_saved;
|
thd->variables.wsrep_sync_wait= wsrep_sync_wait_saved;
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ void Wsrep_server_service::log_view(
|
|||||||
WSREP_WARN("Failed to commit transaction for store view");
|
WSREP_WARN("Failed to commit transaction for store view");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
applier->m_thd->mdl_context.release_transactional_locks();
|
applier->m_thd->release_transactional_locks();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -176,7 +176,7 @@ int Wsrep_storage_service::commit(const wsrep::ws_handle& ws_handle,
|
|||||||
trans_rollback(m_thd);
|
trans_rollback(m_thd);
|
||||||
}
|
}
|
||||||
m_thd->wsrep_cs().after_applying();
|
m_thd->wsrep_cs().after_applying();
|
||||||
m_thd->mdl_context.release_transactional_locks();
|
m_thd->release_transactional_locks();
|
||||||
DBUG_RETURN(ret);
|
DBUG_RETURN(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ int Wsrep_storage_service::rollback(const wsrep::ws_handle& ws_handle,
|
|||||||
ws_handle, ws_meta, false) ||
|
ws_handle, ws_meta, false) ||
|
||||||
trans_rollback(m_thd));
|
trans_rollback(m_thd));
|
||||||
m_thd->wsrep_cs().after_applying();
|
m_thd->wsrep_cs().after_applying();
|
||||||
m_thd->mdl_context.release_transactional_locks();
|
m_thd->release_transactional_locks();
|
||||||
DBUG_RETURN(ret);
|
DBUG_RETURN(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +399,7 @@ static bool xa_trans_force_rollback(THD *thd)
|
|||||||
xid_cache_delete(thd, &thd->transaction.xid_state);
|
xid_cache_delete(thd, &thd->transaction.xid_state);
|
||||||
|
|
||||||
trans_track_end_trx(thd);
|
trans_track_end_trx(thd);
|
||||||
|
thd->mdl_context.release_transactional_locks(thd);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -603,7 +604,7 @@ bool trans_xa_commit(THD *thd)
|
|||||||
xid_cache_delete(thd, &thd->transaction.xid_state);
|
xid_cache_delete(thd, &thd->transaction.xid_state);
|
||||||
|
|
||||||
trans_track_end_trx(thd);
|
trans_track_end_trx(thd);
|
||||||
thd->mdl_context.release_transactional_locks();
|
thd->mdl_context.release_transactional_locks(thd);
|
||||||
|
|
||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
@ -677,6 +678,8 @@ bool trans_xa_detach(THD *thd)
|
|||||||
thd->transaction.all.no_2pc= 0;
|
thd->transaction.all.no_2pc= 0;
|
||||||
thd->server_status&= ~(SERVER_STATUS_IN_TRANS |
|
thd->server_status&= ~(SERVER_STATUS_IN_TRANS |
|
||||||
SERVER_STATUS_IN_TRANS_READONLY);
|
SERVER_STATUS_IN_TRANS_READONLY);
|
||||||
|
thd->mdl_context.release_transactional_locks(thd);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user