Commit cd714847 authored by unknown's avatar unknown

Print error if we can't delete an alarm

More debugging variables
Increment aborted_threads in case of killed or too big packet


include/thr_alarm.h:
  made prototype more portable
mysys/thr_alarm.c:
  Print error if we can't delete an alarm
sql/mysqld.cc:
  Statistics variable (for debugging)
sql/net_serv.cc:
  statistics variable (for debugging)
sql/sql_parse.cc:
  Increment aborted_threads in case of killed or too big packet
parent 080f3bd2
...@@ -100,7 +100,7 @@ typedef struct st_alarm { ...@@ -100,7 +100,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0 #define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0) #define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm); void init_thr_alarm(uint max_alarm);
bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff); my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id); void thr_alarm_kill(pthread_t thread_id);
void thr_end_alarm(thr_alarm_t *alarmed); void thr_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(my_bool free_structures); void end_thr_alarm(my_bool free_structures);
......
...@@ -127,7 +127,7 @@ void init_thr_alarm(uint max_alarms) ...@@ -127,7 +127,7 @@ void init_thr_alarm(uint max_alarms)
Returns 0 if no more alarms are allowed (aborted by process) Returns 0 if no more alarms are allowed (aborted by process)
*/ */
bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data) my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
{ {
ulong now; ulong now;
sigset_t old_mask; sigset_t old_mask;
...@@ -209,7 +209,7 @@ void thr_end_alarm(thr_alarm_t *alarmed) ...@@ -209,7 +209,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
ALARM *alarm_data; ALARM *alarm_data;
sigset_t old_mask; sigset_t old_mask;
uint i; uint i;
bool found=0; my_bool found=0;
DBUG_ENTER("thr_end_alarm"); DBUG_ENTER("thr_end_alarm");
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask); pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
...@@ -230,10 +230,9 @@ void thr_end_alarm(thr_alarm_t *alarmed) ...@@ -230,10 +230,9 @@ void thr_end_alarm(thr_alarm_t *alarmed)
DBUG_ASSERT(!*alarmed || found); DBUG_ASSERT(!*alarmed || found);
if (!found) if (!found)
{ {
#ifdef MAIN if (*alarmed)
printf("Warning: Didn't find alarm %lx in queue of %d alarms\n", fprintf(stderr,"Warning: Didn't find alarm %lx in queue of %d alarms\n",
(long) *alarmed, alarm_queue.elements); (long) *alarmed, alarm_queue.elements);
#endif
DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n", DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",
(long) *alarmed)); (long) *alarmed));
} }
......
...@@ -380,7 +380,7 @@ uint report_port = MYSQL_PORT; ...@@ -380,7 +380,7 @@ uint report_port = MYSQL_PORT;
my_bool master_ssl = 0; my_bool master_ssl = 0;
ulong master_retry_count=0; ulong master_retry_count=0;
ulong bytes_sent = 0L, bytes_received = 0L; ulong bytes_sent= 0L, bytes_received= 0L, net_big_packet_count= 0L;
bool opt_endinfo,using_udf_functions, locked_in_memory; bool opt_endinfo,using_udf_functions, locked_in_memory;
bool opt_using_transactions, using_update_log; bool opt_using_transactions, using_update_log;
......
...@@ -65,11 +65,13 @@ void sql_print_error(const char *format,...); ...@@ -65,11 +65,13 @@ void sql_print_error(const char *format,...);
#define USE_QUERY_CACHE #define USE_QUERY_CACHE
extern uint test_flags; extern uint test_flags;
extern void query_cache_insert(NET *net, const char *packet, ulong length); extern void query_cache_insert(NET *net, const char *packet, ulong length);
extern ulong bytes_sent, bytes_received; extern ulong bytes_sent, bytes_received, net_big_packet_count;
extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
#else #else
#undef statistic_add #undef statistic_add
#undef statistic_increment
#define statistic_add(A,B,C) #define statistic_add(A,B,C)
#define statistic_increment(A,B)
#endif #endif
#define TEST_BLOCKING 8 #define TEST_BLOCKING 8
...@@ -557,6 +559,9 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed, ...@@ -557,6 +559,9 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
DBUG_ENTER("my_net_skip_rest"); DBUG_ENTER("my_net_skip_rest");
DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain)); DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain));
/* The following is good for debugging */
statistic_increment(net_big_packet_count,&LOCK_bytes_received);
if (!thr_alarm_in_use(alarmed)) if (!thr_alarm_in_use(alarmed))
{ {
my_bool old_mode; my_bool old_mode;
......
...@@ -729,6 +729,10 @@ pthread_handler_decl(handle_one_connection,arg) ...@@ -729,6 +729,10 @@ pthread_handler_decl(handle_one_connection,arg)
send_error(net,net->last_errno,NullS); send_error(net,net->last_errno,NullS);
statistic_increment(aborted_threads,&LOCK_status); statistic_increment(aborted_threads,&LOCK_status);
} }
else if (thd->killed)
{
statistic_increment(aborted_threads,&LOCK_status);
}
end_thread: end_thread:
close_connection(net); close_connection(net);
...@@ -905,7 +909,10 @@ bool do_command(THD *thd) ...@@ -905,7 +909,10 @@ bool do_command(THD *thd)
vio_description(net->vio))); vio_description(net->vio)));
/* Check if we can continue without closing the connection */ /* Check if we can continue without closing the connection */
if (net->error != 3) if (net->error != 3)
{
statistic_increment(aborted_threads,&LOCK_status);
DBUG_RETURN(TRUE); // We have to close it. DBUG_RETURN(TRUE); // We have to close it.
}
send_error(net,net->last_errno,NullS); send_error(net,net->last_errno,NullS);
net->error= 0; net->error= 0;
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
......
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