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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
db1402d1
Commit
db1402d1
authored
Sep 06, 2024
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix threading issue during mariadb-import abort.
parent
b332abdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
client/mysqlimport.cc
client/mysqlimport.cc
+9
-3
No files found.
client/mysqlimport.cc
View file @
db1402d1
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
tpool
::
thread_pool
*
thread_pool
;
tpool
::
thread_pool
*
thread_pool
;
static
std
::
vector
<
MYSQL
*>
all_tp_connections
;
static
std
::
vector
<
MYSQL
*>
all_tp_connections
;
std
::
atomic
<
bool
>
aborting
{
false
};
static
void
kill_tp_connections
(
MYSQL
*
mysql
);
static
void
kill_tp_connections
(
MYSQL
*
mysql
);
static
void
db_error_with_table
(
MYSQL
*
mysql
,
char
*
table
);
static
void
db_error_with_table
(
MYSQL
*
mysql
,
char
*
table
);
...
@@ -591,6 +592,8 @@ static int handle_one_table(const table_load_params *params, MYSQL *mysql)
...
@@ -591,6 +592,8 @@ static int handle_one_table(const table_load_params *params, MYSQL *mysql)
DBUG_ENTER
(
"handle_one_table"
);
DBUG_ENTER
(
"handle_one_table"
);
DBUG_PRINT
(
"enter"
,(
"datafile: %s"
,
params
->
data_file
.
c_str
()));
DBUG_PRINT
(
"enter"
,(
"datafile: %s"
,
params
->
data_file
.
c_str
()));
if
(
aborting
)
return
1
;
if
(
verbose
&&
!
params
->
sql_file
.
empty
())
if
(
verbose
&&
!
params
->
sql_file
.
empty
())
{
{
fprintf
(
stdout
,
"Executing SQL script %s
\n
"
,
params
->
sql_file
.
c_str
());
fprintf
(
stdout
,
"Executing SQL script %s
\n
"
,
params
->
sql_file
.
c_str
());
...
@@ -886,6 +889,10 @@ static void safe_exit(int error, MYSQL *mysql)
...
@@ -886,6 +889,10 @@ static void safe_exit(int error, MYSQL *mysql)
if
(
error
&&
ignore_errors
)
if
(
error
&&
ignore_errors
)
return
;
return
;
bool
expected
=
false
;
if
(
!
aborting
.
compare_exchange_strong
(
expected
,
true
))
return
;
if
(
thread_pool
)
if
(
thread_pool
)
{
{
/* dirty exit. some threads are running,
/* dirty exit. some threads are running,
...
@@ -897,10 +904,7 @@ static void safe_exit(int error, MYSQL *mysql)
...
@@ -897,10 +904,7 @@ static void safe_exit(int error, MYSQL *mysql)
We still need tell server to kill all connections
We still need tell server to kill all connections
so it does not keep busy with load.
so it does not keep busy with load.
*/
*/
static
std
::
mutex
exit_mutex
;
std
::
lock_guard
<
std
::
mutex
>
lock
(
exit_mutex
);
kill_tp_connections
(
mysql
);
kill_tp_connections
(
mysql
);
all_tp_connections
.
clear
();
}
}
_exit
(
error
);
_exit
(
error
);
...
@@ -920,6 +924,8 @@ static void safe_exit(int error, MYSQL *mysql)
...
@@ -920,6 +924,8 @@ static void safe_exit(int error, MYSQL *mysql)
static
void
db_error_with_table
(
MYSQL
*
mysql
,
char
*
table
)
static
void
db_error_with_table
(
MYSQL
*
mysql
,
char
*
table
)
{
{
if
(
aborting
)
return
;
my_printf_error
(
0
,
"Error: %d, %s, when using table: %s"
,
my_printf_error
(
0
,
"Error: %d, %s, when using table: %s"
,
MYF
(
0
),
mysql_errno
(
mysql
),
mysql_error
(
mysql
),
table
);
MYF
(
0
),
mysql_errno
(
mysql
),
mysql_error
(
mysql
),
table
);
safe_exit
(
1
,
mysql
);
safe_exit
(
1
,
mysql
);
...
...
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