Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9d1c19c7
Commit
9d1c19c7
authored
May 03, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for specifyihng the number of reconnec retries oin the command line
parent
3f56853f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
client/mysqltest.c
client/mysqltest.c
+19
-14
No files found.
client/mysqltest.c
View file @
9d1c19c7
...
@@ -87,14 +87,6 @@
...
@@ -87,14 +87,6 @@
#endif
#endif
#define MAX_SERVER_ARGS 64
#define MAX_SERVER_ARGS 64
/*
Sometimes in a test the client starts before
the server - to solve the problem, we try again
after some sleep if connection fails the first
time
*/
#define CON_RETRY_SLEEP 2
#define MAX_CON_TRIES 5
#define SLAVE_POLL_INTERVAL 300000
/* 0.3 of a sec */
#define SLAVE_POLL_INTERVAL 300000
/* 0.3 of a sec */
#define DEFAULT_DELIMITER ";"
#define DEFAULT_DELIMITER ";"
...
@@ -108,7 +100,7 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
...
@@ -108,7 +100,7 @@ enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
OPT_MANAGER_PORT
,
OPT_MANAGER_WAIT_TIMEOUT
,
OPT_SKIP_SAFEMALLOC
,
OPT_MANAGER_PORT
,
OPT_MANAGER_WAIT_TIMEOUT
,
OPT_SKIP_SAFEMALLOC
,
OPT_SSL_SSL
,
OPT_SSL_KEY
,
OPT_SSL_CERT
,
OPT_SSL_CA
,
OPT_SSL_CAPATH
,
OPT_SSL_SSL
,
OPT_SSL_KEY
,
OPT_SSL_CERT
,
OPT_SSL_CA
,
OPT_SSL_CAPATH
,
OPT_SSL_CIPHER
,
OPT_PS_PROTOCOL
,
OPT_SP_PROTOCOL
,
OPT_CURSOR_PROTOCOL
,
OPT_SSL_CIPHER
,
OPT_PS_PROTOCOL
,
OPT_SP_PROTOCOL
,
OPT_CURSOR_PROTOCOL
,
OPT_VIEW_PROTOCOL
,
OPT_SSL_VERIFY_SERVER_CERT
};
OPT_VIEW_PROTOCOL
,
OPT_SSL_VERIFY_SERVER_CERT
,
OPT_MAX_CONNECT_RETRIES
};
/* ************************************************************************ */
/* ************************************************************************ */
/*
/*
...
@@ -157,6 +149,7 @@ static int record = 0, opt_sleep=0;
...
@@ -157,6 +149,7 @@ static int record = 0, opt_sleep=0;
static
char
*
db
=
0
,
*
pass
=
0
;
static
char
*
db
=
0
,
*
pass
=
0
;
const
char
*
user
=
0
,
*
host
=
0
,
*
unix_sock
=
0
,
*
opt_basedir
=
"./"
;
const
char
*
user
=
0
,
*
host
=
0
,
*
unix_sock
=
0
,
*
opt_basedir
=
"./"
;
static
int
port
=
0
;
static
int
port
=
0
;
static
int
opt_max_connect_retries
;
static
my_bool
opt_big_test
=
0
,
opt_compress
=
0
,
silent
=
0
,
verbose
=
0
;
static
my_bool
opt_big_test
=
0
,
opt_compress
=
0
,
silent
=
0
,
verbose
=
0
;
static
my_bool
tty_password
=
0
;
static
my_bool
tty_password
=
0
;
static
my_bool
ps_protocol
=
0
,
ps_protocol_enabled
=
0
;
static
my_bool
ps_protocol
=
0
,
ps_protocol_enabled
=
0
;
...
@@ -2125,9 +2118,16 @@ void init_manager()
...
@@ -2125,9 +2118,16 @@ void init_manager()
db, port, sock
db, port, sock
NOTE
NOTE
This function will try to connect to the given server MAX_CON_TRIES
times and sleep CON_RETRY_SLEEP seconds between attempts before
Sometimes in a test the client starts before
finally giving up. This helps in situation when the client starts
the server - to solve the problem, we try again
after some sleep if connection fails the first
time
This function will try to connect to the given server
"opt_max_connect_retries" times and sleep "connection_retry_sleep"
seconds between attempts before finally giving up.
This helps in situation when the client starts
before the server (which happens sometimes).
before the server (which happens sometimes).
It will ignore any errors during these retries. One should use
It will ignore any errors during these retries. One should use
connect_n_handle_errors() if he expects a connection error and wants
connect_n_handle_errors() if he expects a connection error and wants
...
@@ -2142,8 +2142,9 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
...
@@ -2142,8 +2142,9 @@ 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 */
int
i
;
int
i
;
for
(
i
=
0
;
i
<
MAX_CON_TRIES
;
++
i
)
for
(
i
=
0
;
i
<
opt_max_connect_retries
;
i
++
)
{
{
if
(
mysql_real_connect
(
mysql
,
host
,
user
,
pass
,
db
,
port
,
sock
,
if
(
mysql_real_connect
(
mysql
,
host
,
user
,
pass
,
db
,
port
,
sock
,
CLIENT_MULTI_STATEMENTS
|
CLIENT_REMEMBER_OPTIONS
))
CLIENT_MULTI_STATEMENTS
|
CLIENT_REMEMBER_OPTIONS
))
...
@@ -2151,7 +2152,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
...
@@ -2151,7 +2152,7 @@ int safe_connect(MYSQL* mysql, const char *host, const char *user,
con_error
=
0
;
con_error
=
0
;
break
;
break
;
}
}
sleep
(
CON_RETRY_SLEEP
);
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
...
@@ -2887,6 +2888,10 @@ static struct my_option my_long_options[] =
...
@@ -2887,6 +2888,10 @@ static struct my_option my_long_options[] =
{
"compress"
,
'C'
,
"Use the compressed server/client protocol."
,
{
"compress"
,
'C'
,
"Use the compressed server/client protocol."
,
(
gptr
*
)
&
opt_compress
,
(
gptr
*
)
&
opt_compress
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
(
gptr
*
)
&
opt_compress
,
(
gptr
*
)
&
opt_compress
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
},
{
"max-connect-retries"
,
OPT_MAX_CONNECT_RETRIES
,
"Max number of connection attempts when connecting to server"
,
(
gptr
*
)
&
opt_max_connect_retries
,
(
gptr
*
)
&
opt_max_connect_retries
,
0
,
GET_INT
,
REQUIRED_ARG
,
5
,
1
,
10
,
0
,
0
,
0
},
{
"cursor-protocol"
,
OPT_CURSOR_PROTOCOL
,
"Use cursors for prepared statements."
,
{
"cursor-protocol"
,
OPT_CURSOR_PROTOCOL
,
"Use cursors for prepared statements."
,
(
gptr
*
)
&
cursor_protocol
,
(
gptr
*
)
&
cursor_protocol
,
0
,
(
gptr
*
)
&
cursor_protocol
,
(
gptr
*
)
&
cursor_protocol
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment