Change connection_count back to static
Code structual change only, just limiting super global variables especially when the counter under the THD structure should be used in general.
This commit is contained in:
parent
b118f92be6
commit
5727d56260
@ -1466,7 +1466,7 @@ struct st_VioSSLFd *ssl_acceptor_fd;
|
||||
/**
|
||||
Number of currently active user connections.
|
||||
*/
|
||||
Atomic_counter<uint> connection_count;
|
||||
static Atomic_counter<uint> connection_count;
|
||||
static Atomic_counter<uint> extra_connection_count;
|
||||
|
||||
my_bool opt_gtid_strict_mode= FALSE;
|
||||
@ -8571,15 +8571,20 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
|
||||
return 1;
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
one_thread_scheduler(thread_scheduler);
|
||||
one_thread_scheduler(extra_thread_scheduler);
|
||||
one_thread_scheduler(thread_scheduler, &connection_count);
|
||||
/*
|
||||
It looks like extra_connection_count should be passed here but
|
||||
its been using connection_count for the last 10+ years and
|
||||
no-one was requested a change so lets not suprise anyone.
|
||||
*/
|
||||
one_thread_scheduler(extra_thread_scheduler, &connection_count);
|
||||
#else
|
||||
|
||||
if (thread_handling <= SCHEDULER_ONE_THREAD_PER_CONNECTION)
|
||||
one_thread_per_connection_scheduler(thread_scheduler, &max_connections,
|
||||
&connection_count);
|
||||
else if (thread_handling == SCHEDULER_NO_THREADS)
|
||||
one_thread_scheduler(thread_scheduler);
|
||||
one_thread_scheduler(thread_scheduler, &connection_count);
|
||||
else
|
||||
pool_of_threads_scheduler(thread_scheduler, &max_connections,
|
||||
&connection_count);
|
||||
|
@ -116,7 +116,6 @@ extern bool opt_ignore_builtin_innodb;
|
||||
extern my_bool opt_character_set_client_handshake;
|
||||
extern my_bool debug_assert_on_not_freed_memory;
|
||||
extern MYSQL_PLUGIN_IMPORT bool volatile abort_loop;
|
||||
extern Atomic_counter<uint> connection_count;
|
||||
extern my_bool opt_safe_user_create;
|
||||
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
|
||||
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
|
||||
|
@ -131,11 +131,12 @@ void handle_connection_in_main_thread(CONNECT *connect)
|
||||
Initialize scheduler for --thread-handling=no-threads
|
||||
*/
|
||||
|
||||
void one_thread_scheduler(scheduler_functions *func)
|
||||
void one_thread_scheduler(scheduler_functions *func,
|
||||
Atomic_counter<uint> *arg_connection_count)
|
||||
{
|
||||
scheduler_init();
|
||||
func->max_threads= 1;
|
||||
func->max_connections= &max_connections;
|
||||
func->connection_count= &connection_count;
|
||||
func->connection_count= arg_connection_count;
|
||||
func->add_connection= handle_connection_in_main_thread;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ enum scheduler_types
|
||||
|
||||
void one_thread_per_connection_scheduler(scheduler_functions *func,
|
||||
ulong *arg_max_connections, Atomic_counter<uint> *arg_connection_count);
|
||||
void one_thread_scheduler(scheduler_functions *func);
|
||||
void one_thread_scheduler(scheduler_functions *func, Atomic_counter<uint> *arg_connection_count);
|
||||
|
||||
extern void scheduler_init();
|
||||
extern void post_kill_notification(THD *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user