mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merged 5.0-main -> 5.0-bugteam
This commit is contained in:
@ -1029,6 +1029,7 @@ where t.table_schema = 'information_schema' and
|
||||
group by c2.column_type order by num limit 1)
|
||||
group by t.table_name order by num1, t.table_name;
|
||||
|
||||
|
||||
#
|
||||
# Bug#28266 IS_UPDATABLE field on VIEWS table in I_S database is wrong
|
||||
#
|
||||
|
13
mysql-test/t/information_schema_community.test
Normal file
13
mysql-test/t/information_schema_community.test
Normal file
@ -0,0 +1,13 @@
|
||||
-- source include/have_community_features.inc
|
||||
|
||||
#
|
||||
# Bug#24822: Patch: uptime_since_flush_status
|
||||
#
|
||||
--replace_column 2 #
|
||||
show global status like "Uptime_%";
|
||||
flush status;
|
||||
--replace_column 2 #
|
||||
show global status like "Uptime_%"; # Almost certainly zero
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -50,7 +50,7 @@ create view v_bug25347 as select * from t_bug25347;
|
||||
flush tables;
|
||||
--echo removing and creating
|
||||
--remove_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI
|
||||
--write_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI
|
||||
--write_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI
|
||||
EOF
|
||||
--exec $MYSQL_CHECK --repair --databases --use-frm d_bug25347
|
||||
drop view v_bug25347;
|
||||
|
266
mysql-test/t/profiling.test
Normal file
266
mysql-test/t/profiling.test
Normal file
@ -0,0 +1,266 @@
|
||||
--source include/have_profiling.inc
|
||||
|
||||
# Verify that the protocol isn't violated if we ask for profiling info
|
||||
# before profiling has recorded anything.
|
||||
show profiles;
|
||||
show profile all;
|
||||
|
||||
# default is OFF
|
||||
show session variables like 'profil%';
|
||||
select @@profiling;
|
||||
|
||||
# setting global variable is an error
|
||||
--error ER_LOCAL_VARIABLE
|
||||
set global profiling = ON;
|
||||
|
||||
# But size is okay
|
||||
set global profiling_history_size=100;
|
||||
show global variables like 'profil%';
|
||||
|
||||
# turn on for testing
|
||||
set session profiling = ON;
|
||||
set session profiling_history_size=30; # small enough to overflow
|
||||
|
||||
# verify it is active
|
||||
show session variables like 'profil%';
|
||||
select @@profiling;
|
||||
|
||||
# Profiling is a descriptive look into the way the server operated
|
||||
# in retrospect. Chad doesn't think it's wise to include the result
|
||||
# log, as this creates a proscriptive specification about how the
|
||||
# server should work in the future -- or it forces everyone who
|
||||
# changes the server significantly to record the test results again,
|
||||
# and that violates the spirit of our tests. Please don't include
|
||||
# execution-specific data here, as in all of the "show profile" and
|
||||
# information_schema.profiling results.
|
||||
|
||||
create table t1 (
|
||||
a int,
|
||||
b int
|
||||
);
|
||||
insert into t1 values (1,1), (2,null), (3, 4);
|
||||
insert into t1 values (5,1), (6,null), (7, 4);
|
||||
insert into t1 values (1,1), (2,null), (3, 4);
|
||||
insert into t1 values (5,1), (6,null), (7, 4);
|
||||
select max(x) from (select sum(a) as x from t1 group by b) as teeone;
|
||||
insert into t1 select * from t1;
|
||||
select count(*) from t1;
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
select count(*) from t1;
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
select count(*) from t1;
|
||||
select sum(a) from t1;
|
||||
select sum(a) from t1 group by b;
|
||||
select sum(a) + sum(b) from t1 group by b;
|
||||
select max(x) from (select sum(a) as x from t1 group by b) as teeone;
|
||||
select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string;
|
||||
|
||||
--enable_result_log
|
||||
--replace_column 2 #
|
||||
show profiles;
|
||||
|
||||
--disable_result_log
|
||||
###--replace_column 2 # 3 # 4 #
|
||||
show profile for query 15;
|
||||
###--replace_column 2 # 3 # 4 #
|
||||
show profile cpu for query 15;
|
||||
###--replace_column 2 # 3 # 4 # 5 # 6 #
|
||||
show profile cpu, block io for query 15;
|
||||
###--replace_column 2 # 3 # 4 #
|
||||
show profile cpu for query 9 limit 2 offset 2;
|
||||
show profile cpu for query 10 limit 0;
|
||||
--error 0,ER_WRONG_ARGUMENTS
|
||||
show profile cpu for query 65534;
|
||||
###--replace_column 2 #
|
||||
show profile memory;
|
||||
###--replace_column 2 # 3 # 4 #
|
||||
show profile block io;
|
||||
###--replace_column 2 # 3 # 4 #
|
||||
show profile context switches;
|
||||
###--replace_column 2 # 3 # 4 #
|
||||
show profile page faults;
|
||||
###--replace_column 2 # 3 # 4 #
|
||||
show profile ipc;
|
||||
###--replace_column 2 #
|
||||
show profile swaps limit 1 offset 2;
|
||||
###--replace_column 2 # 5 #
|
||||
show profile source;
|
||||
show profile all for query 0 limit 0;
|
||||
###--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 16 #
|
||||
show profile all for query 15;
|
||||
###--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 16 #
|
||||
|
||||
select * from information_schema.profiling;
|
||||
select query_id, state, duration from information_schema.profiling;
|
||||
select query_id, sum(duration) from information_schema.profiling group by query_id;
|
||||
select query_id, count(*) from information_schema.profiling group by query_id;
|
||||
select sum(duration) from information_schema.profiling;
|
||||
|
||||
# Broken down into number of stages and duration of each query.
|
||||
select query_id, count(*), sum(duration) from information_schema.profiling group by query_id;
|
||||
select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling;
|
||||
|
||||
|
||||
--enable_result_log
|
||||
drop table if exists t1, t2, t3;
|
||||
create table t1 (id int );
|
||||
create table t2 (id int not null);
|
||||
create table t3 (id int not null primary key);
|
||||
insert into t1 values (1), (2), (3);
|
||||
insert into t2 values (1), (2), (3);
|
||||
insert into t3 values (1), (2), (3);
|
||||
|
||||
--replace_column 2 #
|
||||
show profiles;
|
||||
|
||||
select * from t1;
|
||||
--replace_column 2 #
|
||||
show profiles;
|
||||
--echo This ^^ should end in "select * from t1;"
|
||||
|
||||
delete from t1;
|
||||
insert into t1 values (1), (2), (3);
|
||||
insert into t1 values (1), (2), (3);
|
||||
|
||||
select * from t1;
|
||||
--replace_column 2 #
|
||||
show profiles;
|
||||
|
||||
# Turning profiling off does freeze it
|
||||
set session profiling = OFF;
|
||||
select sum(id) from t1;
|
||||
--replace_column 2 #
|
||||
show profiles;
|
||||
|
||||
## Verify that the various juggling of THD contexts doesn't affect profiling.
|
||||
|
||||
## Functions and procedures
|
||||
set session profiling = ON;
|
||||
select @@profiling;
|
||||
create function f1() returns varchar(50) return 'hello';
|
||||
select @@profiling;
|
||||
select * from t1 where id <> f1();
|
||||
select @@profiling;
|
||||
|
||||
set session profiling = OFF;
|
||||
drop table if exists profile_log;
|
||||
create table profile_log (how_many int);
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists p1;
|
||||
drop procedure if exists p2;
|
||||
drop procedure if exists p3;
|
||||
--enable_warnings
|
||||
|
||||
delimiter //;
|
||||
create procedure p1 ()
|
||||
modifies sql data
|
||||
begin
|
||||
set profiling = ON;
|
||||
select 'This p1 should show up in profiling';
|
||||
insert into profile_log select count(*) from information_schema.profiling;
|
||||
end//
|
||||
create procedure p2()
|
||||
deterministic
|
||||
begin
|
||||
set profiling = ON;
|
||||
call p1();
|
||||
select 'This p2 should show up in profiling';
|
||||
end//
|
||||
create procedure p3 ()
|
||||
reads sql data
|
||||
begin
|
||||
set profiling = ON;
|
||||
select 'This p3 should show up in profiling';
|
||||
show profile;
|
||||
end//
|
||||
delimiter ;//
|
||||
|
||||
--disable_result_log
|
||||
--echo first call to p1
|
||||
call p1;
|
||||
select * from profile_log;
|
||||
--echo second call to p1
|
||||
call p1;
|
||||
select * from profile_log;
|
||||
--echo third call to p1
|
||||
call p1;
|
||||
select * from profile_log;
|
||||
set session profiling = OFF;
|
||||
call p2;
|
||||
set session profiling = OFF;
|
||||
call p3;
|
||||
|
||||
--replace_column 1 # 2 #
|
||||
show profiles;
|
||||
--enable_result_log
|
||||
|
||||
drop procedure if exists p1;
|
||||
drop procedure if exists p2;
|
||||
drop procedure if exists p3;
|
||||
drop table if exists profile_log;
|
||||
|
||||
## Triggers
|
||||
set session profiling = ON;
|
||||
drop table if exists t2;
|
||||
create table t2 (id int not null);
|
||||
create trigger t2_bi before insert on t2 for each row set @x=0;
|
||||
select @@profiling;
|
||||
insert into t2 values (1), (2), (3);
|
||||
select @@profiling;
|
||||
|
||||
## ALTER TABLE
|
||||
set session profiling = ON;
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (id int not null primary key);
|
||||
create table t2 (id int not null primary key, id1 int not null);
|
||||
select @@profiling;
|
||||
alter table t2 add foreign key (id1) references t1 (id) on delete cascade;
|
||||
select @@profiling;
|
||||
|
||||
## Table LOCKing
|
||||
lock table t1 write;
|
||||
select @@profiling;
|
||||
unlock table;
|
||||
select @@profiling;
|
||||
|
||||
## Transactions
|
||||
set autocommit=0;
|
||||
select @@profiling, @@autocommit;
|
||||
begin;
|
||||
select @@profiling;
|
||||
insert into t1 values (1);
|
||||
insert into t2 values (1,1);
|
||||
--echo testing referential integrity cascade
|
||||
delete from t1 where id = 1;
|
||||
select @@profiling;
|
||||
--echo testing rollback
|
||||
--disable_warnings
|
||||
rollback;
|
||||
--enable_warnings
|
||||
select @@profiling;
|
||||
--echo testing commit
|
||||
begin;
|
||||
select @@profiling;
|
||||
commit;
|
||||
select @@profiling;
|
||||
|
||||
drop table if exists t1, t2, t3;
|
||||
drop view if exists v1;
|
||||
drop function if exists f1;
|
||||
|
||||
## Multiple queries in one packet. Combo statements don't work with ps-proto.
|
||||
#--eval select 1; select 2; select 3;
|
||||
## two continuations, one starting
|
||||
#select state from information_schema.profiling where seq=1 order by query_id desc limit 3;
|
||||
|
||||
|
||||
## last thing in the file
|
||||
set session profiling = OFF;
|
||||
|
||||
##
|
||||
--echo End of 5.0 tests
|
@ -3375,16 +3375,14 @@ SELECT * FROM t1
|
||||
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug#20835 (literal string with =any values)
|
||||
#
|
||||
CREATE TABLE t1 (s1 CHAR(1));
|
||||
CREATE TABLE t1 (s1 char(1));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#40519 Subselect query using bigint fails
|
||||
#
|
||||
@ -3395,7 +3393,6 @@ INSERT INTO t2 VALUES (2,1),(3,1);
|
||||
SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1);
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug#37460 Assertion failed:
|
||||
# !table->file || table->file->inited == handler::NONE
|
||||
@ -3409,13 +3406,13 @@ INSERT INTO t1 (id) VALUES (1);
|
||||
INSERT INTO t2 (id) VALUES (1);
|
||||
|
||||
CREATE VIEW v1 AS
|
||||
SELECT t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
SELECT t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
UPDATE v1 SET c=1;
|
||||
|
||||
CREATE VIEW v2 (a,b) AS
|
||||
SELECT t2.id, t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
SELECT t2.id, t2.c AS c FROM t1, t2
|
||||
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
|
||||
--error ER_VIEW_CHECK_FAILED
|
||||
INSERT INTO v2(a,b) VALUES (2,2);
|
||||
@ -3423,8 +3420,8 @@ INSERT INTO v2(a,b) VALUES (1,2);
|
||||
SELECT * FROM v1;
|
||||
|
||||
CREATE VIEW v3 AS
|
||||
SELECT t2.c AS c FROM t2
|
||||
WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
SELECT t2.c AS c FROM t2
|
||||
WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
|
||||
|
||||
DELETE FROM v3;
|
||||
|
||||
|
Reference in New Issue
Block a user