List:Commits« Previous MessageNext Message »
From:msvensson Date:December 1 2006 3:23pm
Subject:bk commit into 4.1 tree (msvensson:1.2576) BUG#24389
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson 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@stripped, 2006-12-01 16:23:14+01:00, msvensson@neptunus.(none) +2 -0
  Bug#24389 mysqltest: Could not open connection 'default': 2013 Lost connection to MySQL
   - When vio_pool_read, return error code inidcating connection to server could not
     be established.
   - Add CR_CONN_HOST_ERROR to list of errorcode that trigger another connection
     attempt in mysqltest

  client/mysqltest.c@stripped, 2006-12-01 16:23:12+01:00, msvensson@neptunus.(none) +4 -2
    Add CR_CONN_HOST_ERROR to errorcodes that trigger a reconnect

  sql-common/client.c@stripped, 2006-12-01 16:23:12+01:00, msvensson@neptunus.(none) +11 -4
    When using connect_timeout the result of the connect is not checked
    until vio_poll_read and if that fails the connection to server could
    neo be established. Thus change the error message from CR_SERVER_LOST to
    CR_CONNECTION_ERROR/CR_CONN_HOST_ERROR

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/mysql-4.1-maint

--- 1.95/sql-common/client.c	2006-12-01 16:23:19 +01:00
+++ 1.96/sql-common/client.c	2006-12-01 16:23:19 +01:00
@@ -1889,12 +1889,20 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
   if (mysql->options.max_allowed_packet)
     net->max_packet_size= mysql->options.max_allowed_packet;
 
-  /* Get version info */
-  mysql->protocol_version= PROTOCOL_VERSION;	/* Assume this */
+  /*
+    When using connect_timeout the connect was only started
+    by my_connect(), it's now time to wait for connection to
+    be established
+   */
   if (mysql->options.connect_timeout &&
       vio_poll_read(net->vio, mysql->options.connect_timeout))
   {
-    set_mysql_error(mysql, CR_SERVER_LOST, unknown_sqlstate);
+    /* Connection failed, errorcode depends on connection used */
+    DBUG_ASSERT(mysql->options.protocol == MYSQL_PROTOCOL_SOCKET ||
+                mysql->options.protocol == MYSQL_PROTOCOL_TCP);
+    set_mysql_error(mysql,
+                    mysql->options.protocol == MYSQL_PROTOCOL_SOCKET ?
+                    CR_CONNECTION_ERROR :CR_CONN_HOST_ERROR, unknown_sqlstate);
     goto error;
   }
 
@@ -1906,7 +1914,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
     goto error;
 
   /* Check if version of protocol matches current one */
-
   mysql->protocol_version= net->read_pos[0];
   DBUG_DUMP("packet",(char*) net->read_pos,10);
   DBUG_PRINT("info",("mysql protocol version %d, server=%d",

--- 1.226/client/mysqltest.c	2006-12-01 16:23:19 +01:00
+++ 1.227/client/mysqltest.c	2006-12-01 16:23:19 +01:00
@@ -2959,10 +2959,12 @@ void safe_connect(MYSQL* mysql, const ch
       Connect failed
 
       Only allow retry if this was an error indicating the server
-      could not be contacted
+      could not be contacted. Error code differs depending
+      on protocol/connection type
     */
 
-    if (mysql_errno(mysql) == CR_CONNECTION_ERROR &&
+    if ((mysql_errno(mysql) == CR_CONN_HOST_ERROR ||
+         mysql_errno(mysql) == CR_CONNECTION_ERROR) &&
         failed_attempts < opt_max_connect_retries)
       my_sleep(connection_retry_sleep);
     else
Thread
bk commit into 4.1 tree (msvensson:1.2576) BUG#24389msvensson1 Dec