~percona-dev/percona-server/release-5.5.11-20.2-fix-bug-764138

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# name       : remove_fcntl_excessive_calls.patch
# introduced : 12
# maintainer : Oleg
#
#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
diff -ruN a/patch_info/remove_fcntl_excessive_calls.info b/patch_info/remove_fcntl_excessive_calls.info
--- a/patch_info/remove_fcntl_excessive_calls.info	1970-01-01 03:00:00.000000000 +0300
+++ b/patch_info/remove_fcntl_excessive_calls.info	2010-07-22 21:42:08.560424001 +0400
@@ -0,0 +1,6 @@
+File=remove_fcntl_excessive_calls.patch
+Name=remove fcntl excessive calls
+Version=1.0
+Author=This is a port of the official fix.
+License=GPL
+Comment=
diff -ruN a/sql/net_serv.cc b/sql/net_serv.cc
--- a/sql/net_serv.cc	2010-06-03 19:50:27.000000000 +0400
+++ b/sql/net_serv.cc	2010-07-22 21:40:30.680424001 +0400
@@ -61,7 +61,7 @@
   the client should have a bigger max_allowed_packet.
 */
 
-#if defined(__WIN__) || !defined(MYSQL_SERVER)
+#if (defined(__WIN__) || !defined(MYSQL_SERVER)) && !defined(NO_ALARM)
   /* The following is because alarms doesn't work on windows. */
 #ifndef NO_ALARM
 #define NO_ALARM
@@ -133,7 +133,7 @@
   if (vio != 0)					/* If real connection */
   {
     net->fd  = vio_fd(vio);			/* For perl DBI/DBD */
-#if defined(MYSQL_SERVER) && !defined(__WIN__)
+#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(NO_ALARM)
     if (!(test_flags & TEST_BLOCKING))
     {
       my_bool old_mode;
@@ -632,7 +632,7 @@
     if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0)
     {
       my_bool interrupted = vio_should_retry(net->vio);
-#if !defined(__WIN__)
+#if !defined(NO_ALARM) && !defined(__WIN__)
       if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed))
       {
         if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff))
@@ -688,7 +688,7 @@
     pos+=length;
     update_statistics(thd_increment_bytes_sent(length));
   }
-#ifndef __WIN__
+#if !defined(NO_ALARM) && !defined(__WIN__)
  end:
 #endif
 #ifdef HAVE_COMPRESS
@@ -820,6 +820,7 @@
     thr_alarm(&alarmed,net->read_timeout,&alarm_buff);
 #else
   /* Read timeout is set in my_net_set_read_timeout */
+  DBUG_ASSERT(net_blocking);
 #endif /* NO_ALARM */
 
     pos = net->buff + net->where_b;		/* net->packet -4 */
@@ -834,7 +835,7 @@
 
 	  DBUG_PRINT("info",("vio_read returned %ld  errno: %d",
 			     (long) length, vio_errno(net->vio)));
-#if !defined(__WIN__) || defined(MYSQL_SERVER)
+#if !defined(NO_ALARM) && (!defined(__WIN__) || defined(MYSQL_SERVER))
 	  /*
 	    We got an error that there was no data on the socket. We now set up
 	    an alarm to not 'read forever', change the socket to non blocking