diff options
author | unknown <konstantin@mysql.com> | 2005-11-23 21:20:31 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-11-23 21:20:31 +0300 |
commit | 1c313f036856cfb6bffd4121358b8c2114004955 (patch) | |
tree | fbc181c37c03bc1c6c29d487df66847a1d4cda78 | |
parent | aa4da5f7429ac8506da89614ae94ff42e30e33e4 (diff) | |
parent | 0633a41c154fdf4f38880072b6f9356b2d6c2bd8 (diff) | |
download | mariadb-git-1c313f036856cfb6bffd4121358b8c2114004955.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/opt/local/work/mysql-5.0-root
sql/sql_class.cc:
Auto merged
-rw-r--r-- | sql/slave.cc | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 2 | ||||
-rw-r--r-- | sql/sql_class.cc | 6 | ||||
-rw-r--r-- | sql/sql_insert.cc | 1 | ||||
-rw-r--r-- | sql/sql_parse.cc | 6 | ||||
-rw-r--r-- | sql/sql_udf.cc | 1 | ||||
-rw-r--r-- | sql/tztime.cc | 1 |
7 files changed, 17 insertions, 2 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 065d9c787ce..5e1c838730c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3446,6 +3446,7 @@ slave_begin: THD_CHECK_SENTRY(thd); pthread_detach_this_thread(); + thd->thread_stack= (char*) &thd; // remember where our stack is if (init_slave_thread(thd, SLAVE_THD_IO)) { pthread_cond_broadcast(&mi->start_cond); @@ -3454,7 +3455,6 @@ slave_begin: goto err; } mi->io_thd = thd; - thd->thread_stack = (char*)&thd; // remember where our stack is pthread_mutex_lock(&LOCK_thread_count); threads.append(thd); pthread_mutex_unlock(&LOCK_thread_count); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a572f03b575..46be74ae972 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -158,6 +158,7 @@ my_bool acl_init(bool dont_read_acl_tables) */ if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: inspected */ + thd->thread_stack= (char*) &thd; thd->store_globals(); /* It is safe to call acl_reload() since acl_* arrays and hashes which @@ -3263,6 +3264,7 @@ my_bool grant_init() if (!(thd= new THD)) DBUG_RETURN(1); /* purecov: deadcode */ + thd->thread_stack= (char*) &thd; thd->store_globals(); return_val= grant_reload(thd); delete thd; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index a0d87b05e97..b65f353e492 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -517,6 +517,12 @@ void THD::awake(THD::killed_state state_to_set) bool THD::store_globals() { + /* + Assert that thread_stack is initialized: it's necessary to be able + to track stack overrun. + */ + DBUG_ASSERT(this->thread_stack); + if (my_pthread_setspecific_ptr(THR_THD, this) || my_pthread_setspecific_ptr(THR_MALLOC, &mem_root)) return 1; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 088b55c2fd8..5e9ca203632 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1723,6 +1723,7 @@ pthread_handler_t handle_delayed_insert(void *arg) #endif DBUG_ENTER("handle_delayed_insert"); + thd->thread_stack= (char*) &thd; if (init_thr_lock() || thd->store_globals()) { thd->fatal_error(); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d06cceba77b..86f884c101a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1097,6 +1097,7 @@ pthread_handler_t handle_one_connection(void *arg) VOID(sigemptyset(&set)); // Get mask in use VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals)); #endif + thd->thread_stack= (char*) &thd; if (thd->store_globals()) { close_connection(thd, ER_OUT_OF_RESOURCES, 1); @@ -1110,7 +1111,6 @@ pthread_handler_t handle_one_connection(void *arg) int error; NET *net= &thd->net; Security_context *sctx= thd->security_ctx; - thd->thread_stack= (char*) &thd; net->no_send_error= 0; if ((error=check_connection(thd))) @@ -5288,6 +5288,7 @@ bool check_stack_overrun(THD *thd, long margin, char *buf __attribute__((unused))) { long stack_used; + DBUG_ASSERT(thd == current_thd); if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >= (long) (thread_stack - margin)) { @@ -6737,7 +6738,10 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, allocate temporary THD for execution of acl_reload()/grant_reload(). */ if (!thd && (thd= (tmp_thd= new THD))) + { + thd->thread_stack= (char*) &tmp_thd; thd->store_globals(); + } if (thd) { (void)acl_reload(thd); diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index ba3c598a784..40e5a9a00cf 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -159,6 +159,7 @@ void udf_init() DBUG_VOID_RETURN; } initialized = 1; + new_thd->thread_stack= (char*) &new_thd; new_thd->store_globals(); new_thd->db= my_strdup("mysql", MYF(0)); new_thd->db_length=5; diff --git a/sql/tztime.cc b/sql/tztime.cc index 1d06d4d0b8e..e73d3f237ad 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1532,6 +1532,7 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) */ if (!(thd= new THD)) DBUG_RETURN(1); + thd->thread_stack= (char*) &thd; thd->store_globals(); /* Init all memory structures that require explicit destruction */ |