@ -159,6 +159,7 @@ static char * mysql_thread_variables_names[]= {
( char * ) " monitor_query_timeout " ,
( char * ) " monitor_timer_cached " ,
( char * ) " max_transaction_time " ,
( char * ) " threshold_query_length " ,
( char * ) " wait_timeout " ,
( char * ) " max_connections " ,
( char * ) " default_query_delay " ,
@ -221,6 +222,7 @@ MySQL_Threads_Handler::MySQL_Threads_Handler() {
variables . monitor_query_status = strdup ( ( char * ) " SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS " ) ;
variables . monitor_timer_cached = true ;
variables . max_transaction_time = 4 * 3600 * 1000 ;
variables . threshold_query_length = 512 * 1024 ;
variables . wait_timeout = 8 * 3600 * 1000 ;
variables . max_connections = 10 * 1000 ;
variables . default_query_delay = 0 ;
@ -366,6 +368,7 @@ int MySQL_Threads_Handler::get_variable_int(char *name) {
if ( ! strcasecmp ( name , " connect_timeout_server_max " ) ) return ( int ) variables . connect_timeout_server_max ;
if ( ! strcasecmp ( name , " connect_retries_delay " ) ) return ( int ) variables . connect_retries_delay ;
if ( ! strcasecmp ( name , " max_transaction_time " ) ) return ( int ) variables . max_transaction_time ;
if ( ! strcasecmp ( name , " threshold_query_length " ) ) return ( int ) variables . threshold_query_length ;
if ( ! strcasecmp ( name , " wait_timeout " ) ) return ( int ) variables . wait_timeout ;
if ( ! strcasecmp ( name , " max_connections " ) ) return ( int ) variables . max_connections ;
if ( ! strcasecmp ( name , " default_query_delay " ) ) return ( int ) variables . default_query_delay ;
@ -484,6 +487,10 @@ char * MySQL_Threads_Handler::get_variable(char *name) { // this is the public f
sprintf ( intbuf , " %d " , variables . max_transaction_time ) ;
return strdup ( intbuf ) ;
}
if ( ! strcasecmp ( name , " threshold_query_length " ) ) {
sprintf ( intbuf , " %d " , variables . threshold_query_length ) ;
return strdup ( intbuf ) ;
}
if ( ! strcasecmp ( name , " wait_timeout " ) ) {
sprintf ( intbuf , " %d " , variables . wait_timeout ) ;
return strdup ( intbuf ) ;
@ -708,6 +715,15 @@ bool MySQL_Threads_Handler::set_variable(char *name, char *value) { // this is t
return false ;
}
}
if ( ! strcasecmp ( name , " threshold_query_length " ) ) {
int intv = atoi ( value ) ;
if ( intv > = 1024 & & intv < = 1 * 1024 * 1024 * 1024 ) {
variables . threshold_query_length = intv ;
return true ;
} else {
return false ;
}
}
if ( ! strcasecmp ( name , " wait_timeout " ) ) {
int intv = atoi ( value ) ;
if ( intv > = 0 & & intv < = 20 * 24 * 3600 * 1000 ) {
@ -1589,6 +1605,7 @@ void MySQL_Thread::refresh_variables() {
GloMTH - > wrlock ( ) ;
__thread_MySQL_Thread_Variables_version = __global_MySQL_Thread_Variables_version ;
mysql_thread___max_transaction_time = GloMTH - > get_variable_int ( ( char * ) " max_transaction_time " ) ;
mysql_thread___threshold_query_length = GloMTH - > get_variable_int ( ( char * ) " threshold_query_length " ) ;
mysql_thread___wait_timeout = GloMTH - > get_variable_int ( ( char * ) " wait_timeout " ) ;
mysql_thread___max_connections = GloMTH - > get_variable_int ( ( char * ) " max_connections " ) ;
mysql_thread___default_query_delay = GloMTH - > get_variable_int ( ( char * ) " default_query_delay " ) ;