Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

bk commit into 5.0 tree (anozdrin:1.2524) BUG#16918

From: Alexander Nozdrin <alik(at)mysql.com>
Date: Wed Sep 12 2007 - 06:56:10 EDT


Below is the list of changes that have just been committed into a local 5.0 repository of alik. When alik does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository.
For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@1.2524, 2007-09-12 14:56:06+04:00, anozdrin@station. +4 -0   Bug#16918: Aborted_clients > Connections.   

  The problem was that aborted_threads variable was updated   twice when a client connection had been aborted.   

  The fix is to refactor a code to have aborted_threads updated   only in one place.

  mysql-test/r/kill.result@1.20, 2007-09-12 14:56:04+04:00, anozdrin@station. +11 -0     Update test file.

  mysql-test/t/kill.test@1.28, 2007-09-12 14:56:04+04:00, anozdrin@station. +27 -0     Test for Bug#16918.

  sql/mysql_priv.h@1.461, 2007-09-12 14:56:04+04:00, anozdrin@station. +0 -1     Make do_command() a private function.

  sql/sql_parse.cc@1.636, 2007-09-12 14:56:04+04:00, anozdrin@station. +17 -10

  1. Make do_command() a private function;
  2. Update aborted_threads in the only one place.
Do you need help?X

diff -Nrup a/mysql-test/r/kill.result b/mysql-test/r/kill.result

--- a/mysql-test/r/kill.result	2007-06-22 05:39:48 +04:00

+++ b/mysql-test/r/kill.result 2007-09-12 14:56:04 +04:00
@@ -125,3 +125,14 @@ drop function bug27563;  drop procedure proc27563;
 PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40 WHERE a1=a2 AND a2=a3 AND a3=a4 AND a4=a5 AND a5=a6 AND a6=a7 AND a7=a8 AND a8=a9 AND a9=a10 AND a10=a11 AND a11=a12 AND a12=a13 AND a13=a14 AND a14=a15 AND a15=a16 AND a16=a17 AND a17=a18 AND a18=a19 AND a19=a20 AND a20=a21 AND a21=a22 AND a22=a23 AND a23=a24 AND a24=a25 AND a25=a26 AND a26=a27 AND a27=a28 AND a28=a29 AND a29=a30 AND a30=a31 AND a31=a32 AND a32=a33 AND a33=a34 AND a34=a35 AND a35=a36 AND a36=a37 AND a37=a38 AND a38=a39 AND a39=a40 ';  EXECUTE stmt;
+#
+# Bug#16918: Aborted_clients > Connections.
+#
+
+SHOW STATUS LIKE 'Aborted_clients';
+Variable_name Value
+Aborted_clients 2
+
+SHOW STATUS LIKE 'Aborted_clients';
+Variable_name Value
+Aborted_clients 3

diff -Nrup a/mysql-test/t/kill.test b/mysql-test/t/kill.test
--- a/mysql-test/t/kill.test	2007-06-22 05:39:48 +04:00

+++ b/mysql-test/t/kill.test 2007-09-12 14:56:04 +04:00
@@ -304,3 +304,30 @@ while ($i)

   dec $i ;
 }
 --enable_query_log
+
+###########################################################################
+
+#
+# Bug#16918: Aborted_clients > Connections.
+#
+
+--echo #
+--echo # Bug#16918: Aborted_clients > Connections.
+--echo #
+
+--echo
+SHOW STATUS LIKE 'Aborted_clients';
+
+--perl
+my $pid = `$ENV{'MYSQL'} >/dev/null 2>&1 </dev/zero & echo \$!`;
+chomp $pid;
+
+sleep (1);
+
+system ("kill -9 $pid");
+EOF
+
+--echo
+SHOW STATUS LIKE 'Aborted_clients';
+
+###########################################################################
diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h

--- a/sql/mysql_priv.h	2007-08-16 20:56:08 +04:00

+++ b/sql/mysql_priv.h 2007-09-12 14:56:04 +04:00
@@ -726,7 +726,6 @@ pthread_handler_t handle_bootstrap(void  void end_thread(THD *thd,bool put_in_cache);  void flush_thread_cache();
 bool mysql_execute_command(THD *thd);
-bool do_command(THD *thd);
 bool dispatch_command(enum enum_server_command command, THD *thd,

                       char* packet, uint packet_length);  void log_slow_statement(THD *thd);
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc

--- a/sql/sql_parse.cc	2007-08-05 07:53:13 +04:00

+++ b/sql/sql_parse.cc 2007-09-12 14:56:04 +04:00
@@ -93,6 +93,8 @@ const char *xa_state_names[]={

   "NON-EXISTING", "ACTIVE", "IDLE", "PREPARED"  };  

+static bool do_command(THD *thd);
+

 #ifdef __WIN__
 static void test_signal(int sig_ptr)
 {
@@ -1199,23 +1201,28 @@ pthread_handler_t handle_one_connection(

     }
     if (thd->user_connect)
       decrease_user_connections(thd->user_connect);

+
+ if (thd->killed ||
+ net->vio && net->error && net->report_error)
+ {
+ statistic_increment(aborted_threads, &LOCK_status);
+ }
+
     if (net->error && net->vio != 0 && net->report_error)
     {
       if (!thd->killed && thd->variables.log_warnings > 1)
-	sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),

+ {
+ sql_print_warning(ER(ER_NEW_ABORTING_CONNECTION),
thd->thread_id,(thd->db ? thd->db : "unconnected"), sctx->user ? sctx->user : "unauthenticated", sctx->host_or_ip, (net->last_errno ? ER(net->last_errno) : ER(ER_UNKNOWN_ERROR)));
+ }
+
net_send_error(thd, net->last_errno, NullS); - statistic_increment(aborted_threads,&LOCK_status); } - else if (thd->killed) - { - statistic_increment(aborted_threads,&LOCK_status);
- }
-
+

 end_thread:
     close_connection(thd, 0, 1);
     end_thread(thd,1);
@@ -1550,12 +1557,12 @@ bool do_command(THD *thd)
     DBUG_PRINT("info",("Got error %d reading command from socket %s",
 		       net->error,
 		       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.
- }
+
     net_send_error(thd, net->last_errno, NullS);
     net->error= 0;
     DBUG_RETURN(FALSE);
-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Wed Sep 12 06:54:46 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:21:05 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library