Commit 919f8e69 authored by unknown's avatar unknown

Make safe_connect retry faster after connect failure

parent fd74518e
...@@ -2518,7 +2518,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user, ...@@ -2518,7 +2518,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
{ {
int con_error= 1; int con_error= 1;
my_bool reconnect= 1; my_bool reconnect= 1;
static int connection_retry_sleep= 2; /* Seconds */ static ulong connection_retry_sleep= 100000; /* Microseconds */
int i; int i;
for (i= 0; i < opt_max_connect_retries; i++) for (i= 0; i < opt_max_connect_retries; i++)
{ {
...@@ -2528,7 +2528,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user, ...@@ -2528,7 +2528,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
con_error= 0; con_error= 0;
break; break;
} }
sleep(connection_retry_sleep); my_sleep(connection_retry_sleep);
} }
/* /*
TODO: change this to 0 in future versions, but the 'kill' test relies on TODO: change this to 0 in future versions, but the 'kill' test relies on
...@@ -3298,7 +3298,7 @@ static struct my_option my_long_options[] = ...@@ -3298,7 +3298,7 @@ static struct my_option my_long_options[] =
{"max-connect-retries", OPT_MAX_CONNECT_RETRIES, {"max-connect-retries", OPT_MAX_CONNECT_RETRIES,
"Max number of connection attempts when connecting to server", "Max number of connection attempts when connecting to server",
(gptr*) &opt_max_connect_retries, (gptr*) &opt_max_connect_retries, 0, (gptr*) &opt_max_connect_retries, (gptr*) &opt_max_connect_retries, 0,
GET_INT, REQUIRED_ARG, 5, 1, 10, 0, 0, 0}, GET_INT, REQUIRED_ARG, 500, 1, 10000, 0, 0, 0},
{"password", 'p', "Password to use when connecting to server.", {"password", 'p', "Password to use when connecting to server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", (gptr*) &port, {"port", 'P', "Port number to use for connection.", (gptr*) &port,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment