List:Commits« Previous MessageNext Message »
From:kroki Date:September 6 2006 12:19pm
Subject:bk commit into 5.0 tree (kroki:1.2248) BUG#21414
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tomash. When tomash 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@stripped, 2006-09-06 16:19:25+04:00, kroki@stripped +3 -0
  BUG#21414: SP: Procedure undroppable, to some extent
  
  The problem was that if after FLUSH TABLES WITH READ LOCK the user
  issued DROP/ALTER PROCEDURE/FUNCTION the operation would fail (as
  expected), but after UNLOCK TABLE any attempt execute the same operation
  would lead to the error 1305 "PROCEDURE/FUNCTION does not exist",
  and an attempt to execute any stored function will also fail.
  
  The solution is not to reset mysql_proc_table_exists if we are in a
  GLOBAL READ LOCK mode (i.e. if THD::global_read_lock is set).

  mysql-test/r/sp.result@stripped, 2006-09-06 16:19:14+04:00, kroki@stripped +8 -0
    Add result for bug#21414: SP: Procedure undroppable, to some extent.

  mysql-test/t/sp.test@stripped, 2006-09-06 16:19:14+04:00, kroki@stripped +21 -0
    Add test case for bug#21414: SP: Procedure undroppable, to some extent.

  sql/sp.cc@stripped, 2006-09-06 16:19:15+04:00, kroki@stripped +6 -5
    If we are going to reset mysql_proc_table_exists, check that we are not
    in THD::global_read_lock state.

# 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:	kroki
# Host:	moonlight.intranet
# Root:	/home/tomash/src/mysql_ab/mysql-5.0-bug21414

--- 1.210/mysql-test/r/sp.result	2006-09-06 16:19:49 +04:00
+++ 1.211/mysql-test/r/sp.result	2006-09-06 16:19:49 +04:00
@@ -5394,4 +5394,12 @@ Procedure	sql_mode	Create Procedure
 bug21416		CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`()
 show create procedure bug21416
 drop procedure bug21416|
+DROP PROCEDURE IF EXISTS bug21414|
+CREATE PROCEDURE bug21414() SELECT 1|
+FLUSH TABLES WITH READ LOCK|
+DROP PROCEDURE bug21414|
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UNLOCK TABLES|
+The following should succeed.
+DROP PROCEDURE bug21414|
 drop table t1,t2;

--- 1.198/mysql-test/t/sp.test	2006-09-06 16:19:49 +04:00
+++ 1.199/mysql-test/t/sp.test	2006-09-06 16:19:49 +04:00
@@ -6322,6 +6322,27 @@ create procedure bug21416() show create 
 call bug21416()|
 drop procedure bug21416|
 
+
+#
+# BUG#21414: SP: Procedure undroppable, to some extent
+#
+--disable_warnings
+DROP PROCEDURE IF EXISTS bug21414|
+--enable_warnings
+
+CREATE PROCEDURE bug21414() SELECT 1|
+
+FLUSH TABLES WITH READ LOCK|
+
+--error ER_CANT_UPDATE_WITH_READLOCK
+DROP PROCEDURE bug21414|
+
+UNLOCK TABLES|
+
+--echo The following should succeed.
+DROP PROCEDURE bug21414|
+
+
 #
 # BUG#NNNN: New bug synopsis
 #

--- 1.116/sql/sp.cc	2006-09-06 16:19:50 +04:00
+++ 1.117/sql/sp.cc	2006-09-06 16:19:50 +04:00
@@ -185,12 +185,13 @@ static TABLE *open_proc_table_for_update
   table= open_ltable(thd, &tables, TL_WRITE);
 
   /*
-    Under explicit LOCK TABLES or in prelocked mode we should not
-    say that mysql.proc table does not exist if we are unable to
-    open and lock it for writing since this condition may be
-    transient.
+    Under explicit LOCK TABLES (or FLUSH TABLES WITH READ LOCK) or in
+    prelocked mode we should not say that mysql.proc table does not
+    exist if we are unable to open and lock it for writing since this
+    condition may be transient.
   */
-  if (!(thd->locked_tables || thd->prelocked_mode) || table)
+  if (!(thd->locked_tables || thd->prelocked_mode || thd->global_read_lock) ||
+      table)
     mysql_proc_table_exists= test(table);
 
   DBUG_RETURN(table);
Thread
bk commit into 5.0 tree (kroki:1.2248) BUG#21414kroki6 Sep