Commit bb070f93 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-7188 main.signal_demo3 and sys_vars.max_sp_recursion_depth_func fail in...

MDEV-7188 main.signal_demo3 and sys_vars.max_sp_recursion_depth_func fail in biuldbot on labrador with Thread stack overrun

reduce stack requirememnts for CALL by just a little bit
parent 2b40a389
......@@ -1131,31 +1131,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
Diagnostics_area *da= thd->get_stmt_da();
Warning_info sp_wi(da->warning_info_id(), false, true);
/*
Just reporting a stack overrun error
(@sa check_stack_overrun()) requires stack memory for error
message buffer. Thus, we have to put the below check
relatively close to the beginning of the execution stack,
where available stack margin is still big. As long as the check
has to be fairly high up the call stack, the amount of memory
we "book" for has to stay fairly high as well, and hence
not very accurate. The number below has been calculated
by trial and error, and reflects the amount of memory necessary
to execute a single stored procedure instruction, be it either
an SQL statement, or, heaviest of all, a CALL, which involves
parsing and loading of another stored procedure into the cache
(@sa db_load_routine() and Bug#10100).
At the time of measuring, a recursive SP invocation required
3232 bytes of stack on 32 bit Linux, 6016 bytes on 64 bit Mac
and 11152 on 64 bit Solaris sparc.
The same with db_load_routine() required circa 7k bytes and
14k bytes accordingly. Hence, here we book the stack with some
reasonable margin.
Reverting back to 8 * STACK_MIN_SIZE until further fix.
8 * STACK_MIN_SIZE is required on some exotic platforms.
*/
if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet))
/* this 7*STACK_MIN_SIZE is a complex matter with a long history (see it!) */
if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet))
DBUG_RETURN(TRUE);
/* init per-instruction memroot */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment