diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 13 | ||||
-rw-r--r-- | sql/slave.cc | 2 | ||||
-rw-r--r-- | sql/sql_acl.cc | 27 | ||||
-rw-r--r-- | sql/sql_acl.h | 6 | ||||
-rw-r--r-- | sql/sql_base.cc | 12 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 |
7 files changed, 40 insertions, 24 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f27cc9f73bb..9e0dfe17f1b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -858,6 +858,9 @@ void clean_up(bool print_message) bitmap_free(&temp_pool); free_max_user_conn(); end_slave_list(); +#ifdef USE_REGEX + regex_end(); +#endif #if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY) if (!opt_bootstrap) @@ -1894,8 +1897,6 @@ int main(int argc, char **argv) if (!ssl_acceptor_fd) opt_use_ssl = 0; } - if (des_key_file) - load_des_key_file(des_key_file); #endif /* HAVE_OPENSSL */ #ifdef HAVE_LIBWRAP @@ -1968,6 +1969,10 @@ int main(int argc, char **argv) reset_floating_point_exceptions(); init_thr_lock(); init_slave_list(); +#ifdef HAVE_OPENSSL + if (des_key_file) + load_des_key_file(des_key_file); +#endif /* HAVE_OPENSSL */ /* Setup log files */ if (opt_log) @@ -2032,7 +2037,7 @@ int main(int argc, char **argv) exit(1); } start_signal_handler(); // Creates pidfile - if (acl_init(opt_noacl)) + if (acl_init((THD*) 0, opt_noacl)) { abort_loop=1; select_thread_in_use=0; @@ -2044,7 +2049,7 @@ int main(int argc, char **argv) exit(1); } if (!opt_noacl) - (void) grant_init(); + (void) grant_init((THD*) 0); init_max_user_conn(); init_update_queries(); diff --git a/sql/slave.cc b/sql/slave.cc index dd310b44c20..620523dd47f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1450,7 +1450,7 @@ bool flush_master_info(MASTER_INFO* mi) DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos)); my_b_seek(file, 0L); - my_b_printf(file, "%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n", + my_b_printf(file, "%s\n%s\n%s\n%s\n%s\n%d\n%d\n", mi->master_log_name, llstr(mi->master_log_pos, lbuf), mi->host, mi->user, mi->password, mi->port, mi->connect_retry diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 380b0e4fd87..1694e662b52 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -119,6 +119,7 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, SYNOPSIS acl_init() + thd Thread handler dont_read_acl_tables Set to 1 if run with --skip-grant RETURN VALUES @@ -127,9 +128,9 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname, */ -my_bool acl_init(bool dont_read_acl_tables) +my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) { - THD *thd, *org_thd; + THD *thd; TABLE_LIST tables[3]; TABLE *table; READ_RECORD read_record_info; @@ -147,7 +148,6 @@ my_bool acl_init(bool dont_read_acl_tables) /* To be able to run this from boot, we allocate a temporary THD */ - org_thd=current_thd; // Save for restore if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: inspected */ thd->store_globals(); @@ -339,6 +339,11 @@ end: delete thd; if (org_thd) org_thd->store_globals(); /* purecov: inspected */ + else + { + /* Remember that we don't have a THD */ + my_pthread_setspecific_ptr(THR_THD, 0); + } DBUG_RETURN(return_val); } @@ -385,7 +390,7 @@ void acl_reload(THD *thd) delete_dynamic(&acl_wild_hosts); hash_free(&acl_check_hosts); - if (acl_init(0)) + if (acl_init(thd, 0)) { // Error. Revert to old list acl_free(); /* purecov: inspected */ acl_hosts=old_acl_hosts; @@ -2273,9 +2278,9 @@ void grant_free(void) /* Init grant array if possible */ -my_bool grant_init(void) +my_bool grant_init(THD *org_thd) { - THD *thd, *org_thd; + THD *thd; TABLE_LIST tables[2]; MYSQL_LOCK *lock; my_bool return_val= 1; @@ -2291,7 +2296,6 @@ my_bool grant_init(void) if (!initialized) DBUG_RETURN(0); /* purecov: tested */ - org_thd=current_thd; if (!(thd=new THD)) DBUG_RETURN(1); /* purecov: deadcode */ thd->store_globals(); @@ -2349,13 +2353,18 @@ end: delete thd; if (org_thd) org_thd->store_globals(); + else + { + /* Remember that we don't have a THD */ + my_pthread_setspecific_ptr(THR_THD, 0); + } DBUG_RETURN(return_val); } /* Reload grant array if possible */ -void grant_reload(void) +void grant_reload(THD *thd) { HASH old_hash_tables;bool old_grant_option; MEM_ROOT old_mem; @@ -2369,7 +2378,7 @@ void grant_reload(void) old_grant_option = grant_option; old_mem = memex; - if (grant_init()) + if (grant_init(thd)) { // Error. Revert to old hash grant_free(); /* purecov: deadcode */ hash_tables=old_hash_tables; /* purecov: deadcode */ diff --git a/sql/sql_acl.h b/sql/sql_acl.h index 326a55ddd0c..6925b6b406c 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -81,7 +81,7 @@ /* prototypes */ -my_bool acl_init(bool dont_read_acl_tables); +my_bool acl_init(THD *thd, bool dont_read_acl_tables); void acl_reload(THD *thd); void acl_free(bool end=0); ulong acl_get(const char *host, const char *ip, const char *bin_ip, @@ -98,9 +98,9 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list, int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list, List <LEX_COLUMN> &column_list, ulong rights, bool revoke); -my_bool grant_init(void); +my_bool grant_init(THD *thd); void grant_free(void); -void grant_reload(void); +void grant_reload(THD *thd); bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, uint show_command=0, bool dont_print_error=0); bool check_grant_column (THD *thd,TABLE *table, const char *name, uint length, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 6c20ce88a99..fa967d645ef 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1513,11 +1513,13 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, TABLE *tmp_table; DBUG_ENTER("open_temporary_table"); - // the extra size in my_malloc() is for table_cache_key - // 4 bytes for master thread id if we are in the slave - // 1 byte to terminate db - // 1 byte to terminate table_name - // total of 6 extra bytes in my_malloc in addition to table/db stuff + /* + The extra size in my_malloc() is for table_cache_key + 4 bytes for master thread id if we are in the slave + 1 byte to terminate db + 1 byte to terminate table_name + total of 6 extra bytes in my_malloc in addition to table/db stuff + */ if (!(tmp_table=(TABLE*) my_malloc(sizeof(*tmp_table)+(uint) strlen(db)+ (uint) strlen(table_name)+6, MYF(MY_WME)))) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index bdc6ab16a0e..7416506fd02 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3351,7 +3351,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables) if (options & REFRESH_GRANT) { acl_reload(thd); - grant_reload(); + grant_reload(thd); if (mqh_used) reset_mqh(thd,(LEX_USER *) NULL,true); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1f365c9e8b9..b4d1fa802bb 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -662,7 +662,7 @@ change: { LEX *lex = Lex; lex->sql_command = SQLCOM_CHANGE_MASTER; - memset(&lex->mi, 0, sizeof(lex->mi)); + bzero((char*) &lex->mi, sizeof(lex->mi)); } master_defs; master_defs: |