1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

More merge fixes:

- mdl.cc and mdl.h merged completely
- mysql_system_tables*.sql merged completely
- Fixed wrong merge of lock_tables
- Added some missing functions:
 - bool THD::notify_shared_lock()
 - Dynamic_array::pop, Dynamic_array::del
- Added MDL_context_owner to THD
- Added metadata_locks_hash_instances
This commit is contained in:
Michael Widenius
2013-06-16 21:26:40 +03:00
parent 7c1abe151c
commit 8075b05b7d
12 changed files with 543 additions and 211 deletions

View File

@@ -62,6 +62,7 @@
#include "debug_sync.h"
#include "sql_parse.h" // is_update_query
#include "sql_callback.h"
#include "lock.h"
#include "sql_connect.h"
/*
@@ -1788,6 +1789,46 @@ void THD::disconnect()
}
bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
bool needs_thr_lock_abort)
{
THD *in_use= ctx_in_use->get_thd();
bool signalled= FALSE;
if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
!in_use->killed)
{
in_use->killed= KILL_CONNECTION;
mysql_mutex_lock(&in_use->mysys_var->mutex);
if (in_use->mysys_var->current_cond)
mysql_cond_broadcast(in_use->mysys_var->current_cond);
mysql_mutex_unlock(&in_use->mysys_var->mutex);
signalled= TRUE;
}
if (needs_thr_lock_abort)
{
mysql_mutex_lock(&in_use->LOCK_thd_data);
for (TABLE *thd_table= in_use->open_tables;
thd_table ;
thd_table= thd_table->next)
{
/*
Check for TABLE::needs_reopen() is needed since in some places we call
handler::close() for table instance (and set TABLE::db_stat to 0)
and do not remove such instances from the THD::open_tables
for some time, during which other thread can see those instances
(e.g. see partitioning code).
*/
if (!thd_table->needs_reopen())
signalled|= mysql_lock_abort_for_thread(this, thd_table);
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
}
return signalled;
}
/*
Get error number for killed state
Note that the error message can't have any parameters.