Skip to content

Commit

Permalink
MDEV-7410 Temporary table name conflict between sessions
Browse files Browse the repository at this point in the history
workaround for missing SP auto-reparse.
allow the user to disable stored_program_cache_size, if he wants
  • Loading branch information
Sergei Golubchik committed Jan 10, 2015
1 parent 0064952 commit 2ab4968
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 5 deletions.
6 changes: 2 additions & 4 deletions mysql-test/suite/sys_vars/r/stored_program_cache_basic.result
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@ Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '-1'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256
0
SET @@global.stored_program_cache =100000000000;
Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '100000000000'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
524288
SET @@global.stored_program_cache = 0;
Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '0'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256
0
SET @@global.stored_program_cache = 10000.01;
ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
SET @@global.stored_program_cache = ON;
Expand Down
52 changes: 52 additions & 0 deletions mysql-test/suite/sys_vars/r/stored_program_cache_func.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
create procedure p1() select 1;
flush status;
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 0
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 1
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 1
set global stored_program_cache=0;
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 2
call p1;
1
1
show status like 'handler_read_key';
Variable_name Value
Handler_read_key 3
drop procedure p1;
set global stored_program_cache=default;
create procedure pr(i int) begin
create table t1 (a int, b int);
if (i = 1) then alter table t1 drop a;
else alter table t1 drop b;
end if;
select * from t1;
drop table t1;
end |
call pr(1);
b
call pr(2);
ERROR 42S22: Unknown column 'test.t1.b' in 'field list'
drop table t1;
set global stored_program_cache=0;
call pr(1);
b
call pr(2);
a
drop procedure pr;
set global stored_program_cache=default;
43 changes: 43 additions & 0 deletions mysql-test/suite/sys_vars/t/stored_program_cache_func.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
create procedure p1() select 1;

flush status;
show status like 'handler_read_key';
call p1;
show status like 'handler_read_key';
call p1;
show status like 'handler_read_key';

set global stored_program_cache=0;

call p1;
show status like 'handler_read_key';
call p1;
show status like 'handler_read_key';

drop procedure p1;
set global stored_program_cache=default;

# Test for missing SP automatic reparsing.
# when MDEV-5816 is implemented, it should be removed.

--delimiter |
create procedure pr(i int) begin
create table t1 (a int, b int);
if (i = 1) then alter table t1 drop a;
else alter table t1 drop b;
end if;
select * from t1;
drop table t1;
end |
--delimiter ;
call pr(1);
--error ER_BAD_FIELD_ERROR
call pr(2);
drop table t1;

set global stored_program_cache=0;
call pr(1);
call pr(2);
drop procedure pr;
set global stored_program_cache=default;

2 changes: 1 addition & 1 deletion sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3679,7 +3679,7 @@ static Sys_var_ulong Sys_sp_cache_size(
"The soft upper limit for number of cached stored routines for "
"one connection.",
GLOBAL_VAR(stored_program_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(256, 512 * 1024), DEFAULT(256), BLOCK_SIZE(1));
VALID_RANGE(0, 512 * 1024), DEFAULT(256), BLOCK_SIZE(1));

export const char *plugin_maturity_names[]=
{ "unknown", "experimental", "alpha", "beta", "gamma", "stable", 0 };
Expand Down

0 comments on commit 2ab4968

Please sign in to comment.