List:Internals« Previous MessageNext Message »
From:sanja Date:June 21 2005 11:17pm
Subject:bk commit into 5.0 tree (bell:1.1976) BUG#10136
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of bell. When bell does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1976 05/06/22 00:17:08 bell@stripped +3 -0
  fixed items cleunup for SP (BUG#10136)

  sql/sp_head.cc
    1.147 05/06/22 00:17:04 bell@stripped +15 -1
    fixed items cleunup for SP

  mysql-test/t/sp.test
    1.124 05/06/22 00:17:04 bell@stripped +27 -2
    test commented until bug#11394 fix
    bug10136

  mysql-test/r/sp.result
    1.129 05/06/22 00:17:04 bell@stripped +52 -2
    test commented until bug#11394 fix
    test for bug#10136

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bell
# Host:	sanja.is.com.ua
# Root:	/home/bell/mysql/bk/work-bug4-5.0

--- 1.128/mysql-test/r/sp.result	Fri Jun 10 17:56:25 2005
+++ 1.129/mysql-test/r/sp.result	Wed Jun 22 00:17:04 2005
@@ -1133,8 +1133,6 @@
 select f5(1)|
 f5(1)
 1
-select f5(2)|
-ERROR HY000: Table 't1' was not locked with LOCK TABLES
 create function f6() returns int
 begin
 declare n int;
@@ -3174,4 +3172,56 @@
 DROP PROCEDURE bug6866;
 DROP VIEW tv|
 DROP TABLE tt1, tt2, tt3|
+DROP PROCEDURE IF EXISTS bug10136|
+create table t3 ( name char(5) not null primary key, val float not null)|
+insert into t3 values ('aaaaa', 1), ('bbbbb', 2), ('ccccc', 3)|
+create procedure bug10136()
+begin
+declare done int default 3;
+repeat
+select * from t3;
+set done = done - 1;
+until done <= 0 end repeat;
+end|
+call bug10136()|
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+call bug10136()|
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+call bug10136()|
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+name	val
+aaaaa	1
+bbbbb	2
+ccccc	3
+drop procedure bug10136|
+drop table t3|
 drop table t1,t2;

--- 1.123/mysql-test/t/sp.test	Fri Jun 10 17:56:25 2005
+++ 1.124/mysql-test/t/sp.test	Wed Jun 22 00:17:04 2005
@@ -1364,8 +1364,9 @@
 end|
 select f5(1)|
 # This should generate an error about insuficient number of tables locked
---error 1100
-select f5(2)|
+# Nuw this crash server, comented until bug#11394 fix
+#--error 1100
+#select f5(2)|
 # But now it simply miserably fails because we are trying to use the same
 # lex on the next iteration :/ It should generate some error too...
 # select f5(3)|
@@ -3885,6 +3886,30 @@
 
 DROP VIEW tv|
 DROP TABLE tt1, tt2, tt3|
+
+#
+# BUG#10136: items cleunup
+#
+--disable_warnings
+DROP PROCEDURE IF EXISTS bug10136|
+--enable_warnings
+create table t3 ( name char(5) not null primary key, val float not null)|
+insert into t3 values ('aaaaa', 1), ('bbbbb', 2), ('ccccc', 3)|
+create procedure bug10136()
+begin
+  declare done int default 3;
+
+  repeat
+    select * from t3;
+    set done = done - 1;
+  until done <= 0 end repeat;
+
+end|
+call bug10136()|
+call bug10136()|
+call bug10136()|
+drop procedure bug10136|
+drop table t3|
 
 #
 # BUG#NNNN: New bug synopsis

--- 1.146/sql/sp_head.cc	Tue Jun 21 17:18:22 2005
+++ 1.147/sql/sp_head.cc	Wed Jun 22 00:17:04 2005
@@ -636,7 +636,21 @@
       break;
     DBUG_PRINT("execute", ("Instruction %u", ip));
     thd->set_time();		// Make current_time() et al work
-    ret= i->execute(thd, &ip);
+    {
+      /*
+        We have to substitute free_list of executing statement to
+        current_arena to store there all new items created during execution
+        (for example '*' expanding, or items made during permanent subquery
+        transformation)
+        Note: Every statement have to have all its items listed in free_list
+        for correct cleaning them up
+      */
+      Item *save_free_list= thd->current_arena->free_list;
+      thd->current_arena->free_list= i->free_list;
+      ret= i->execute(thd, &ip);
+      i->free_list= thd->current_arena->free_list;
+      thd->current_arena->free_list= save_free_list;
+    }
     if (i->free_list)
       cleanup_items(i->free_list);
     // Check if an exception has occurred and a handler has been found
Thread
bk commit into 5.0 tree (bell:1.1976) BUG#10136sanja21 Jun