@ -180,6 +180,7 @@ static char * mysql_thread_variables_names[]= {
( char * ) " monitor_query_timeout " ,
( char * ) " monitor_timer_cached " ,
( char * ) " monitor_writer_is_also_reader " ,
( char * ) " max_allowed_packet " ,
( char * ) " max_transaction_time " ,
( char * ) " multiplexing " ,
( char * ) " enforce_autocommit_on_reads " ,
@ -257,6 +258,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 . monitor_writer_is_also_reader = true ;
variables . max_allowed_packet = 4 * 1024 * 1024 ;
variables . max_transaction_time = 4 * 3600 * 1000 ;
variables . threshold_query_length = 512 * 1024 ;
variables . threshold_resultset_size = 4 * 1024 * 1024 ;
@ -455,6 +457,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 , " eventslog_filesize " ) ) return ( int ) variables . eventslog_filesize ;
if ( ! strcasecmp ( name , " max_allowed_packet " ) ) return ( int ) variables . max_allowed_packet ;
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 , " threshold_resultset_size " ) ) return ( int ) variables . threshold_resultset_size ;
@ -635,6 +638,10 @@ char * MySQL_Threads_Handler::get_variable(char *name) { // this is the public f
sprintf ( intbuf , " %d " , variables . eventslog_filesize ) ;
return strdup ( intbuf ) ;
}
if ( ! strcasecmp ( name , " max_allowed_packet " ) ) {
sprintf ( intbuf , " %d " , variables . max_allowed_packet ) ;
return strdup ( intbuf ) ;
}
if ( ! strcasecmp ( name , " max_transaction_time " ) ) {
sprintf ( intbuf , " %d " , variables . max_transaction_time ) ;
return strdup ( intbuf ) ;
@ -913,6 +920,15 @@ bool MySQL_Threads_Handler::set_variable(char *name, char *value) { // this is t
return false ;
}
}
if ( ! strcasecmp ( name , " max_allowed_packet " ) ) {
int intv = atoi ( value ) ;
if ( intv > = 8192 & & intv < = 1024 * 1024 * 1024 ) {
variables . max_allowed_packet = intv ;
return true ;
} else {
return false ;
}
}
if ( ! strcasecmp ( name , " max_transaction_time " ) ) {
int intv = atoi ( value ) ;
if ( intv > = 1000 & & intv < = 20 * 24 * 3600 * 1000 ) {
@ -1959,6 +1975,7 @@ void MySQL_Thread::process_all_sessions() {
void MySQL_Thread : : refresh_variables ( ) {
GloMTH - > wrlock ( ) ;
__thread_MySQL_Thread_Variables_version = __global_MySQL_Thread_Variables_version ;
mysql_thread___max_allowed_packet = GloMTH - > get_variable_int ( ( char * ) " max_allowed_packet " ) ;
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___threshold_resultset_size = GloMTH - > get_variable_int ( ( char * ) " threshold_resultset_size " ) ;