Commit 121f3e4c authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-7429 main.mysqldump fails sporadically in buildbot

prevent concurrent cleanups in multi-threaded mysqlimport
(they can happen if many threads get an error at the same time),
safe_exit() is not thread-safe.
parent cd0813e3
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
/* Global Thread counter */ /* Global Thread counter */
uint counter; uint counter= 0;
pthread_mutex_t counter_mutex; pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold; pthread_cond_t count_threshhold;
...@@ -489,6 +489,11 @@ static void safe_exit(int error, MYSQL *mysql) ...@@ -489,6 +489,11 @@ static void safe_exit(int error, MYSQL *mysql)
{ {
if (error && ignore_errors) if (error && ignore_errors)
return; return;
/* in multi-threaded mode protect from concurrent safe_exit's */
if (counter)
pthread_mutex_lock(&counter_mutex);
if (mysql) if (mysql)
mysql_close(mysql); mysql_close(mysql);
......
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