diff options
author | Monty <monty@mariadb.org> | 2015-11-29 17:51:23 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-11-29 17:51:23 +0200 |
commit | c3018b0ff4fb02c029787d03867adf0530607bab (patch) | |
tree | c3497838c222af9445a16312ecbd0e78ebc62f66 /client/mysqlslap.c | |
parent | 654547b5b4b21aec719a84149595464364c96eea (diff) | |
download | mariadb-git-c3018b0ff4fb02c029787d03867adf0530607bab.tar.gz |
Fixes to get all test to run on MacosX Lion 10.7
This includes fixing all utilities to not have any memory leaks,
as safemalloc warnings stopped tests from passing on MacOSX.
- Ensure that all clients takes character-set-dir, as the
libmysqlclient library will use it.
- mysql-test-run now passes character-set-dir to all external clients.
- Changed dynstr_free() so that it can be called twice (made freeing code easier)
- Changed rpl_global_gtid_slave_state to be allocated dynamicly as it
includes a mutex that needs to be initizlied/destroyed before my_end() is called.
- Removed rpl_slave_state::init() and rpl_slave_stage::deinit() as
their job are better handling by constructor and delete.
- Print alias instead of table_name in check_duplicate_key as
table_name may have been converted to lower case.
Other things:
- Fixed a case in time_to_datetime_with_warn() where we where
using && instead of & in tests
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index f12ea4c2086..29919f3028d 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -168,6 +168,7 @@ static ulonglong auto_generate_sql_number; const char *concurrency_str= NULL; static char *create_string; uint *concurrency; +static char mysql_charsets_dir[FN_REFLEN+1]; const char *default_dbug_option="d:t:o,/tmp/mysqlslap.trace"; const char *opt_csv_str; @@ -372,6 +373,7 @@ int main(int argc, char **argv) { fprintf(stderr,"%s: Error when connecting to server: %s\n", my_progname,mysql_error(&mysql)); + mysql_close(&mysql); free_defaults(defaults_argv); my_end(0); exit(1); @@ -417,8 +419,7 @@ int main(int argc, char **argv) pthread_mutex_destroy(&sleeper_mutex); pthread_cond_destroy(&sleep_threshhold); - if (!opt_only_print) - mysql_close(&mysql); /* Close & free connection */ + mysql_close(&mysql); /* Close & free connection */ /* now free all the strings we created */ my_free(opt_password); @@ -585,6 +586,9 @@ static struct my_option my_long_options[] = "Number of row inserts to perform for each thread (default is 100).", &auto_generate_sql_number, &auto_generate_sql_number, 0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0}, + {"character-sets-dir", OPT_CHARSETS_DIR, + "Directory for character set files.", &charsets_dir, + &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.", &commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -782,6 +786,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), DBUG_PUSH(argument ? argument : default_dbug_option); debug_check_flag= 1; break; + case OPT_CHARSETS_DIR: + strmake_buf(mysql_charsets_dir, argument); + charsets_dir = mysql_charsets_dir; + break; case OPT_SLAP_CSV: if (!argument) argument= (char *)"-"; /* use stdout */ @@ -1863,21 +1871,21 @@ pthread_handler_t run_task(void *p) } pthread_mutex_unlock(&sleeper_mutex); - if (!(mysql= mysql_init(NULL))) + if (mysql_thread_init()) { - fprintf(stderr,"%s: mysql_init() failed ERROR : %s\n", - my_progname, mysql_error(mysql)); + fprintf(stderr,"%s: mysql_thread_init() failed\n", my_progname); exit(0); } - set_mysql_connect_options(mysql); - if (mysql_thread_init()) + if (!(mysql= mysql_init(NULL))) { - fprintf(stderr,"%s: mysql_thread_init() failed ERROR : %s\n", - my_progname, mysql_error(mysql)); + fprintf(stderr,"%s: mysql_init() failed\n", my_progname); + mysql_thread_end(); exit(0); } + set_mysql_connect_options(mysql); + DBUG_PRINT("info", ("trying to connect to host %s as user %s", host, user)); if (!opt_only_print) @@ -1995,8 +2003,7 @@ end: if (commit_rate) run_query(mysql, "COMMIT", strlen("COMMIT")); - if (!opt_only_print) - mysql_close(mysql); + mysql_close(mysql); mysql_thread_end(); |