summaryrefslogtreecommitdiff
path: root/sql/net_serv.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/net_serv.cc')
-rw-r--r--sql/net_serv.cc30
1 files changed, 17 insertions, 13 deletions
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index bd4505a3d7f..44539ec2d74 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -72,7 +72,7 @@
/* The following is because alarms doesn't work on windows. */
#define NO_ALARM
#endif
-
+
#ifndef NO_ALARM
#include "my_pthread.h"
void sql_print_error(const char *format,...);
@@ -83,7 +83,6 @@ void sql_print_error(const char *format,...);
#include "thr_alarm.h"
#ifdef MYSQL_SERVER
-#define USE_QUERY_CACHE
/*
The following variables/functions should really not be declared
extern, but as it's hard to include mysql_priv.h here, we have to
@@ -92,12 +91,16 @@ void sql_print_error(const char *format,...);
extern uint test_flags;
extern ulong bytes_sent, bytes_received, net_big_packet_count;
extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
+#ifndef MYSQL_INSTANCE_MANAGER
extern void query_cache_insert(NET *net, const char *packet, ulong length);
-#else
-#undef statistic_add
-#undef statistic_increment
-#define statistic_add(A,B,C)
-#define statistic_increment(A,B)
+#define USE_QUERY_CACHE
+#define update_statistics(A) A
+#endif /* MYSQL_INSTANCE_MANGER */
+#endif /* defined(MYSQL_SERVER) && !defined(MYSQL_INSTANCE_MANAGER) */
+
+#if !defined(MYSQL_SERVER) || defined(MYSQL_INSTANCE_MANAGER)
+#define update_statistics(A)
+#define thd_increment_bytes_sent(N)
#endif
#define TEST_BLOCKING 8
@@ -118,7 +121,7 @@ my_bool my_net_init(NET *net, Vio* vio)
DBUG_RETURN(1);
net->buff_end=net->buff+net->max_packet;
net->vio = vio;
- net->no_send_ok = 0;
+ net->no_send_ok= net->no_send_eof= net->no_send_error= 0;
net->error=0; net->return_errno=0; net->return_status=0;
net->pkt_nr=net->compress_pkt_nr=0;
net->write_pos=net->read_pos = net->buff;
@@ -445,7 +448,8 @@ net_real_write(NET *net,const char *packet,ulong len)
my_bool net_blocking = vio_is_blocking(net->vio);
DBUG_ENTER("net_real_write");
-#if defined(MYSQL_SERVER) && defined(HAVE_QUERY_CACHE)
+#if defined(MYSQL_SERVER) && defined(HAVE_QUERY_CACHE) \
+ && !defined(MYSQL_INSTANCE_MANAGER)
if (net->query_cache_query != 0)
query_cache_insert(net, packet, len);
#endif
@@ -554,7 +558,7 @@ net_real_write(NET *net,const char *packet,ulong len)
break;
}
pos+=length;
- statistic_add(bytes_sent,length,&LOCK_bytes_sent);
+ update_statistics(thd_increment_bytes_sent(length));
}
#ifndef __WIN__
end:
@@ -625,7 +629,7 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain));
/* The following is good for debugging */
- statistic_increment(net_big_packet_count,&LOCK_bytes_received);
+ update_statistics(thd_increment_net_big_packet_count(1));
if (!thr_alarm_in_use(alarmed))
{
@@ -641,7 +645,7 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
uint length= min(remain, net->max_packet);
if (net_safe_read(net, (char*) net->buff, length, alarmed))
DBUG_RETURN(1);
- statistic_add(bytes_received, length, &LOCK_bytes_received);
+ update_statistics(thd_increment_bytes_received(length));
remain -= (uint32) length;
}
if (old != MAX_PACKET_LENGTH)
@@ -766,7 +770,7 @@ my_real_read(NET *net, ulong *complen)
}
remain -= (uint32) length;
pos+= (ulong) length;
- statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received);
+ update_statistics(thd_increment_bytes_received(length));
}
if (i == 0)
{ /* First parts is packet length */