Commit fa0d2df5 authored by Thayumanavar's avatar Thayumanavar

Bug#13699303 - THREAD POOL PLUGIN IGNORES TIMEOUT.

PROBLEM: 
mysql provides a feature where in a session which is 
idle for a period specified by the wait_timeout variable
(whose value is in seconds), the session is closed
This feature is not present when we use thread pool.
FIX:
This patch implements the interface functions which is 
required to implement the wait_timeout functionality
in the thread pool plugin.
parent aca566d7
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <debug_sync.h> #include <debug_sync.h>
#include <sql_profile.h> #include <sql_profile.h>
#include <table.h> #include <table.h>
#include <sql_list.h>
/* Needed to get access to scheduler variables */ /* Needed to get access to scheduler variables */
void* thd_get_scheduler_data(THD *thd); void* thd_get_scheduler_data(THD *thd);
...@@ -56,9 +57,30 @@ void thd_unlock_data(THD *thd); ...@@ -56,9 +57,30 @@ void thd_unlock_data(THD *thd);
bool thd_is_transaction_active(THD *thd); bool thd_is_transaction_active(THD *thd);
int thd_connection_has_data(THD *thd); int thd_connection_has_data(THD *thd);
void thd_set_net_read_write(THD *thd, uint val); void thd_set_net_read_write(THD *thd, uint val);
uint thd_get_net_read_write(THD *thd);
void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var); void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
ulong thd_get_net_wait_timeout(THD *thd);
my_socket thd_get_fd(THD *thd); my_socket thd_get_fd(THD *thd);
/* Interface class for global thread list iteration */
class Thread_iterator
{
public:
Thread_iterator() : m_iterator(threads) {}
THD* next()
{
THD* tmp = m_iterator++;
return tmp;
}
private:
/*
Don't allow copying of this class.
*/
Thread_iterator(const Thread_iterator&);
void operator=(const Thread_iterator&);
I_List_iterator<THD> m_iterator;
};
/* Print to the MySQL error log */ /* Print to the MySQL error log */
void sql_print_error(const char *format, ...); void sql_print_error(const char *format, ...);
......
...@@ -254,6 +254,18 @@ PSI_thread *thd_get_psi(THD *thd) ...@@ -254,6 +254,18 @@ PSI_thread *thd_get_psi(THD *thd)
return thd->scheduler.m_psi; return thd->scheduler.m_psi;
} }
/**
Get net_wait_timeout for THD object
@param thd THD object
@retval net_wait_timeout value for thread on THD
*/
ulong thd_get_net_wait_timeout(THD* thd)
{
return thd->variables.net_wait_timeout;
}
/** /**
Set reference to Performance Schema object for THD object Set reference to Performance Schema object for THD object
...@@ -422,6 +434,17 @@ void thd_set_net_read_write(THD *thd, uint val) ...@@ -422,6 +434,17 @@ void thd_set_net_read_write(THD *thd, uint val)
thd->net.reading_or_writing= val; thd->net.reading_or_writing= val;
} }
/**
Get reading/writing on socket from THD object
@param thd THD object
@retval net.reading_or_writing value for thread on THD.
*/
uint thd_get_net_read_write(THD *thd)
{
return thd->net.reading_or_writing;
}
/** /**
Set reference to mysys variable in THD object Set reference to mysys variable in THD object
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment