Commit 772adcbd authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Print error if we can't delete an alarm

More debugging variables
Increment aborted_threads in case of killed or too big packet
parent 6876111f
......@@ -100,7 +100,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
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_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(my_bool free_structures);
......
......@@ -127,7 +127,7 @@ void init_thr_alarm(uint max_alarms)
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;
sigset_t old_mask;
......@@ -209,7 +209,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
ALARM *alarm_data;
sigset_t old_mask;
uint i;
bool found=0;
my_bool found=0;
DBUG_ENTER("thr_end_alarm");
pthread_sigmask(SIG_BLOCK,&full_signal_set,&old_mask);
......@@ -230,10 +230,9 @@ void thr_end_alarm(thr_alarm_t *alarmed)
DBUG_ASSERT(!*alarmed || found);
if (!found)
{
#ifdef MAIN
printf("Warning: Didn't find alarm %lx in queue of %d alarms\n",
if (*alarmed)
fprintf(stderr,"Warning: Didn't find alarm %lx in queue of %d alarms\n",
(long) *alarmed, alarm_queue.elements);
#endif
DBUG_PRINT("warning",("Didn't find alarm %lx in queue\n",
(long) *alarmed));
}
......
......@@ -380,7 +380,7 @@ uint report_port = MYSQL_PORT;
my_bool master_ssl = 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_using_transactions, using_update_log;
......
......@@ -65,11 +65,13 @@ void sql_print_error(const char *format,...);
#define USE_QUERY_CACHE
extern uint test_flags;
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;
#else
#undef statistic_add
#undef statistic_increment
#define statistic_add(A,B,C)
#define statistic_increment(A,B)
#endif
#define TEST_BLOCKING 8
......@@ -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_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))
{
my_bool old_mode;
......
......@@ -729,6 +729,10 @@ pthread_handler_decl(handle_one_connection,arg)
send_error(net,net->last_errno,NullS);
statistic_increment(aborted_threads,&LOCK_status);
}
else if (thd->killed)
{
statistic_increment(aborted_threads,&LOCK_status);
}
end_thread:
close_connection(net);
......@@ -905,7 +909,10 @@ bool do_command(THD *thd)
vio_description(net->vio)));
/* Check if we can continue without closing the connection */
if (net->error != 3)
{
statistic_increment(aborted_threads,&LOCK_status);
DBUG_RETURN(TRUE); // We have to close it.
}
send_error(net,net->last_errno,NullS);
net->error= 0;
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