summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-07-03 17:35:27 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-08-10 15:03:10 +0200
commitc38b8f49b8cbe43e20d7710b0d291dd92490fced (patch)
tree9811f1052beb71247936933cea7a3732fb7d324a /sql
parent4ce1470a700809c7b62ade40ddb95063a0e47402 (diff)
downloadmariadb-git-c38b8f49b8cbe43e20d7710b0d291dd92490fced.tar.gz
cleanup: consolidate binlog-related THD::*_used into one bitmap
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc6
-rw-r--r--sql/item_timefunc.cc10
-rw-r--r--sql/log.cc18
-rw-r--r--sql/log_event_server.cc11
-rw-r--r--sql/sp.cc12
-rw-r--r--sql/sql_class.cc19
-rw-r--r--sql/sql_class.h12
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_insert.cc9
-rw-r--r--sql/sql_parse.cc6
-rw-r--r--sql/sql_table.cc12
-rw-r--r--sql/sql_time.cc4
-rw-r--r--sql/sql_type.cc2
-rw-r--r--sql/sys_vars.inl2
-rw-r--r--sql/temporary_tables.cc8
15 files changed, 61 insertions, 72 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index a887b1ed022..f7cc7545125 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -775,7 +775,7 @@ bool Item_func_connection_id::fix_fields(THD *thd, Item **ref)
{
if (Item_int_func::fix_fields(thd, ref))
return TRUE;
- thd->thread_specific_used= TRUE;
+ thd->used|= THD::THREAD_SPECIFIC_USED;
value= thd->variables.pseudo_thread_id;
return FALSE;
}
@@ -2818,9 +2818,9 @@ bool Item_func_rand::fix_fields(THD *thd,Item **ref)
Once events are forwarded rather than recreated,
the following can be skipped if inside the slave thread
*/
- if (!thd->rand_used)
+ if (!(thd->used & THD::RAND_USED))
{
- thd->rand_used= 1;
+ thd->used|= THD::RAND_USED;
thd->rand_saved_seed1= thd->rand.seed1;
thd->rand_saved_seed2= thd->rand.seed2;
}
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 8399e5dc0ac..26adc4eddaa 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1509,7 +1509,7 @@ bool Item_func_from_days::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzz
void Item_func_curdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
{
thd->variables.time_zone->gmt_sec_to_TIME(now_time, thd->query_start());
- thd->time_zone_used= 1;
+ thd->used |= THD::TIME_ZONE_USED;
}
@@ -1601,7 +1601,7 @@ void Item_func_curtime_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
now_time->year= now_time->month= now_time->day= 0;
now_time->time_type= MYSQL_TIMESTAMP_TIME;
set_sec_part(thd->query_start_sec_part(), now_time, this);
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
}
@@ -1667,7 +1667,7 @@ void Item_func_now_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
{
thd->variables.time_zone->gmt_sec_to_TIME(now_time, thd->query_start());
set_sec_part(thd->query_start_sec_part(), now_time, this);
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
}
@@ -1710,7 +1710,7 @@ void Item_func_sysdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)
my_hrtime_t now= my_hrtime();
thd->variables.time_zone->gmt_sec_to_TIME(now_time, hrtime_to_my_time(now));
set_sec_part(hrtime_sec_part(now), now_time, this);
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
}
@@ -2732,7 +2732,7 @@ null_date:
bool Item_func_from_unixtime::fix_length_and_dec(THD *thd)
{
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
tz= thd->variables.time_zone;
Type_std_attributes::set(
Type_temporal_attributes_not_fixed_dec(MAX_DATETIME_WIDTH,
diff --git a/sql/log.cc b/sql/log.cc
index ee6c0425192..06bb073134d 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -834,14 +834,13 @@ bool Log_to_csv_event_handler::
uint field_index;
Silence_log_table_errors error_handler;
Open_tables_backup open_tables_backup;
- bool save_time_zone_used;
+ THD::used_t save_time_zone_used= thd->used & THD::TIME_ZONE_USED;
DBUG_ENTER("log_general");
/*
CSV uses TIME_to_timestamp() internally if table needs to be repaired
- which will set thd->time_zone_used
+ which will set TIME_ZONE_USED
*/
- save_time_zone_used= thd->time_zone_used;
table_list.init_one_table(&MYSQL_SCHEMA_NAME, &GENERAL_LOG_NAME, 0,
TL_WRITE_CONCURRENT_INSERT);
@@ -942,7 +941,7 @@ err:
if (need_close)
close_log_table(thd, &open_tables_backup);
- thd->time_zone_used= save_time_zone_used;
+ thd->used= (thd->used & ~THD::TIME_ZONE_USED) | save_time_zone_used;
DBUG_RETURN(result);
}
@@ -989,7 +988,7 @@ bool Log_to_csv_event_handler::
Silence_log_table_errors error_handler;
Open_tables_backup open_tables_backup;
CHARSET_INFO *client_cs= thd->variables.character_set_client;
- bool save_time_zone_used;
+ THD::used_t save_time_zone_used= thd->used & THD::TIME_ZONE_USED;
ulong query_time= (ulong) MY_MIN(query_utime/1000000, TIME_MAX_VALUE_SECONDS);
ulong lock_time= (ulong) MY_MIN(lock_utime/1000000, TIME_MAX_VALUE_SECONDS);
ulong query_time_micro= (ulong) (query_utime % 1000000);
@@ -997,11 +996,6 @@ bool Log_to_csv_event_handler::
DBUG_ENTER("Log_to_csv_event_handler::log_slow");
thd->push_internal_handler(& error_handler);
- /*
- CSV uses TIME_to_timestamp() internally if table needs to be repaired
- which will set thd->time_zone_used
- */
- save_time_zone_used= thd->time_zone_used;
table_list.init_one_table(&MYSQL_SCHEMA_NAME, &SLOW_LOG_NAME, 0,
TL_WRITE_CONCURRENT_INSERT);
@@ -1129,7 +1123,7 @@ err:
}
if (need_close)
close_log_table(thd, &open_tables_backup);
- thd->time_zone_used= save_time_zone_used;
+ thd->used= (thd->used & ~THD::TIME_ZONE_USED) | save_time_zone_used;
DBUG_RETURN(result);
}
@@ -6853,7 +6847,7 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
if (write_event(&e, cache_data, file))
goto err;
}
- if (thd->rand_used)
+ if (thd->used & THD::RAND_USED)
{
Rand_log_event e(thd,thd->rand_saved_seed1,thd->rand_saved_seed2,
using_trans, direct);
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc
index 897a8a36c01..e757fabea77 100644
--- a/sql/log_event_server.cc
+++ b/sql/log_event_server.cc
@@ -1289,7 +1289,7 @@ bool Query_log_event::write()
}
}
- if (thd && thd->query_start_sec_part_used)
+ if (thd && (thd->used & THD::QUERY_START_SEC_PART_USED))
{
*start++= Q_HRNOW;
get_time();
@@ -1415,8 +1415,8 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
bool direct, bool suppress_use, int errcode)
:Log_event(thd_arg,
- (thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F :
- 0) |
+ ((thd_arg->used & THD::THREAD_SPECIFIC_USED)
+ ? LOG_EVENT_THREAD_SPECIFIC_F : 0) |
(suppress_use ? LOG_EVENT_SUPPRESS_USE_F : 0),
using_trans),
data_buf(0), query(query_arg), catalog(thd_arg->catalog),
@@ -1502,7 +1502,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
int2store(charset, thd_arg->variables.character_set_client->number);
int2store(charset+2, thd_arg->variables.collation_connection->number);
int2store(charset+4, thd_arg->variables.collation_server->number);
- if (thd_arg->time_zone_used)
+ if (thd_arg->used & THD::TIME_ZONE_USED)
{
/*
Note that our event becomes dependent on the Time_zone object
@@ -2951,7 +2951,8 @@ Load_log_event::Load_log_event(THD *thd_arg, const sql_exchange *ex,
enum enum_duplicates handle_dup,
bool ignore, bool using_trans)
:Log_event(thd_arg,
- thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0,
+ (thd_arg->used & THD::THREAD_SPECIFIC_USED)
+ ? LOG_EVENT_THREAD_SPECIFIC_F : 0,
using_trans),
thread_id(thd_arg->thread_id),
slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id),
diff --git a/sql/sp.cc b/sql/sp.cc
index 4ef23983f78..40c5ddaa675 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -687,8 +687,7 @@ bool AUTHID::read_from_mysql_proc_row(THD *thd, TABLE *table)
*/
int
-Sp_handler::db_find_routine(THD *thd,
- const Database_qualified_name *name,
+Sp_handler::db_find_routine(THD *thd, const Database_qualified_name *name,
sp_head **sphp) const
{
TABLE *table;
@@ -697,7 +696,7 @@ Sp_handler::db_find_routine(THD *thd,
longlong created;
longlong modified;
Sp_chistics chistics;
- bool saved_time_zone_used= thd->time_zone_used;
+ THD::used_t saved_time_zone_used= thd->used & THD::TIME_ZONE_USED;
bool trans_commited= 0;
sql_mode_t sql_mode;
Stored_program_creation_ctx *creation_ctx;
@@ -763,15 +762,14 @@ Sp_handler::db_find_routine(THD *thd,
thd->commit_whole_transaction_and_close_tables();
new_trans.restore_old_transaction();
- ret= db_load_routine(thd, name, sphp,
- sql_mode, params, returns, body, chistics, definer,
- created, modified, NULL, creation_ctx);
+ ret= db_load_routine(thd, name, sphp, sql_mode, params, returns, body,
+ chistics, definer, created, modified, NULL, creation_ctx);
done:
/*
Restore the time zone flag as the timezone usage in proc table
does not affect replication.
*/
- thd->time_zone_used= saved_time_zone_used;
+ thd->used= (thd->used & ~THD::TIME_ZONE_USED) | saved_time_zone_used;
if (!trans_commited)
{
if (table)
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 980ea6de1d8..3402db42763 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -635,7 +635,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
protocol_text(this), protocol_binary(this), initial_status_var(0),
m_current_stage_key(0), m_psi(0),
in_sub_stmt(0), log_all_errors(0),
- binlog_unsafe_warning_flags(0),
+ binlog_unsafe_warning_flags(0), used(0),
current_stmt_binlog_format(BINLOG_FORMAT_MIXED),
bulk_param(0),
table_map_for_update(0),
@@ -655,8 +655,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
is_fatal_error(0),
transaction_rollback_request(0),
is_fatal_sub_stmt_error(false),
- rand_used(0),
- time_zone_used(0),
in_lock_tables(0),
bootstrap(0),
derived_tables_processing(FALSE),
@@ -769,11 +767,10 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
security_ctx= &main_security_ctx;
no_errors= 0;
password= 0;
- query_start_sec_part_used= 0;
count_cuted_fields= CHECK_FIELD_IGNORE;
killed= NOT_KILLED;
killed_err= 0;
- is_slave_error= thread_specific_used= FALSE;
+ is_slave_error= FALSE;
my_hash_clear(&handler_tables_hash);
my_hash_clear(&ull_hash);
tmp_table=0;
@@ -2232,13 +2229,13 @@ void THD::cleanup_after_query()
thd_progress_end(this);
/*
- Reset rand_used so that detection of calls to rand() will save random
+ Reset RAND_USED so that detection of calls to rand() will save random
seeds if needed by the slave.
- Do not reset rand_used if inside a stored function or trigger because
+ Do not reset RAND_USED if inside a stored function or trigger because
only the call to these operations is logged. Thus only the calling
statement needs to detect rand() calls made by its substatements. These
- substatements must not set rand_used to 0 because it would remove the
+ substatements must not set RAND_USED to 0 because it would remove the
detection of rand() by the calling statement.
*/
if (!in_sub_stmt) /* stored functions and triggers are a special case */
@@ -2246,7 +2243,7 @@ void THD::cleanup_after_query()
/* Forget those values, for next binlogger: */
stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
auto_inc_intervals_in_cur_stmt_for_binlog.empty();
- rand_used= 0;
+ used&= ~THD::RAND_USED;
#ifndef EMBEDDED_LIBRARY
/*
Clean possible unused INSERT_ID events by current statement.
@@ -7537,7 +7534,7 @@ MYSQL_TIME THD::query_start_TIME()
MYSQL_TIME res;
variables.time_zone->gmt_sec_to_TIME(&res, query_start());
res.second_part= query_start_sec_part();
- time_zone_used= 1;
+ used|= TIME_ZONE_USED;
return res;
}
@@ -8276,7 +8273,7 @@ Query_arena_stmt::~Query_arena_stmt()
bool THD::timestamp_to_TIME(MYSQL_TIME *ltime, my_time_t ts,
ulong sec_part, date_mode_t fuzzydate)
{
- time_zone_used= 1;
+ used|= TIME_ZONE_USED;
if (ts == 0 && sec_part == 0)
{
if (fuzzydate & TIME_NO_ZERO_DATE)
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5887a5233c8..e7257be788d 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2908,6 +2908,12 @@ public:
*/
uint32 binlog_unsafe_warning_flags;
+ typedef uint used_t;
+ enum { RAND_USED=1, TIME_ZONE_USED=2, QUERY_START_SEC_PART_USED=4,
+ THREAD_SPECIFIC_USED=8 };
+
+ used_t used;
+
#ifndef MYSQL_CLIENT
binlog_cache_mngr * binlog_setup_trx_data();
/*
@@ -3592,15 +3598,11 @@ public:
Reset to FALSE when we leave the sub-statement mode.
*/
bool is_fatal_sub_stmt_error;
- bool rand_used, time_zone_used;
- bool query_start_sec_part_used;
/* for IS NULL => = last_insert_id() fix in remove_eq_conds() */
bool substitute_null_with_insert_id;
bool in_lock_tables;
bool bootstrap, cleanup_done, free_connection_done;
- /** is set if some thread specific value(s) used in a statement. */
- bool thread_specific_used;
/**
is set if a statement accesses a temporary table created through
CREATE TEMPORARY TABLE.
@@ -3908,7 +3910,7 @@ public:
ulong sec_part, date_mode_t fuzzydate);
inline my_time_t query_start() { return start_time; }
inline ulong query_start_sec_part()
- { query_start_sec_part_used=1; return start_time_sec_part; }
+ { used|= QUERY_START_SEC_PART_USED; return start_time_sec_part; }
MYSQL_TIME query_start_TIME();
time_round_mode_t temporal_round_mode() const
{
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index d4384f49112..1f0945b1a2d 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -1640,7 +1640,7 @@ bool multi_delete::send_eof()
thd->clear_error();
else
errcode= query_error_code(thd, killed_status == NOT_KILLED);
- thd->thread_specific_used= TRUE;
+ thd->used|= THD::THREAD_SPECIFIC_USED;
StatementBinlog stmt_binlog(thd, thd->binlog_need_stmt_format(transactional_tables));
if (unlikely(thd->binlog_query(THD::ROW_QUERY_TYPE,
thd->query(), thd->query_length(),
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 56c52cc4ed0..baa7f783266 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2280,7 +2280,8 @@ public:
ulong start_time_sec_part;
sql_mode_t sql_mode;
bool auto_increment_field_not_null;
- bool ignore, log_query, query_start_sec_part_used;
+ bool ignore, log_query;
+ THD::used_t query_start_sec_part_used;
bool stmt_depends_on_first_successful_insert_id_in_prev_stmt;
ulonglong first_successful_insert_id_in_prev_stmt;
ulonglong forced_insert_id;
@@ -2938,7 +2939,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
row->start_time= thd->start_time;
row->start_time_sec_part= thd->start_time_sec_part;
- row->query_start_sec_part_used= thd->query_start_sec_part_used;
+ row->query_start_sec_part_used= thd->used & THD::QUERY_START_SEC_PART_USED;
/*
those are for the binlog: LAST_INSERT_ID() has been evaluated at this
time, so record does not need it, but statement-based binlogging of the
@@ -2955,7 +2956,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
So we can get time_zone object from thread which handling delayed statement.
See the comment of my_tz_find() for detail.
*/
- if (thd->time_zone_used)
+ if (thd->used & THD::TIME_ZONE_USED)
{
row->time_zone = thd->variables.time_zone;
}
@@ -3569,7 +3570,7 @@ bool Delayed_insert::handle_inserts(void)
thd.start_time=row->start_time;
thd.start_time_sec_part=row->start_time_sec_part;
- thd.query_start_sec_part_used=row->query_start_sec_part_used;
+ thd.used= row->query_start_sec_part_used;
/*
To get the exact auto_inc interval to store in the binlog we must not
use values from the previous interval (of the previous rows).
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 87f0bec7c87..8b8ab430308 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -7575,8 +7575,8 @@ void THD::reset_for_next_command(bool do_clear_error)
}
#endif /* WITH_WSREP */
- query_start_sec_part_used= 0;
- is_fatal_error= time_zone_used= 0;
+ used= 0;
+ is_fatal_error= 0;
variables.option_bits&= ~OPTION_BINLOG_THIS_STMT;
/*
@@ -7595,14 +7595,12 @@ void THD::reset_for_next_command(bool do_clear_error)
transaction->all.reset();
}
DBUG_ASSERT(security_ctx== &main_security_ctx);
- thread_specific_used= FALSE;
if (opt_bin_log)
reset_dynamic(&user_var_events);
DBUG_ASSERT(user_var_events_alloc == &main_mem_root);
enable_slow_log= true;
get_stmt_da()->reset_for_next_command();
- rand_used= 0;
m_sent_row_count= m_examined_row_count= 0;
accessed_rows_and_keys= 0;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 999f8306785..23f647b28df 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1816,7 +1816,7 @@ report_error:
table->table ? table->table->s : NULL));
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
- thd->thread_specific_used= TRUE;
+ thd->used|= THD::THREAD_SPECIFIC_USED;
error= 0;
err:
@@ -4620,7 +4620,7 @@ int create_table_impl(THD *thd,
if (is_trans != NULL)
*is_trans= table->file->has_transactions();
- thd->thread_specific_used= TRUE;
+ thd->used|= THD::THREAD_SPECIFIC_USED;
create_info->table= table; // Store pointer to table
}
@@ -4811,11 +4811,9 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
thd->abort_on_warning= thd->is_strict_mode();
if (mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm,
- &create_table->db,
- &create_table->table_name, create_info,
- alter_info,
- &is_trans, create_table_mode,
- create_table) > 0)
+ &create_table->db, &create_table->table_name,
+ create_info, alter_info, &is_trans,
+ create_table_mode, create_table) > 0)
{
result= 1;
goto err;
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 8bb96dfa776..d3b6b6c2c14 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -499,7 +499,7 @@ bool int_to_datetime_with_warn(THD *thd, const Longlong_hybrid &nr,
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, uint *error_code)
{
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
return thd->variables.time_zone->TIME_to_gmt_sec(t, error_code);
}
@@ -1265,7 +1265,7 @@ mix_date_and_time(MYSQL_TIME *to, const MYSQL_TIME *from)
void set_current_date(THD *thd, MYSQL_TIME *to)
{
thd->variables.time_zone->gmt_sec_to_TIME(to, thd->query_start());
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
datetime_to_date(to);
}
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 1c433043db7..3759c0ba02f 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -1064,7 +1064,7 @@ Datetime::Datetime(THD *thd, const timeval &tv)
{
thd->variables.time_zone->gmt_sec_to_TIME(this, tv.tv_sec);
second_part= tv.tv_usec;
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
DBUG_ASSERT(is_valid_value_slow());
}
diff --git a/sql/sys_vars.inl b/sql/sys_vars.inl
index 97e3a28b67e..b1d7bc31255 100644
--- a/sql/sys_vars.inl
+++ b/sql/sys_vars.inl
@@ -2241,7 +2241,7 @@ public:
timezone). If it's the global value which was used we can't replicate
(binlog code stores session value only).
*/
- thd->time_zone_used= 1;
+ thd->used|= THD::TIME_ZONE_USED;
return valptr(thd, session_var(thd, Time_zone *));
}
const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 5aacd0e6e99..b43a38e7fa2 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -427,7 +427,7 @@ bool THD::open_temporary_table(TABLE_LIST *tl)
#endif
table->query_id= query_id;
- thread_specific_used= true;
+ used|= THREAD_SPECIFIC_USED;
/* It is neither a derived table nor non-updatable view. */
tl->updatable= true;
@@ -1355,7 +1355,7 @@ bool THD::log_events_and_free_tmp_shares()
{
if (IS_USER_TABLE(share))
{
- bool save_thread_specific_used= thread_specific_used;
+ used_t save_thread_specific_used= used & THREAD_SPECIFIC_USED;
my_thread_id save_pseudo_thread_id= variables.pseudo_thread_id;
char db_buf[FN_REFLEN];
String db(db_buf, sizeof(db_buf), system_charset_info);
@@ -1405,7 +1405,7 @@ bool THD::log_events_and_free_tmp_shares()
clear_error();
CHARSET_INFO *cs_save= variables.character_set_client;
variables.character_set_client= system_charset_info;
- thread_specific_used= true;
+ used|= THREAD_SPECIFIC_USED;
Query_log_event qinfo(this, s_query.ptr(),
s_query.length() - 1 /* to remove trailing ',' */,
@@ -1438,7 +1438,7 @@ bool THD::log_events_and_free_tmp_shares()
get_stmt_da()->set_overwrite_status(false);
}
variables.pseudo_thread_id= save_pseudo_thread_id;
- thread_specific_used= save_thread_specific_used;
+ used = (used & ~THREAD_SPECIFIC_USED) | save_thread_specific_used;
}
else
{