Fixed BUG#15866: Thread stack limit insufficient for recursive call "fib(20)"
Lowered the parameter to 10, and also renamed non-standard table names to t3.
This commit is contained in:
parent
9522e88d0b
commit
28f3989c8a
@ -1178,8 +1178,8 @@ drop view v2|
|
|||||||
delete from t1 |
|
delete from t1 |
|
||||||
delete from t2 |
|
delete from t2 |
|
||||||
drop table t4|
|
drop table t4|
|
||||||
drop table if exists fac|
|
drop table if exists t3|
|
||||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
create table t3 (n int unsigned not null primary key, f bigint unsigned)|
|
||||||
drop procedure if exists ifac|
|
drop procedure if exists ifac|
|
||||||
create procedure ifac(n int unsigned)
|
create procedure ifac(n int unsigned)
|
||||||
begin
|
begin
|
||||||
@ -1189,13 +1189,13 @@ set n = 20; # bigint overflow otherwise
|
|||||||
end if;
|
end if;
|
||||||
while i <= n do
|
while i <= n do
|
||||||
begin
|
begin
|
||||||
insert into test.fac values (i, fac(i));
|
insert into test.t3 values (i, fac(i));
|
||||||
set i = i + 1;
|
set i = i + 1;
|
||||||
end;
|
end;
|
||||||
end while;
|
end while;
|
||||||
end|
|
end|
|
||||||
call ifac(20)|
|
call ifac(20)|
|
||||||
select * from fac|
|
select * from t3|
|
||||||
n f
|
n f
|
||||||
1 1
|
1 1
|
||||||
2 2
|
2 2
|
||||||
@ -1217,7 +1217,7 @@ n f
|
|||||||
18 6402373705728000
|
18 6402373705728000
|
||||||
19 121645100408832000
|
19 121645100408832000
|
||||||
20 2432902008176640000
|
20 2432902008176640000
|
||||||
drop table fac|
|
drop table t3|
|
||||||
show function status like '%f%'|
|
show function status like '%f%'|
|
||||||
Db Name Type Definer Modified Created Security_type Comment
|
Db Name Type Definer Modified Created Security_type Comment
|
||||||
test fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
test fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||||
@ -1225,12 +1225,12 @@ drop procedure ifac|
|
|||||||
drop function fac|
|
drop function fac|
|
||||||
show function status like '%f%'|
|
show function status like '%f%'|
|
||||||
Db Name Type Definer Modified Created Security_type Comment
|
Db Name Type Definer Modified Created Security_type Comment
|
||||||
drop table if exists primes|
|
drop table if exists t3|
|
||||||
create table primes (
|
create table t3 (
|
||||||
i int unsigned not null primary key,
|
i int unsigned not null primary key,
|
||||||
p bigint unsigned not null
|
p bigint unsigned not null
|
||||||
)|
|
)|
|
||||||
insert into primes values
|
insert into t3 values
|
||||||
( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13),
|
( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13),
|
||||||
( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31),
|
( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31),
|
||||||
(10, 37), (11, 41), (12, 43), (13, 47), (14, 53),
|
(10, 37), (11, 41), (12, 43), (13, 47), (14, 53),
|
||||||
@ -1253,7 +1253,7 @@ set b = b+200, s = 0;
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
declare p bigint unsigned;
|
declare p bigint unsigned;
|
||||||
select t.p into p from test.primes t where t.i = s;
|
select t.p into p from test.t3 t where t.i = s;
|
||||||
if b+p > r then
|
if b+p > r then
|
||||||
set pp = 1;
|
set pp = 1;
|
||||||
leave again;
|
leave again;
|
||||||
@ -1278,7 +1278,7 @@ begin
|
|||||||
declare pp bool default 0;
|
declare pp bool default 0;
|
||||||
call opp(p, pp);
|
call opp(p, pp);
|
||||||
if pp then
|
if pp then
|
||||||
insert into test.primes values (i, p);
|
insert into test.t3 values (i, p);
|
||||||
set i = i+1;
|
set i = i+1;
|
||||||
end if;
|
end if;
|
||||||
set p = p+2;
|
set p = p+2;
|
||||||
@ -1299,7 +1299,7 @@ set b = b+200, s = 0;
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
declare p bigint unsigned;
|
declare p bigint unsigned;
|
||||||
select t.p into p from test.primes t where t.i = s;
|
select t.p into p from test.t3 t where t.i = s;
|
||||||
if b+p > r then
|
if b+p > r then
|
||||||
set pp = 1;
|
set pp = 1;
|
||||||
leave again;
|
leave again;
|
||||||
@ -1318,47 +1318,47 @@ Db Name Type Definer Modified Created Security_type Comment
|
|||||||
test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||||
test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||||
call ip(200)|
|
call ip(200)|
|
||||||
select * from primes where i=45 or i=100 or i=199|
|
select * from t3 where i=45 or i=100 or i=199|
|
||||||
i p
|
i p
|
||||||
45 211
|
45 211
|
||||||
100 557
|
100 557
|
||||||
199 1229
|
199 1229
|
||||||
drop table primes|
|
drop table t3|
|
||||||
drop procedure opp|
|
drop procedure opp|
|
||||||
drop procedure ip|
|
drop procedure ip|
|
||||||
show procedure status like '%p%'|
|
show procedure status like '%p%'|
|
||||||
Db Name Type Definer Modified Created Security_type Comment
|
Db Name Type Definer Modified Created Security_type Comment
|
||||||
drop table if exists fib|
|
drop table if exists t3|
|
||||||
create table fib ( f bigint unsigned not null )|
|
create table t3 ( f bigint unsigned not null )|
|
||||||
drop procedure if exists fib|
|
drop procedure if exists fib|
|
||||||
create procedure fib(n int unsigned)
|
create procedure fib(n int unsigned)
|
||||||
begin
|
begin
|
||||||
if n > 1 then
|
if n > 1 then
|
||||||
begin
|
begin
|
||||||
declare x, y bigint unsigned;
|
declare x, y bigint unsigned;
|
||||||
declare c cursor for select f from fib order by f desc limit 2;
|
declare c cursor for select f from t3 order by f desc limit 2;
|
||||||
open c;
|
open c;
|
||||||
fetch c into y;
|
fetch c into y;
|
||||||
fetch c into x;
|
fetch c into x;
|
||||||
close c;
|
close c;
|
||||||
insert into fib values (x+y);
|
insert into t3 values (x+y);
|
||||||
call fib(n-1);
|
call fib(n-1);
|
||||||
end;
|
end;
|
||||||
end if;
|
end if;
|
||||||
end|
|
end|
|
||||||
set @@max_sp_recursion_depth= 20|
|
set @@max_sp_recursion_depth= 20|
|
||||||
insert into fib values (0), (1)|
|
insert into t3 values (0), (1)|
|
||||||
call fib(3)|
|
call fib(3)|
|
||||||
select * from fib order by f asc|
|
select * from t3 order by f asc|
|
||||||
f
|
f
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
delete from fib|
|
delete from t3|
|
||||||
insert into fib values (0), (1)|
|
insert into t3 values (0), (1)|
|
||||||
call fib(20)|
|
call fib(20)|
|
||||||
select * from fib order by f asc|
|
select * from t3 order by f asc|
|
||||||
f
|
f
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
@ -1381,7 +1381,7 @@ f
|
|||||||
2584
|
2584
|
||||||
4181
|
4181
|
||||||
6765
|
6765
|
||||||
drop table fib|
|
drop table t3|
|
||||||
drop procedure fib|
|
drop procedure fib|
|
||||||
set @@max_sp_recursion_depth= 0|
|
set @@max_sp_recursion_depth= 0|
|
||||||
drop procedure if exists bar|
|
drop procedure if exists bar|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
drop table if exists t1, t2;
|
drop table if exists t1, t2, t3;
|
||||||
drop procedure if exists bug8850|
|
drop procedure if exists bug8850|
|
||||||
create table t1 (a int) engine=innodb|
|
create table t1 (a int) engine=innodb|
|
||||||
create procedure bug8850()
|
create procedure bug8850()
|
||||||
|
@ -1419,9 +1419,9 @@ drop table t4|
|
|||||||
# fac
|
# fac
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists fac|
|
drop table if exists t3|
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
create table fac (n int unsigned not null primary key, f bigint unsigned)|
|
create table t3 (n int unsigned not null primary key, f bigint unsigned)|
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop procedure if exists ifac|
|
drop procedure if exists ifac|
|
||||||
@ -1435,15 +1435,15 @@ begin
|
|||||||
end if;
|
end if;
|
||||||
while i <= n do
|
while i <= n do
|
||||||
begin
|
begin
|
||||||
insert into test.fac values (i, fac(i));
|
insert into test.t3 values (i, fac(i));
|
||||||
set i = i + 1;
|
set i = i + 1;
|
||||||
end;
|
end;
|
||||||
end while;
|
end while;
|
||||||
end|
|
end|
|
||||||
|
|
||||||
call ifac(20)|
|
call ifac(20)|
|
||||||
select * from fac|
|
select * from t3|
|
||||||
drop table fac|
|
drop table t3|
|
||||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||||
show function status like '%f%'|
|
show function status like '%f%'|
|
||||||
drop procedure ifac|
|
drop procedure ifac|
|
||||||
@ -1455,15 +1455,15 @@ show function status like '%f%'|
|
|||||||
# primes
|
# primes
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists primes|
|
drop table if exists t3|
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
create table primes (
|
create table t3 (
|
||||||
i int unsigned not null primary key,
|
i int unsigned not null primary key,
|
||||||
p bigint unsigned not null
|
p bigint unsigned not null
|
||||||
)|
|
)|
|
||||||
|
|
||||||
insert into primes values
|
insert into t3 values
|
||||||
( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13),
|
( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13),
|
||||||
( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31),
|
( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31),
|
||||||
(10, 37), (11, 41), (12, 43), (13, 47), (14, 53),
|
(10, 37), (11, 41), (12, 43), (13, 47), (14, 53),
|
||||||
@ -1492,7 +1492,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
declare p bigint unsigned;
|
declare p bigint unsigned;
|
||||||
|
|
||||||
select t.p into p from test.primes t where t.i = s;
|
select t.p into p from test.t3 t where t.i = s;
|
||||||
if b+p > r then
|
if b+p > r then
|
||||||
set pp = 1;
|
set pp = 1;
|
||||||
leave again;
|
leave again;
|
||||||
@ -1523,7 +1523,7 @@ begin
|
|||||||
|
|
||||||
call opp(p, pp);
|
call opp(p, pp);
|
||||||
if pp then
|
if pp then
|
||||||
insert into test.primes values (i, p);
|
insert into test.t3 values (i, p);
|
||||||
set i = i+1;
|
set i = i+1;
|
||||||
end if;
|
end if;
|
||||||
set p = p+2;
|
set p = p+2;
|
||||||
@ -1545,8 +1545,8 @@ call ip(200)|
|
|||||||
# 45 211
|
# 45 211
|
||||||
# 100 557
|
# 100 557
|
||||||
# 199 1229
|
# 199 1229
|
||||||
select * from primes where i=45 or i=100 or i=199|
|
select * from t3 where i=45 or i=100 or i=199|
|
||||||
drop table primes|
|
drop table t3|
|
||||||
drop procedure opp|
|
drop procedure opp|
|
||||||
drop procedure ip|
|
drop procedure ip|
|
||||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||||
@ -1556,9 +1556,9 @@ show procedure status like '%p%'|
|
|||||||
# Fibonacci, for recursion test. (Yet Another Numerical series :)
|
# Fibonacci, for recursion test. (Yet Another Numerical series :)
|
||||||
#
|
#
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists fib|
|
drop table if exists t3|
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
create table fib ( f bigint unsigned not null )|
|
create table t3 ( f bigint unsigned not null )|
|
||||||
|
|
||||||
# We deliberately do it the awkward way, fetching the last two
|
# We deliberately do it the awkward way, fetching the last two
|
||||||
# values from the table, in order to exercise various statements
|
# values from the table, in order to exercise various statements
|
||||||
@ -1571,13 +1571,13 @@ begin
|
|||||||
if n > 1 then
|
if n > 1 then
|
||||||
begin
|
begin
|
||||||
declare x, y bigint unsigned;
|
declare x, y bigint unsigned;
|
||||||
declare c cursor for select f from fib order by f desc limit 2;
|
declare c cursor for select f from t3 order by f desc limit 2;
|
||||||
|
|
||||||
open c;
|
open c;
|
||||||
fetch c into y;
|
fetch c into y;
|
||||||
fetch c into x;
|
fetch c into x;
|
||||||
close c;
|
close c;
|
||||||
insert into fib values (x+y);
|
insert into t3 values (x+y);
|
||||||
call fib(n-1);
|
call fib(n-1);
|
||||||
end;
|
end;
|
||||||
end if;
|
end if;
|
||||||
@ -1588,22 +1588,23 @@ set @@max_sp_recursion_depth= 20|
|
|||||||
|
|
||||||
# Minimum test: recursion of 3 levels
|
# Minimum test: recursion of 3 levels
|
||||||
|
|
||||||
insert into fib values (0), (1)|
|
insert into t3 values (0), (1)|
|
||||||
|
|
||||||
call fib(3)|
|
call fib(3)|
|
||||||
|
|
||||||
select * from fib order by f asc|
|
select * from t3 order by f asc|
|
||||||
|
|
||||||
delete from fib|
|
delete from t3|
|
||||||
|
|
||||||
# Original test: 20 levels (may run into memory limits!)
|
# The original test, 20 levels, ran into memory limits on some machines
|
||||||
|
# and builds. Try 10 instead...
|
||||||
|
|
||||||
insert into fib values (0), (1)|
|
insert into t3 values (0), (1)|
|
||||||
|
|
||||||
call fib(20)|
|
call fib(20)|
|
||||||
|
|
||||||
select * from fib order by f asc|
|
select * from t3 order by f asc|
|
||||||
drop table fib|
|
drop table t3|
|
||||||
drop procedure fib|
|
drop procedure fib|
|
||||||
set @@max_sp_recursion_depth= 0|
|
set @@max_sp_recursion_depth= 0|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
-- source include/have_innodb.inc
|
-- source include/have_innodb.inc
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1, t2;
|
drop table if exists t1, t2, t3;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
delimiter |;
|
delimiter |;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user