List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:March 3 2010 9:24am
Subject:bzr commit into mysql-next-mr-bugfixing branch (jon.hauglid:3120) Bug#51376
View as plain text  
#At file:///export/home/z/mysql-next-4284-bug51376/ based on revid:dlenev@stripped

 3120 Jon Olav Hauglid	2010-03-03
      Bug #51376 Assert `! is_set()' failed in 
                 Diagnostics_area::set_ok_status on DROP FUNCTION
      
      This assert tests that the server is not trying to send "ok" to
      the client if an error has occured during statement processing.
      
      In this case, the assert was triggered by lock timeout errors when
      accessing system tables to do an implicit REVOKE after executing
      DROP FUNCTION/PROCEDURE. In practice, this was only likely to
      happen with very low values for "lock_wait_timeout" (in the bug report
      1 second was used). These errors were ignored and the server tried
      to send "ok" to the client, triggering the assert.
      
      The patch for Bug#45225 introduced lock timeouts for metadata locks.
      This made it possible to get timeouts when accessing system tables.
      Note that a followup patch for Bug#45225 pushed after this
      bug was reported, changed accessing of system tables such
      that the user-supplied timeout value is ignored and the maximum
      timeout value is used instead. This exact bug was therefore
      only noticeable in the period between the initial Bug#45225 patch
      and the followup patch.
      
      However, the same problem could occur for any errors during revoking
      of privileges - not just timeouts. This patch fixes the problem by
      making sure that any errors during revoking of privileges are
      reported to the client. 
      
      Test case added to sp-destruct.test. Since the original bug is not
      reproducable now that system tables are accessed using a a long
      timeout value, this test instead calls DROP FUNCTION with a grant
      system table missing.

    modified:
      mysql-test/r/sp-destruct.result
      mysql-test/t/sp-destruct.test
      sql/sql_parse.cc
=== modified file 'mysql-test/r/sp-destruct.result'
--- a/mysql-test/r/sp-destruct.result	2009-11-21 11:18:21 +0000
+++ b/mysql-test/r/sp-destruct.result	2010-03-03 09:24:53 +0000
@@ -116,3 +116,21 @@ ERROR HY000: Cannot load from mysql.proc
 DROP TABLE mysql.proc;
 RENAME TABLE proc_backup TO mysql.proc;
 FLUSH TABLE mysql.proc;
+#
+# Bug#51376 Assert `! is_set()' failed in 
+#           Diagnostics_area::set_ok_status on DROP FUNCTION
+#
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+# Backup the procs_priv table
+RENAME TABLE mysql.procs_priv TO procs_priv_backup;
+FLUSH TABLE mysql.procs_priv;
+DROP FUNCTION f1;
+ERROR 42S02: Table 'mysql.procs_priv' doesn't exist
+SHOW WARNINGS;
+Level	Code	Message
+Error	1146	Table 'mysql.procs_priv' doesn't exist
+Warning	1405	Failed to revoke all privileges to dropped routine
+# Restore the procs_priv table
+RENAME TABLE procs_priv_backup TO mysql.procs_priv;
+FLUSH TABLE mysql.procs_priv;

=== modified file 'mysql-test/t/sp-destruct.test'
--- a/mysql-test/t/sp-destruct.test	2009-11-21 11:18:21 +0000
+++ b/mysql-test/t/sp-destruct.test	2010-03-03 09:24:53 +0000
@@ -197,3 +197,28 @@ SHOW PROCEDURE STATUS;
 DROP TABLE mysql.proc;
 RENAME TABLE proc_backup TO mysql.proc;
 FLUSH TABLE mysql.proc;
+
+
+--echo #
+--echo # Bug#51376 Assert `! is_set()' failed in 
+--echo #           Diagnostics_area::set_ok_status on DROP FUNCTION
+--echo #
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+
+--echo # Backup the procs_priv table
+RENAME TABLE mysql.procs_priv TO procs_priv_backup;
+FLUSH TABLE mysql.procs_priv;
+
+# DROP FUNCTION used to cause an assert.
+--error ER_NO_SUCH_TABLE
+DROP FUNCTION f1;
+SHOW WARNINGS;
+
+--echo # Restore the procs_priv table
+RENAME TABLE procs_priv_backup TO mysql.procs_priv;
+FLUSH TABLE mysql.procs_priv;

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-02-27 17:05:14 +0000
+++ b/sql/sql_parse.cc	2010-03-03 09:24:53 +0000
@@ -4326,14 +4326,16 @@ create_sp_error:
         close_thread_tables(thd);
         thd->mdl_context.release_transactional_locks();
 
-	if (sp_automatic_privileges && !opt_noacl &&
-	    sp_revoke_privileges(thd, db, name,
+        if (sp_automatic_privileges && !opt_noacl &&
+            sp_revoke_privileges(thd, db, name,
                                  lex->sql_command == SQLCOM_DROP_PROCEDURE))
-	{
-	  push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-		       ER_PROC_AUTO_REVOKE_FAIL,
-		       ER(ER_PROC_AUTO_REVOKE_FAIL));
-	}
+        {
+          push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+                       ER_PROC_AUTO_REVOKE_FAIL,
+                       ER(ER_PROC_AUTO_REVOKE_FAIL));
+          /* If this happens, an error should have been reported. */
+          goto error;
+        }
 #endif
       }
       res= sp_result;


Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20100303092453-3a0nbxucqis4w1bt.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (jon.hauglid:3120) Bug#51376Jon Olav Hauglid3 Mar
  • Re: bzr commit into mysql-next-mr-bugfixing branch (jon.hauglid:3120)Bug#51376Dmitry Lenev3 Mar