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
91826970
Commit
91826970
authored
Aug 30, 2017
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix threadpool to report connections aborted due to wait timeout.
Update wait_timeout.test to add test case for this.
parent
d20fa485
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
24 deletions
+53
-24
mysql-test/r/wait_timeout.result
mysql-test/r/wait_timeout.result
+6
-0
mysql-test/r/wait_timeout_not_windows.result
mysql-test/r/wait_timeout_not_windows.result
+0
-6
mysql-test/t/wait_timeout.test
mysql-test/t/wait_timeout.test
+14
-2
mysql-test/t/wait_timeout_not_windows.test
mysql-test/t/wait_timeout_not_windows.test
+0
-15
sql/signal_handler.cc
sql/signal_handler.cc
+4
-0
sql/sql_class.cc
sql/sql_class.cc
+3
-0
sql/sql_class.h
sql/sql_class.h
+5
-0
sql/threadpool_common.cc
sql/threadpool_common.cc
+21
-1
No files found.
mysql-test/r/wait_timeout.result
View file @
91826970
...
...
@@ -35,3 +35,9 @@ SELECT 3;
SET @@global.wait_timeout= <start_value>;
disconnect con1;
connect default,localhost,root,,test,,;
set global log_warnings=2;
connect foo,localhost,root;
set @@wait_timeout=1;
connection default;
FOUND 1 /Aborted.*Got timeout reading communication packets/ in mysqld.1.err
set global log_warnings=@@log_warnings;
mysql-test/r/wait_timeout_not_windows.result
deleted
100644 → 0
View file @
d20fa485
set global log_warnings=2;
connect foo,localhost,root;
set @@wait_timeout=1;
connection default;
FOUND 1 /Aborted.*Got timeout reading communication packets/ in mysqld.1.err
set global log_warnings=@@log_warnings;
mysql-test/t/wait_timeout.test
View file @
91826970
...
...
@@ -122,10 +122,22 @@ SELECT 3;
eval
SET
@@
global
.
wait_timeout
=
$start_value
;
disconnect
con1
;
# The last connect is to keep tools checking the current test happy.
connect
(
default
,
localhost
,
root
,,
test
,,);
#
# MDEV-7775 Wrong error message (Unknown error) when idle sessions are killed after wait_timeout
#
set
global
log_warnings
=
2
;
connect
(
foo
,
localhost
,
root
);
set
@@
wait_timeout
=
1
;
sleep
2
;
connection
default
;
let
SEARCH_FILE
=
$MYSQLTEST_VARDIR
/
log
/
mysqld
.
1.
err
;
let
SEARCH_PATTERN
=
Aborted
.*
Got
timeout
reading
communication
packets
;
source
include
/
search_pattern_in_file
.
inc
;
set
global
log_warnings
=@@
log_warnings
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/wait_timeout_not_windows.test
deleted
100644 → 0
View file @
d20fa485
source
include
/
not_embedded
.
inc
;
source
include
/
not_windows
.
inc
;
#
# MDEV-7775 Wrong error message (Unknown error) when idle sessions are killed after wait_timeout
#
set
global
log_warnings
=
2
;
connect
(
foo
,
localhost
,
root
);
set
@@
wait_timeout
=
1
;
sleep
2
;
connection
default
;
let
SEARCH_FILE
=
$MYSQLTEST_VARDIR
/
log
/
mysqld
.
1.
err
;
let
SEARCH_PATTERN
=
Aborted
.*
Got
timeout
reading
communication
packets
;
source
include
/
search_pattern_in_file
.
inc
;
set
global
log_warnings
=@@
log_warnings
;
sql/signal_handler.cc
View file @
91826970
...
...
@@ -204,6 +204,10 @@ extern "C" sig_handler handle_fatal_signal(int sig)
case
KILL_SLAVE_SAME_ID
:
kreason
=
"KILL_SLAVE_SAME_ID"
;
break
;
case
KILL_WAIT_TIMEOUT
:
case
KILL_WAIT_TIMEOUT_HARD
:
kreason
=
"KILL_WAIT_TIMEOUT"
;
break
;
}
my_safe_printf_stderr
(
"%s"
,
"
\n
"
"Trying to get some variables.
\n
"
...
...
sql/sql_class.cc
View file @
91826970
...
...
@@ -2008,6 +2008,9 @@ int THD::killed_errno()
DBUG_RETURN
(
ER_SERVER_SHUTDOWN
);
case
KILL_SLAVE_SAME_ID
:
DBUG_RETURN
(
ER_SLAVE_SAME_ID
);
case
KILL_WAIT_TIMEOUT
:
case
KILL_WAIT_TIMEOUT_HARD
:
DBUG_RETURN
(
ER_NET_READ_INTERRUPTED
);
}
DBUG_RETURN
(
0
);
// Keep compiler happy
}
...
...
sql/sql_class.h
View file @
91826970
...
...
@@ -492,6 +492,11 @@ enum killed_state
KILL_SYSTEM_THREAD_HARD
=
15
,
KILL_SERVER
=
16
,
KILL_SERVER_HARD
=
17
,
/*
Used in threadpool to signal wait timeout.
*/
KILL_WAIT_TIMEOUT
=
18
,
KILL_WAIT_TIMEOUT_HARD
=
19
};
...
...
sql/threadpool_common.cc
View file @
91826970
...
...
@@ -308,6 +308,24 @@ static void threadpool_remove_connection(THD *thd)
my_thread_end
();
}
/*
Ensure that proper error message is sent to client,
and "aborted" message appears in the log in case of
wait timeout.
See also timeout handling in net_serv.cc
*/
static
void
handle_wait_timeout
(
THD
*
thd
)
{
thd
->
get_stmt_da
()
->
reset_diagnostics_area
();
thd
->
reset_killed
();
my_error
(
ER_NET_READ_INTERRUPTED
,
MYF
(
0
));
thd
->
net
.
last_errno
=
ER_NET_READ_INTERRUPTED
;
thd
->
net
.
error
=
2
;
}
/**
Process a single client request or a single batch.
*/
...
...
@@ -323,6 +341,8 @@ static int threadpool_process_request(THD *thd)
or KILL command. Return error.
*/
retval
=
1
;
if
(
thd
->
killed
==
KILL_WAIT_TIMEOUT
)
handle_wait_timeout
(
thd
);
goto
end
;
}
...
...
@@ -458,7 +478,7 @@ void tp_timeout_handler(TP_connection *c)
return
;
THD
*
thd
=
c
->
thd
;
mysql_mutex_lock
(
&
thd
->
LOCK_thd_data
);
thd
->
killed
=
KILL_CONNECTION
;
thd
->
set_killed
(
KILL_WAIT_TIMEOUT
)
;
c
->
priority
=
TP_PRIORITY_HIGH
;
post_kill_notification
(
thd
);
mysql_mutex_unlock
(
&
thd
->
LOCK_thd_data
);
...
...
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