diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-10-05 22:07:19 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-10-05 22:07:19 +0200 |
commit | 3050b290d5123af0bfa7abf94570b3c8e1ca05df (patch) | |
tree | 63a2fc2677d40dd2c763354a8bf64f3e50a97219 /client | |
parent | 44f9ddd7a27a8e998726c9808bf003f39c7cb67f (diff) | |
download | mariadb-git-3050b290d5123af0bfa7abf94570b3c8e1ca05df.tar.gz |
fix main.mysqldump test failing after Mroonga merge.
mysqlimport had code for multi-threaded import. By mistake it was disabled for
many years, at least since 5.5 (more likely even in 5.1), but mysqlimport happily
accepted (and ignored) --use-threads option ever since.
After Mroonga merge HAVE_LIBPTHREAD became defined and multi-threaded import
suddenly came to life. As it exit() the program brutally on any error (never mind
that some import threads may be running) mysys rightfully complains. Safemalloc
complains too in debug builds.
Fix: don't try a clean exit on an error, don't shutdown mysys and tell safemalloc
to shut up. Yes, and remove #ifdef HAVE_LIBPTHREAD, since 5.5 the client library
is always multi-threaded.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqlimport.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/client/mysqlimport.c b/client/mysqlimport.c index af0d86b1ed5..0d4ee549c4f 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -30,19 +30,15 @@ #include "client_priv.h" #include "mysql_version.h" -#ifdef HAVE_LIBPTHREAD #include <my_pthread.h> -#endif #include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ /* Global Thread counter */ uint counter; -#ifdef HAVE_LIBPTHREAD pthread_mutex_t counter_mutex; pthread_cond_t count_threshhold; -#endif static void db_error_with_table(MYSQL *mysql, char *table); static void db_error(MYSQL *mysql); @@ -502,7 +498,10 @@ static void safe_exit(int error, MYSQL *mysql) free_defaults(argv_to_free); mysql_library_end(); my_free(opt_password); - my_end(my_end_arg); + if (error) + sf_leaking_memory= 1; /* dirty exit, some threads are still running */ + else + my_end(my_end_arg); /* clean exit */ exit(error); } @@ -575,7 +574,6 @@ static char *field_escape(char *to,const char *from,uint length) int exitcode= 0; -#ifdef HAVE_LIBPTHREAD pthread_handler_t worker_thread(void *arg) { int error; @@ -615,7 +613,6 @@ error: return 0; } -#endif int main(int argc, char **argv) @@ -635,7 +632,6 @@ int main(int argc, char **argv) } sf_leaking_memory=0; /* from now on we cleanup properly */ -#ifdef HAVE_LIBPTHREAD if (opt_use_threads && !lock_tables) { pthread_t mainthread; /* Thread descriptor */ @@ -689,7 +685,6 @@ int main(int argc, char **argv) pthread_attr_destroy(&attr); } else -#endif { MYSQL *mysql= 0; if (!(mysql= db_connect(current_host,current_db,current_user,opt_password))) |