1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-18 07:48:43 +03:00

Push history-limiting code until after the code that adds new

history entries.  Lazy deletion isn't smart or useful here.

Backport from 5.1 .
This commit is contained in:
cmiller@zippy.cornsilk.net
2007-11-14 15:11:58 -05:00
parent 1604cdb30d
commit ddb1443b07
10 changed files with 464 additions and 283 deletions

View File

@@ -300,6 +300,53 @@ id
select @@profiling;
@@profiling
1
set session profiling = OFF;
drop table if exists profile_log;
Warnings:
Note 1051 Unknown table 'profile_log'
create table profile_log (how_many int);
drop procedure if exists p1;
drop procedure if exists p2;
drop procedure if exists p3;
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//
first call to p1
call p1;
select * from profile_log;
second call to p1
call p1;
select * from profile_log;
third call to p1
call p1;
select * from profile_log;
set session profiling = OFF;
call p2;
set session profiling = OFF;
call p3;
show profiles;
drop procedure if exists p1;
drop procedure if exists p2;
drop procedure if exists p3;
drop table if exists profile_log;
set session profiling = ON;
drop table if exists t2;
create table t2 (id int not null);

View File

@@ -136,7 +136,7 @@ show profiles;
## Verify that the various juggling of THD contexts doesn't affect profiling.
## Functions
## Functions and procedures
set session profiling = ON;
select @@profiling;
create function f1() returns varchar(50) return 'hello';
@@ -144,6 +144,64 @@ 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;
@@ -193,6 +251,12 @@ 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;