diff options
author | unknown <msvensson@neptunus.(none)> | 2006-07-27 10:54:04 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-07-27 10:54:04 +0200 |
commit | 9c782e6bf15faa78e3cb7babdbb3ec39fefd7ada (patch) | |
tree | 0cde6f92142724492433b81d09819b44606fea7e /client/mysqlslap.c | |
parent | f2eabb870d5a0b00d13fef4c46ff2fb46cbb8193 (diff) | |
download | mariadb-git-9c782e6bf15faa78e3cb7babdbb3ec39fefd7ada.tar.gz |
Bug#21297 rpl_insert fails randomly
- Add loop in mysqlslap that tries to connect up to 10 times if connect
in thread fails.
client/mysqlslap.c:
Add loop to retry connect 10 times with a small sleep in between.
mysql-test/t/disabled.def:
Remove disabling of testcase
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index c061433178b..9c8585915a9 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1113,6 +1113,7 @@ WAIT: DBUG_RETURN(0); } + int run_task(thread_context *con) { @@ -1137,13 +1138,27 @@ run_task(thread_context *con) my_lock(lock_file, F_RDLCK, 0, F_TO_EOF, MYF(0)); if (!opt_only_print) { - if (!(mysql_real_connect(mysql, host, user, opt_password, + /* Connect to server */ + static ulong connection_retry_sleep= 100000; /* Microseconds */ + int i, connect_error= 1; + for (i= 0; i < 10; i++) + { + if (mysql_real_connect(mysql, host, user, opt_password, create_schema_string, opt_mysql_port, opt_mysql_unix_port, - connect_flags))) + connect_flags)) + { + /* Connect suceeded */ + connect_error= 0; + break; + } + my_sleep(connection_retry_sleep); + } + if (connect_error) { - fprintf(stderr,"%s: %s\n",my_progname,mysql_error(mysql)); + fprintf(stderr,"%s: Error when connecting to server: %d %s\n", + my_progname, mysql_errno(mysql), mysql_error(mysql)); goto end; } } |