mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
slave_open_temp_tables to Atomic_counter
This commit is contained in:
parent
10cdf5230d
commit
4bd9f82a8f
6 changed files with 12 additions and 31 deletions
|
@ -817,16 +817,6 @@ extern uint thd_lib_detected;
|
|||
#define statistic_sub(V,C,L) (V)-=(C)
|
||||
#endif /* SAFE_STATISTICS */
|
||||
|
||||
static inline void thread_safe_increment32(int32 *value)
|
||||
{
|
||||
(void) my_atomic_add32_explicit(value, 1, MY_MEMORY_ORDER_RELAXED);
|
||||
}
|
||||
|
||||
static inline void thread_safe_decrement32(int32 *value)
|
||||
{
|
||||
(void) my_atomic_add32_explicit(value, -1, MY_MEMORY_ORDER_RELAXED);
|
||||
}
|
||||
|
||||
/*
|
||||
No locking needed, the counter is owned by the thread
|
||||
*/
|
||||
|
|
|
@ -459,7 +459,7 @@ uint lower_case_table_names;
|
|||
ulong tc_heuristic_recover= 0;
|
||||
Atomic_counter<uint32_t> thread_count;
|
||||
bool shutdown_wait_for_slaves;
|
||||
int32 slave_open_temp_tables;
|
||||
Atomic_counter<uint32_t> slave_open_temp_tables;
|
||||
ulong thread_created;
|
||||
ulong back_log, connect_timeout, concurrency, server_id;
|
||||
ulong what_to_log;
|
||||
|
@ -7198,18 +7198,6 @@ static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff,
|
|||
}
|
||||
|
||||
|
||||
/* How many slaves are connected to this master */
|
||||
|
||||
static int show_slaves_connected(THD *thd, SHOW_VAR *var, char *buff)
|
||||
{
|
||||
|
||||
var->type= SHOW_LONGLONG;
|
||||
var->value= buff;
|
||||
*((longlong*) buff)= uint32_t(binlog_dump_thread_count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* How many masters this slave is connected to */
|
||||
|
||||
|
||||
|
@ -7785,9 +7773,9 @@ SHOW_VAR status_vars[]= {
|
|||
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count_), SHOW_LONG_STATUS},
|
||||
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count_), SHOW_LONG_STATUS},
|
||||
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count_), SHOW_LONG_STATUS},
|
||||
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_INT},
|
||||
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_ATOMIC_COUNTER_UINT32_T},
|
||||
#ifdef HAVE_REPLICATION
|
||||
{"Slaves_connected", (char*) &show_slaves_connected, SHOW_SIMPLE_FUNC },
|
||||
{"Slaves_connected", (char*) &binlog_dump_thread_count, SHOW_ATOMIC_COUNTER_UINT32_T},
|
||||
{"Slaves_running", (char*) &show_slaves_running, SHOW_SIMPLE_FUNC },
|
||||
{"Slave_connections", (char*) offsetof(STATUS_VAR, com_register_slave), SHOW_LONG_STATUS},
|
||||
{"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_SIMPLE_FUNC},
|
||||
|
|
|
@ -221,7 +221,7 @@ extern ulong delayed_insert_timeout;
|
|||
extern ulong delayed_insert_limit, delayed_queue_size;
|
||||
extern ulong delayed_insert_threads, delayed_insert_writes;
|
||||
extern ulong delayed_rows_in_use,delayed_insert_errors;
|
||||
extern int32 slave_open_temp_tables;
|
||||
extern Atomic_counter<uint32_t> slave_open_temp_tables;
|
||||
extern ulonglong query_cache_size;
|
||||
extern ulong query_cache_limit;
|
||||
extern ulong query_cache_min_res_unit;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \
|
||||
SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \
|
||||
SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS, SHOW_UINT32_STATUS, \
|
||||
SHOW_LEX_STRING
|
||||
SHOW_LEX_STRING, SHOW_ATOMIC_COUNTER_UINT32_T
|
||||
#include "mariadb.h"
|
||||
#undef SHOW_always_last
|
||||
|
||||
|
|
|
@ -3692,6 +3692,11 @@ const char* get_one_variable(THD *thd,
|
|||
end= pos + ls->length;
|
||||
break;
|
||||
}
|
||||
case SHOW_ATOMIC_COUNTER_UINT32_T:
|
||||
end= int10_to_str(
|
||||
static_cast<long>(*static_cast<Atomic_counter<uint32_t>*>(value)),
|
||||
buff, 10);
|
||||
break;
|
||||
case SHOW_UNDEF:
|
||||
break; // Return empty string
|
||||
case SHOW_SYS: // Cannot happen
|
||||
|
|
|
@ -1137,9 +1137,7 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
|
|||
|
||||
/* Increment Slave_open_temp_table_definitions status variable count. */
|
||||
if (rgi_slave)
|
||||
{
|
||||
thread_safe_increment32(&slave_open_temp_tables);
|
||||
}
|
||||
slave_open_temp_tables++;
|
||||
|
||||
DBUG_PRINT("tmptable", ("Opened table: '%s'.'%s table: %p",
|
||||
table->s->db.str,
|
||||
|
@ -1245,7 +1243,7 @@ void THD::close_temporary_table(TABLE *table)
|
|||
/* Natural invariant of temporary_tables */
|
||||
DBUG_ASSERT(slave_open_temp_tables || !temporary_tables);
|
||||
/* Decrement Slave_open_temp_table_definitions status variable count. */
|
||||
thread_safe_decrement32(&slave_open_temp_tables);
|
||||
slave_open_temp_tables--;
|
||||
}
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
|
|
Loading…
Add table
Reference in a new issue