summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-08-22 16:45:25 +0200
committerSergei Golubchik <sergii@pisem.net>2012-08-22 16:45:25 +0200
commitf72a7659976089dc6f727bb31e8a91306199cf57 (patch)
tree0199cd1bf1c16b01b358ab88e5dce5b038349872 /sql/sql_class.cc
parented06ba3492d55c9e9dde231b55352f854e5e4b50 (diff)
parent1fd8150a5b5e3f56aa3c253225929a07ee9a4026 (diff)
downloadmariadb-git-f72a7659976089dc6f727bb31e8a91306199cf57.tar.gz
5.2 merge.
two tests still fail: main.innodb_icp and main.range_vs_index_merge_innodb call records_in_range() with both range ends being open (which triggers an assert)
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index dd5e02a5d88..8d24e8a83e0 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -425,6 +425,7 @@ extern "C"
char *thd_security_context(THD *thd, char *buffer, unsigned int length,
unsigned int max_query_len)
{
+ DEBUG_SYNC(thd, "thd_security_context");
String str(buffer, length, &my_charset_latin1);
const Security_context *sctx= &thd->main_security_ctx;
char header[64];
@@ -663,7 +664,7 @@ Diagnostics_area::disable_status()
THD::THD()
:Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
/* statement id */ 0),
- Open_tables_state(refresh_version), rli_fake(0),
+ Open_tables_state(refresh_version), rli_fake(NULL), rli_slave(NULL),
lock_id(&main_lock_id),
in_sub_stmt(0),
sql_log_bin_toplevel(false), log_all_errors(0),
@@ -769,6 +770,7 @@ THD::THD()
pthread_mutex_init(&LOCK_thd_data, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&LOCK_wakeup_ready, MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_wakeup_ready, 0);
+ pthread_mutex_init(&LOCK_thd_kill, MY_MUTEX_INIT_FAST);
/* Variables with default values */
proc_info="login";
@@ -1141,6 +1143,8 @@ THD::~THD()
/* Ensure that no one is using THD */
pthread_mutex_lock(&LOCK_thd_data);
pthread_mutex_unlock(&LOCK_thd_data);
+ pthread_mutex_lock(&LOCK_thd_kill);
+ pthread_mutex_unlock(&LOCK_thd_kill);
add_to_status(&global_status_var, &status_var);
/* Close connection */
@@ -1171,6 +1175,7 @@ THD::~THD()
pthread_cond_destroy(&COND_wakeup_ready);
pthread_mutex_destroy(&LOCK_wakeup_ready);
pthread_mutex_destroy(&LOCK_thd_data);
+ pthread_mutex_destroy(&LOCK_thd_kill);
#ifndef DBUG_OFF
dbug_sentry= THD_SENTRY_GONE;
#endif
@@ -1180,6 +1185,8 @@ THD::~THD()
delete rli_fake;
rli_fake= NULL;
}
+ if (rli_slave)
+ rli_slave->cleanup_after_session();
#endif
free_root(&main_mem_root, MYF(0));
@@ -1270,9 +1277,11 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
void THD::awake(killed_state state_to_set)
{
DBUG_ENTER("THD::awake");
- DBUG_PRINT("enter", ("this: 0x%lx", (long) this));
+ DBUG_PRINT("enter", ("this: 0x%lx thread_id=%lu killed_state=%d",
+ (long) this, thread_id, state_to_set));
THD_CHECK_SENTRY(this);
- safe_mutex_assert_owner(&LOCK_thd_data);
+ safe_mutex_assert_not_owner(&LOCK_thd_data);
+ safe_mutex_assert_owner(&LOCK_thd_kill);
if (global_system_variables.log_warnings > 3)
{
@@ -1302,7 +1311,9 @@ void THD::awake(killed_state state_to_set)
hack is not used.
*/
+ pthread_mutex_lock(&LOCK_thd_data);
close_active_vio();
+ pthread_mutex_unlock(&LOCK_thd_data);
}
#endif
}
@@ -1523,6 +1534,10 @@ void THD::cleanup_after_query()
/* reset table map for multi-table update */
table_map_for_update= 0;
m_binlog_invoker= FALSE;
+#ifndef EMBEDDED_LIBRARY
+ if (rli_slave)
+ rli_slave->cleanup_after_query();
+#endif
}