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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
8881e660
Commit
8881e660
authored
Apr 12, 2006
by
kroki@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0
into mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug15933
parents
739ee02c
4a81c0df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
19 deletions
+56
-19
mysql-test/r/status.result
mysql-test/r/status.result
+5
-5
mysql-test/t/status.test
mysql-test/t/status.test
+51
-14
No files found.
mysql-test/r/status.result
View file @
8881e660
...
...
@@ -26,20 +26,20 @@ Last_query_cost 0.000000
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections
3
Max_used_connections
1
SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections
5
Max_used_connections
3
FLUSH STATUS;
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections
4
Max_used_connections
2
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections
5
Max_used_connections
3
SHOW STATUS LIKE 'max_used_connections';
Variable_name Value
Max_used_connections
6
Max_used_connections
4
SET GLOBAL thread_cache_size=@save_thread_cache_size;
mysql-test/t/status.test
View file @
8881e660
...
...
@@ -36,6 +36,10 @@ reap;
show
status
like
'Table_lock%'
;
drop
table
t1
;
disconnect
con2
;
disconnect
con1
;
connection
default
;
# End of 4.1 tests
#
...
...
@@ -60,48 +64,81 @@ show status like 'last_query_cost';
# taking a thread from the cache as well as when creating new threads
#
# Previous test uses con1, con2. If we disconnect them, there will be
# a race on when exactly this will happen, so we better leave them as
# is.
connection
default
;
# Wait for at most $disconnect_timeout seconds for disconnects to finish.
let
$disconnect_timeout
=
10
;
#
Reset max_used_connections from previous tests
.
#
Wait for any previous disconnects to finish
.
FLUSH
STATUS
;
--
disable_query_log
--
disable_result_log
eval
SET
@
wait_left
=
$disconnect_timeout
;
let
$max_used_connections
=
`SHOW STATUS LIKE 'max_used_connections'`
;
eval
SET
@
max_used_connections
=
SUBSTRING
(
'$max_used_connections'
,
21
)
+
0
;
let
$wait_more
=
`SELECT @max_used_connections != 1 && @wait_left > 0`
;
while
(
$wait_more
)
{
sleep
1
;
FLUSH
STATUS
;
SET
@
wait_left
=
@
wait_left
-
1
;
let
$max_used_connections
=
`SHOW STATUS LIKE 'max_used_connections'`
;
eval
SET
@
max_used_connections
=
SUBSTRING
(
'$max_used_connections'
,
21
)
+
0
;
let
$wait_more
=
`SELECT @max_used_connections != 1 && @wait_left > 0`
;
}
--
enable_query_log
--
enable_result_log
# Prerequisite.
SHOW
STATUS
LIKE
'max_used_connections'
;
# Save original setting.
SET
@
save_thread_cache_size
=@@
thread_cache_size
;
SET
GLOBAL
thread_cache_size
=
3
;
connect
(
con
3
,
localhost
,
root
,,);
connect
(
con
4
,
localhost
,
root
,,);
connect
(
con
1
,
localhost
,
root
,,);
connect
(
con
2
,
localhost
,
root
,,);
connection
con
3
;
disconnect
con
4
;
connection
con
1
;
disconnect
con
2
;
# Check that max_used_connections still reflects maximum value.
SHOW
STATUS
LIKE
'max_used_connections'
;
# Check that after flush max_used_connections equals to current number
# of connections.
# of connections.
First wait for previous disconnect to finish.
FLUSH
STATUS
;
--
disable_query_log
--
disable_result_log
eval
SET
@
wait_left
=
$disconnect_timeout
;
let
$max_used_connections
=
`SHOW STATUS LIKE 'max_used_connections'`
;
eval
SET
@
max_used_connections
=
SUBSTRING
(
'$max_used_connections'
,
21
)
+
0
;
let
$wait_more
=
`SELECT @max_used_connections != 2 && @wait_left > 0`
;
while
(
$wait_more
)
{
sleep
1
;
FLUSH
STATUS
;
SET
@
wait_left
=
@
wait_left
-
1
;
let
$max_used_connections
=
`SHOW STATUS LIKE 'max_used_connections'`
;
eval
SET
@
max_used_connections
=
SUBSTRING
(
'$max_used_connections'
,
21
)
+
0
;
let
$wait_more
=
`SELECT @max_used_connections != 2 && @wait_left > 0`
;
}
--
enable_query_log
--
enable_result_log
# Check that we don't count disconnected thread any longer.
SHOW
STATUS
LIKE
'max_used_connections'
;
# Check that max_used_connections is updated when cached thread is
# reused...
connect
(
con
4
,
localhost
,
root
,,);
connect
(
con
2
,
localhost
,
root
,,);
SHOW
STATUS
LIKE
'max_used_connections'
;
# ...and when new thread is created.
connect
(
con
5
,
localhost
,
root
,,);
connect
(
con
3
,
localhost
,
root
,,);
SHOW
STATUS
LIKE
'max_used_connections'
;
# Restore original setting.
connection
default
;
SET
GLOBAL
thread_cache_size
=@
save_thread_cache_size
;
disconnect
con5
;
disconnect
con4
;
disconnect
con3
;
disconnect
con2
;
disconnect
con1
;
...
...
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