List:Commits« Previous MessageNext Message »
From:Dmitry Shulga Date:October 6 2010 5:01am
Subject:bzr commit into mysql-5.1-bugteam branch (Dmitry.Shulga:3523) Bug#45445
View as plain text  
#At file:///Users/shulga/projects/mysql/5.1-bugteam-bug45445/ based on revid:georgi.kodinov@stripped

 3523 Dmitry Shulga	2010-10-06
      Fixed bug #45445 - cannot execute procedures with thread_stack
      set to 128k.
     @ mysql-test/collections/default.experimental
        Re-enabled test rpl.rpl_row_sp011.
     @ sql/sp_head.cc
        sp_head::execute() modified: pass constant value 2 * STACK_MIN_SIZE
        instead of 8 * STACK_MIN_SIZE  as second argument value
        in call to check_stack_overrun.

    modified:
      mysql-test/collections/default.experimental
      sql/sp_head.cc
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2010-09-07 20:16:10 +0000
+++ b/mysql-test/collections/default.experimental	2010-10-06 05:01:28 +0000
@@ -22,7 +22,6 @@ main.outfile_loaddata @solaris          
 ndb.*                                    # joro : NDB tests marked as experimental as agreed with bochklin
 
 rpl.rpl_innodb_bug28430*  @solaris       # Bug#46029
-rpl.rpl_row_sp011         @solaris       # Joro : Bug #54138
 
 rpl_ndb.*                                # joro : NDB tests marked as experimental as agreed with bochklin
 rpl_ndb.rpl_ndb_log                      # Bug#38998

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2010-07-19 14:30:34 +0000
+++ b/sql/sp_head.cc	2010-10-06 05:01:28 +0000
@@ -1108,8 +1108,27 @@ sp_head::execute(THD *thd)
 
   Object_creation_ctx *saved_creation_ctx;
 
-  /* Use some extra margin for possible SP recursion and functions */
-  if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet))
+  /*
+    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 and 6016 bytes on 64 bit Mac.
+    The same with db_load_routine() required circa 7k bytes and
+    14k bytes accordingly. Hence, here we book the stack with some
+    reasonable margin.
+  */
+  if (check_stack_overrun(thd, 2 * STACK_MIN_SIZE, (uchar*)&old_packet))
     DBUG_RETURN(TRUE);
 
   /* init per-instruction memroot */


Attachment: [text/bzr-bundle] bzr/dmitry.shulga@sun.com-20101006050128-3onn9pepf3vy6tqs.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Dmitry.Shulga:3523) Bug#45445Dmitry Shulga6 Oct