diff options
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index cc178a3121b..9c878f246e4 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -195,6 +195,7 @@ THD::THD() file_id = 0; warn_id= 0; db_charset= global_system_variables.collation_database; + bzero(ha_data, sizeof(ha_data)); mysys_var=0; #ifndef DBUG_OFF dbug_sentry=THD_SENTRY_MAGIC; @@ -206,7 +207,6 @@ THD::THD() ull=0; system_thread= cleanup_done= abort_on_warning= 0; peer_port= 0; // For SHOW PROCESSLIST - transaction.changed_tables = 0; #ifdef __WIN__ real_id = 0; #endif @@ -241,9 +241,7 @@ THD::THD() /* For user vars replication*/ if (opt_bin_log) my_init_dynamic_array(&user_var_events, - sizeof(BINLOG_USER_VAR_EVENT *), - 16, - 16); + sizeof(BINLOG_USER_VAR_EVENT *), 16, 16); else bzero((char*) &user_var_events, sizeof(user_var_events)); @@ -253,26 +251,8 @@ THD::THD() protocol_prep.init(this); tablespace_op=FALSE; -#ifdef USING_TRANSACTIONS - bzero((char*) &transaction,sizeof(transaction)); - /* - Binlog is always open (if needed) before a THD is created (including - bootstrap). - */ - if (opt_using_transactions && mysql_bin_log.is_open()) - { - if (open_cached_file(&transaction.trans_log, - mysql_tmpdir, LOG_PREFIX, binlog_cache_size, - MYF(MY_WME))) - killed= KILL_CONNECTION; - transaction.trans_log.end_of_file= max_binlog_cache_size; - } -#endif - init_sql_alloc(&transaction.mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0); - { ulong tmp=sql_rnd_with_mutex(); randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id); - } } @@ -321,9 +301,12 @@ void THD::init_for_queries() reset_root_defaults(mem_root, variables.query_alloc_block_size, variables.query_prealloc_size); +#ifdef USING_TRANSACTIONS reset_root_defaults(&transaction.mem_root, variables.trans_alloc_block_size, variables.trans_prealloc_size); +#endif + transaction.xid.null(); } @@ -408,13 +391,8 @@ THD::~THD() #endif if (!cleanup_done) cleanup(); -#ifdef USING_TRANSACTIONS - if (opt_using_transactions) - { - close_cached_file(&transaction.trans_log); + ha_close_connection(this); - } -#endif sp_cache_clear(&sp_proc_cache); sp_cache_clear(&sp_func_cache); @@ -427,7 +405,9 @@ THD::~THD() safeFree(ip); safeFree(db); free_root(&warn_root,MYF(0)); +#ifdef USING_TRANSACTIONS free_root(&transaction.mem_root,MYF(0)); +#endif mysys_var=0; // Safety (shouldn't be needed) pthread_mutex_destroy(&LOCK_delete); #ifndef DBUG_OFF @@ -867,7 +847,6 @@ bool select_send::send_data(List<Item> &items) InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved by thd */ - if (thd->transaction.all.innobase_tid) ha_release_temporary_latches(thd); #endif @@ -902,7 +881,6 @@ bool select_send::send_eof() /* We may be passing the control from mysqld to the client: release the InnoDB adaptive hash S-latch to avoid thread deadlocks if it was reserved by thd */ - if (thd->transaction.all.innobase_tid) ha_release_temporary_latches(thd); #endif |