mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-5.0 sql/item_func.cc: Auto merged
This commit is contained in:
@ -23,3 +23,23 @@ select 1;
|
||||
show status like 'last_query_cost';
|
||||
Variable_name Value
|
||||
Last_query_cost 0.000000
|
||||
FLUSH STATUS;
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
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 3
|
||||
FLUSH STATUS;
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 2
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 3
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 4
|
||||
SET GLOBAL thread_cache_size=@save_thread_cache_size;
|
||||
|
@ -952,3 +952,16 @@ load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (
|
||||
conn_id INT,
|
||||
trigger_conn_id INT
|
||||
);
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
||||
SET NEW.trigger_conn_id = CONNECTION_ID();
|
||||
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
|
||||
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
|
||||
SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
|
||||
conn_id trigger_conn_id
|
||||
DROP TRIGGER t1_bi;
|
||||
DROP TABLE t1;
|
||||
|
@ -36,11 +36,111 @@ reap;
|
||||
show status like 'Table_lock%';
|
||||
drop table t1;
|
||||
|
||||
disconnect con2;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# lost_query_cost
|
||||
# last_query_cost
|
||||
#
|
||||
|
||||
select 1;
|
||||
show status like 'last_query_cost';
|
||||
|
||||
#
|
||||
# Test for Bug #15933 max_used_connections is wrong after FLUSH STATUS
|
||||
# if connections are cached
|
||||
#
|
||||
#
|
||||
# The first suggested fix from the bug report was chosen
|
||||
# (see http://bugs.mysql.com/bug.php?id=15933):
|
||||
#
|
||||
# a) On flushing the status, set max_used_connections to
|
||||
# threads_connected, not to 0.
|
||||
#
|
||||
# b) Check if it is necessary to increment max_used_connections when
|
||||
# taking a thread from the cache as well as when creating new threads
|
||||
#
|
||||
|
||||
# Wait for at most $disconnect_timeout seconds for disconnects to finish.
|
||||
let $disconnect_timeout = 10;
|
||||
|
||||
# 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 (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
||||
connection con1;
|
||||
disconnect con2;
|
||||
|
||||
# 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. 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 (con2,localhost,root,,);
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
|
||||
# ...and when new thread is created.
|
||||
connect (con3,localhost,root,,);
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
|
||||
# Restore original setting.
|
||||
connection default;
|
||||
SET GLOBAL thread_cache_size=@save_thread_cache_size;
|
||||
|
||||
disconnect con3;
|
||||
disconnect con2;
|
||||
disconnect con1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -1114,3 +1114,31 @@ load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
|
||||
#
|
||||
# Test for Bug #16461 connection_id() does not work properly inside trigger
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
conn_id INT,
|
||||
trigger_conn_id INT
|
||||
);
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
|
||||
SET NEW.trigger_conn_id = CONNECTION_ID();
|
||||
|
||||
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
|
||||
connection default;
|
||||
disconnect con1;
|
||||
|
||||
SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
|
||||
|
||||
DROP TRIGGER t1_bi;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user