~ignacio-nin/percona-server/5.1-issue26684

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
74
75
76
77
78
79
80
# name       : log_connection_error.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/mysql-test/r/connect.result b/mysql-test/r/connect.result
--- a/mysql-test/r/connect.result	2010-07-28 16:47:46.895318726 +0400
+++ b/mysql-test/r/connect.result	2010-07-28 16:47:48.234134231 +0400
@@ -1,3 +1,4 @@
+set global log_warnings=0;
 drop table if exists t1,t2;
 show tables;
 Tables_in_mysql
@@ -229,3 +230,4 @@
 # ------------------------------------------------------------------
 # -- End of 5.1 tests
 # ------------------------------------------------------------------
+set global log_warnings=1;
diff -ruN a/mysql-test/t/connect.test b/mysql-test/t/connect.test
--- a/mysql-test/t/connect.test	2010-07-28 16:47:46.865318816 +0400
+++ b/mysql-test/t/connect.test	2010-07-28 16:47:48.057260581 +0400
@@ -1,3 +1,5 @@
+set global log_warnings=0;
+
 # This test is to check various cases of connections
 # with right and wrong password, with and without database
 # Unfortunately the check is incomplete as we can't connect without database
@@ -328,3 +330,4 @@
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 
+set global log_warnings=1;
diff -ruN a/patch_info/log_connection_error.patch b/patch_info/log_connection_error.patch
--- a/patch_info/log_connection_error.patch	1970-01-01 03:00:00.000000000 +0300
+++ b/patch_info/log_connection_error.patch	2010-07-28 16:47:47.634070367 +0400
@@ -0,0 +1,6 @@
+File=log_connection_error.patch
+Name=logging abandoned connections
+Version=1.0
+Author=Percona <info@percona.com>
+License=GPL
+Comment=
diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
--- a/sql/mysqld.cc	2010-07-28 16:47:47.105319218 +0400
+++ b/sql/mysqld.cc	2010-07-28 16:47:47.644101813 +0400
@@ -5064,6 +5064,10 @@
 
     DBUG_PRINT("error",("Too many connections"));
     close_connection(thd, ER_CON_COUNT_ERROR, 1);
+    if (global_system_variables.log_warnings)
+    {
+      sql_print_warning("%s", ER(ER_CON_COUNT_ERROR));
+    }
     statistic_increment(denied_connections, &LOCK_status);
     delete thd;
     DBUG_VOID_RETURN;
@@ -5451,6 +5455,10 @@
     if (!(thd->net.vio= vio_new_win32pipe(hConnectedPipe)) ||
 	my_net_init(&thd->net, thd->net.vio))
     {
+      if (global_system_variables.log_warnings)
+      {
+        sql_print_warning("%s", ER(ER_OUT_OF_RESOURCES));
+      }
       close_connection(thd, ER_OUT_OF_RESOURCES, 1);
       delete thd;
       continue;
@@ -5646,6 +5654,10 @@
                                                    event_conn_closed)) ||
                         my_net_init(&thd->net, thd->net.vio))
     {
+      if (global_system_variables.log_warnings)
+      {
+        sql_print_warning("%s", ER(ER_OUT_OF_RESOURCES));
+      }
       close_connection(thd, ER_OUT_OF_RESOURCES, 1);
       errmsg= 0;
       goto errorconn;