mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
slave_open_temp_tables to Atomic_counter
This commit is contained in:
@ -817,16 +817,6 @@ extern uint thd_lib_detected;
|
|||||||
#define statistic_sub(V,C,L) (V)-=(C)
|
#define statistic_sub(V,C,L) (V)-=(C)
|
||||||
#endif /* SAFE_STATISTICS */
|
#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
|
No locking needed, the counter is owned by the thread
|
||||||
*/
|
*/
|
||||||
|
@ -459,7 +459,7 @@ uint lower_case_table_names;
|
|||||||
ulong tc_heuristic_recover= 0;
|
ulong tc_heuristic_recover= 0;
|
||||||
Atomic_counter<uint32_t> thread_count;
|
Atomic_counter<uint32_t> thread_count;
|
||||||
bool shutdown_wait_for_slaves;
|
bool shutdown_wait_for_slaves;
|
||||||
int32 slave_open_temp_tables;
|
Atomic_counter<uint32_t> slave_open_temp_tables;
|
||||||
ulong thread_created;
|
ulong thread_created;
|
||||||
ulong back_log, connect_timeout, concurrency, server_id;
|
ulong back_log, connect_timeout, concurrency, server_id;
|
||||||
ulong what_to_log;
|
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 */
|
/* 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", (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_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},
|
{"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
|
#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 },
|
{"Slaves_running", (char*) &show_slaves_running, SHOW_SIMPLE_FUNC },
|
||||||
{"Slave_connections", (char*) offsetof(STATUS_VAR, com_register_slave), SHOW_LONG_STATUS},
|
{"Slave_connections", (char*) offsetof(STATUS_VAR, com_register_slave), SHOW_LONG_STATUS},
|
||||||
{"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_SIMPLE_FUNC},
|
{"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_limit, delayed_queue_size;
|
||||||
extern ulong delayed_insert_threads, delayed_insert_writes;
|
extern ulong delayed_insert_threads, delayed_insert_writes;
|
||||||
extern ulong delayed_rows_in_use,delayed_insert_errors;
|
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 ulonglong query_cache_size;
|
||||||
extern ulong query_cache_limit;
|
extern ulong query_cache_limit;
|
||||||
extern ulong query_cache_min_res_unit;
|
extern ulong query_cache_min_res_unit;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \
|
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \
|
||||||
SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \
|
SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \
|
||||||
SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS, SHOW_UINT32_STATUS, \
|
SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS, SHOW_UINT32_STATUS, \
|
||||||
SHOW_LEX_STRING
|
SHOW_LEX_STRING, SHOW_ATOMIC_COUNTER_UINT32_T
|
||||||
#include "mariadb.h"
|
#include "mariadb.h"
|
||||||
#undef SHOW_always_last
|
#undef SHOW_always_last
|
||||||
|
|
||||||
|
@ -3692,6 +3692,11 @@ const char* get_one_variable(THD *thd,
|
|||||||
end= pos + ls->length;
|
end= pos + ls->length;
|
||||||
break;
|
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:
|
case SHOW_UNDEF:
|
||||||
break; // Return empty string
|
break; // Return empty string
|
||||||
case SHOW_SYS: // Cannot happen
|
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. */
|
/* Increment Slave_open_temp_table_definitions status variable count. */
|
||||||
if (rgi_slave)
|
if (rgi_slave)
|
||||||
{
|
slave_open_temp_tables++;
|
||||||
thread_safe_increment32(&slave_open_temp_tables);
|
|
||||||
}
|
|
||||||
|
|
||||||
DBUG_PRINT("tmptable", ("Opened table: '%s'.'%s table: %p",
|
DBUG_PRINT("tmptable", ("Opened table: '%s'.'%s table: %p",
|
||||||
table->s->db.str,
|
table->s->db.str,
|
||||||
@ -1245,7 +1243,7 @@ void THD::close_temporary_table(TABLE *table)
|
|||||||
/* Natural invariant of temporary_tables */
|
/* Natural invariant of temporary_tables */
|
||||||
DBUG_ASSERT(slave_open_temp_tables || !temporary_tables);
|
DBUG_ASSERT(slave_open_temp_tables || !temporary_tables);
|
||||||
/* Decrement Slave_open_temp_table_definitions status variable count. */
|
/* Decrement Slave_open_temp_table_definitions status variable count. */
|
||||||
thread_safe_decrement32(&slave_open_temp_tables);
|
slave_open_temp_tables--;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
Reference in New Issue
Block a user