List:Commits« Previous MessageNext Message »
From:Horst.Hunger Date:April 21 2010 9:17am
Subject:bzr commit into mysql-next-mr-bugfixing branch (horst.hunger:3144)
View as plain text  
#At file:///home/horst/bzr/next-mr-47748-2/ based on revid:horst.hunger@stripped

 3144 Horst.Hunger	2010-04-21 [merge]
      due to merge needed to push.

    modified:
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/lock_sync.result
      mysql-test/r/myisam.result
      mysql-test/r/show_check.result
      mysql-test/r/sp-lock.result
      mysql-test/r/sp_sync.result
      mysql-test/suite/perfschema/r/misc.result
      mysql-test/suite/perfschema/t/misc.test
      mysql-test/t/disabled.def
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/lock_sync.test
      mysql-test/t/myisam.test
      mysql-test/t/show_check.test
      mysql-test/t/sp-lock.test
      mysql-test/t/sp_sync.test
      sql/event_scheduler.cc
      sql/handler.cc
      sql/sql_base.cc
      sql/sql_parse.cc
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sql_update.cc
      sql/sys_vars.cc
      storage/myisam/ha_myisam.h
      storage/perfschema/pfs_engine_table.cc
=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result	2009-12-09 08:32:29 +0000
+++ b/mysql-test/r/innodb_mysql_sync.result	2010-04-15 16:53:57 +0000
@@ -24,3 +24,27 @@ Warnings:
 Error	1030	Got error -1 from storage engine
 DROP TABLE t1;
 SET DEBUG_SYNC='RESET';
+#
+# Bug#47459 Assertion in Diagnostics_area::set_eof_status on
+#           OPTIMIZE TABLE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT) ENGINE= InnoDB;
+# Connection con1
+SET DEBUG_SYNC= "ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped";
+# Sending:
+OPTIMIZE TABLE t1;
+# Connection default
+SET DEBUG_SYNC= "now WAIT_FOR opening";
+DROP TABLE t1;
+SET DEBUG_SYNC= "now SIGNAL dropped";
+# Connection con1
+# Reaping: OPTIMIZE TABLE t1
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
+test.t1	optimize	error	Table 'test.t1' doesn't exist
+test.t1	optimize	status	Operation failed
+Warnings:
+Error	1146	Table 'test.t1' doesn't exist
+# Connection default
+SET DEBUG_SYNC= "RESET";

=== modified file 'mysql-test/r/lock_sync.result'
--- a/mysql-test/r/lock_sync.result	2010-02-11 16:10:34 +0000
+++ b/mysql-test/r/lock_sync.result	2010-04-15 12:14:28 +0000
@@ -92,3 +92,23 @@ COMMIT;
 # Connection default
 # Reaping ALTER TABLE t1 ADD COLUMN j INT
 DROP TABLE t1, t2;
+#
+# Bug#51391 Deadlock involving events during rqg_info_schema test
+#
+CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
+CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
+# Connection con1
+SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
+# Sending:
+DROP EVENT e1;;
+# Connection default
+SET DEBUG_SYNC="now WAIT_FOR drop";
+SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE definer = VARIABLE_VALUE;
+name
+SET DEBUG_SYNC="now SIGNAL query";
+# Connection con1
+# Reaping: DROP EVENT t1
+# Connection default
+DROP EVENT e2;
+SET DEBUG_SYNC="RESET";

=== modified file 'mysql-test/r/myisam.result'
--- a/mysql-test/r/myisam.result	2010-03-24 15:03:44 +0000
+++ b/mysql-test/r/myisam.result	2010-04-20 08:51:50 +0000
@@ -2411,3 +2411,36 @@ DROP TABLE t1;
 SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
 SET myisam_repair_threads=@@global.myisam_repair_threads;
 End of 5.1 tests
+#
+# Bug#51327 MyISAM table is automatically repaired on ALTER
+#           even if myisam-recover is OFF
+#
+call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
+call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+call mtr.add_suppression(" '\..test.t1'");
+# Test that we can exchange a crashed partition with a table
+SELECT @@global.myisam_recover_options;
+@@global.myisam_recover_options
+OFF
+CREATE TABLE t1 (a INT, KEY (a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2);
+FLUSH TABLES;
+# replacing t.MYI with a corrupt + unclosed one created by doing:
+# 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI 
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	warning	1 client is using or hasn't closed the table properly
+test.t1	check	error	Size of indexfile is: 1024        Should be: 2048
+test.t1	check	warning	Size of datafile is: 14       Should be: 7
+test.t1	check	error	Corrupt
+# Alter table should report error and not auto-repair the table.
+ALTER TABLE t1 ENGINE = MyISAM;
+ERROR HY000: Table 't1' is marked as crashed and should be repaired
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	warning	Table is marked as crashed
+test.t1	check	warning	1 client is using or hasn't closed the table properly
+test.t1	check	error	Size of indexfile is: 1024        Should be: 2048
+test.t1	check	warning	Size of datafile is: 14       Should be: 7
+test.t1	check	error	Corrupt
+DROP TABLE t1;

=== modified file 'mysql-test/r/show_check.result'
--- a/mysql-test/r/show_check.result	2010-03-20 09:35:40 +0000
+++ b/mysql-test/r/show_check.result	2010-04-21 07:35:37 +0000
@@ -1448,3 +1448,20 @@ DROP USER test_u@localhost;
 SHOW CREATE TABLE non_existent;
 ERROR 70100: Query execution was interrupted
 End of 5.1 tests
+#
+# Bug#52593 SHOW CREATE TABLE is blocked if table is locked
+#           for write by another connection
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (i INT PRIMARY KEY);
+LOCK TABLE t1 WRITE;
+# Switching to connection 'con1'.
+# This statement used to be blocked.
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `i` int(11) NOT NULL,
+  PRIMARY KEY (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+# Switching to connection 'default'.
+UNLOCK TABLES;
+DROP TABLE t1;

=== modified file 'mysql-test/r/sp-lock.result'
--- a/mysql-test/r/sp-lock.result	2009-12-30 17:53:30 +0000
+++ b/mysql-test/r/sp-lock.result	2010-04-19 13:35:13 +0000
@@ -693,5 +693,47 @@ set @@session.max_sp_recursion_depth=def
 # --> connection con3
 # --> connection default
 #
+# SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
+#
+# We are just covering the existing behaviour with tests. The
+# results are not necessarily correct."
+#
+CREATE PROCEDURE p1()
+BEGIN
+SELECT get_lock("test", 10);
+SHOW CREATE PROCEDURE p1;
+END|
+# Connection default
+SELECT get_lock("test", 10);
+get_lock("test", 10)
+1
+# Connection 2
+# Will halt before executing SHOW CREATE PROCEDURE p1
+# Sending:
+CALL p1();
+# Connection 3
+# Alter p1
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() BEGIN END;
+# Connection default
+# Resume CALL p1, now with new p1
+SELECT release_lock("test");
+release_lock("test")
+1
+# Connection 2
+# Reaping: CALL p1()
+get_lock("test", 10)
+1
+Procedure	sql_mode	Create Procedure	character_set_client	collation_connection	Database Collation
+p1		CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN
+SELECT get_lock("test", 10);
+SHOW CREATE PROCEDURE p1;
+END	latin1	latin1_swedish_ci	latin1_swedish_ci
+# Connection 3
+# Connection 2
+# Connection default;
+DROP PROCEDURE p1;
+#
 # End of 5.5 tests
 #

=== modified file 'mysql-test/r/sp_sync.result'
--- a/mysql-test/r/sp_sync.result	2010-01-12 14:16:26 +0000
+++ b/mysql-test/r/sp_sync.result	2010-04-19 13:35:13 +0000
@@ -1,23 +1,94 @@
 Tests of syncronization of stored procedure execution.
+SET DEBUG_SYNC= 'RESET';
 #
-# Bug#48157: crash in Item_field::used_tables
+# Bug #30977 Concurrent statement using stored function and
+#            DROP FUNCTION breaks SBR
 #
-CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
-CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
-CREATE PROCEDURE p1()
-BEGIN
-UPDATE t1 JOIN t2 USING( a, b ) SET t1.b = 1, t2.b = 1;
-END|
-LOCK TABLES t1 WRITE, t2 WRITE;
-SET DEBUG_SYNC = 'multi_update_reopen_tables SIGNAL parked WAIT_FOR go';
+# A stored routine could change after dispatch_command()
+# but before a MDL lock is taken. This must be noticed and the
+# sp cache flushed so the correct version can be loaded.
+#
+# Connection default
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+# Get f1 cached
+SELECT f1();
+f1()
+1
+# Then start executing it again...
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL before WAIT_FOR changed';
+# Sending:
+SELECT f1();
+# Connection 2
+SET DEBUG_SYNC= 'now WAIT_FOR before';
+# ... but before f1 is locked, change it.
+DROP FUNCTION f1;
+CREATE FUNCTION f1() RETURNS INT RETURN 2;
+SET DEBUG_SYNC= 'now SIGNAL changed';
+# Connection default
+# We should now get '2' and not '1'.
+# Reaping: SELECT f1()
+f1()
+2
+DROP FUNCTION f1;
+SET DEBUG_SYNC= 'RESET';
+#
+# Field translation items must be cleared in case of back-offs
+# for queries that use Information Schema tables. Otherwise 
+# memory allocated in fix_fields() for views may end up referring
+# to freed memory.
+#
+DROP FUNCTION IF EXISTS f1;
+# Connection default
+CREATE FUNCTION f1() RETURNS INT RETURN 0;
+# Connection con2
+SET DEBUG_SYNC= 'after_wait_locked_pname SIGNAL locked WAIT_FOR issued';
+# con2 will now have an x-lock on f1
+# Sending:
+ALTER FUNCTION f1 COMMENT 'comment';
+# Connection default
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+# This query will block due to the x-lock on f1 and back-off
+SHOW OPEN TABLES WHERE f1()=0;
+# Connection con3
+# Check that the IS query is blocked before releasing the x-lock
+SET DEBUG_SYNC= 'now SIGNAL issued';
+# Connection default
+# Reaping: ALTER FUNCTION f1 COMMENT 'comment'
+DROP FUNCTION f1;
+SET DEBUG_SYNC= 'RESET';
+#
+# Bug #48246 assert in close_thread_table
+#
+CREATE TABLE t1 (a INTEGER);
+CREATE FUNCTION f1(b INTEGER) RETURNS INTEGER RETURN 1;
+CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1;
+INSERT INTO t1 VALUES(1), (2);
+# Connection 2
+CALL p1();
+COUNT(f1(a))
+2
+# Connection default
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR called';
+# Sending:
+CREATE TABLE t1 (a INTEGER);
+# Connection 2
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL called WAIT_FOR created';
+# This call used to cause an assertion. MDL locking conflict will
+# cause back-off and retry. A variable indicating if a prelocking list
+# exists, used to be not reset properly causing an eventual assert.
+# Sending:
 CALL p1();
-DROP TABLE t1, t2;
-SET DEBUG_SYNC = 'now WAIT_FOR parked';
-CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
-CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
-SET DEBUG_SYNC = 'now SIGNAL go';
-# Without the DEBUG_SYNC supplied in the same patch as this test in the 
-# code, this test statement will hang.
-DROP TABLE t1, t2;
+# Connection default
+# Reaping: CREATE TABLE t1 (a INTEGER)
+ERROR 42S01: Table 't1' already exists
+SET DEBUG_SYNC= 'now SIGNAL created';
+# Connection 2
+# Reaping: CALL p1()
+COUNT(f1(a))
+2
+# Connection default
 DROP PROCEDURE p1;
-SET DEBUG_SYNC = 'RESET';
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/suite/perfschema/r/misc.result'
--- a/mysql-test/suite/perfschema/r/misc.result	2010-02-26 17:39:57 +0000
+++ b/mysql-test/suite/perfschema/r/misc.result	2010-04-07 08:53:19 +0000
@@ -25,3 +25,5 @@ drop table test.ghost;
 select * from performance_schema.FILE_INSTANCES
 where file_name like "%ghost%";
 FILE_NAME	EVENT_NAME	OPEN_COUNT
+select * from performance_schema.no_such_table;
+ERROR 42S02: Table 'performance_schema.no_such_table' doesn't exist

=== modified file 'mysql-test/suite/perfschema/t/misc.test'
--- a/mysql-test/suite/perfschema/t/misc.test	2010-03-22 09:08:28 +0000
+++ b/mysql-test/suite/perfschema/t/misc.test	2010-04-07 08:53:19 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Sun Microsystems, Inc
+# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 # Tests for PERFORMANCE_SCHEMA
 # Miscelaneous
@@ -76,3 +76,10 @@ drop table test.ghost;
 select * from performance_schema.FILE_INSTANCES
   where file_name like "%ghost%";
 
+#
+# Bug#52586 Misleading error message on attempt to access
+#           a P_S table using a wrong name
+
+--error ER_NO_SUCH_TABLE
+select * from performance_schema.no_such_table;
+

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2010-03-01 23:05:30 +0000
+++ b/mysql-test/t/disabled.def	2010-04-19 13:35:13 +0000
@@ -11,7 +11,6 @@
 ##############################################################################
 kill                     : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
 query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-sp_sync                  : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
 innodb-autoinc           : Bug#49267 2009-12-02 test fails on windows because of different case mode
 innodb                   : Bug#49396 2009-12-03 test fails in embedded mode
 plugin_load              : Bug#42144 2009-12-21 alik plugin_load fails

=== modified file 'mysql-test/t/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test	2009-12-09 08:32:29 +0000
+++ b/mysql-test/t/innodb_mysql_sync.test	2010-04-15 16:53:57 +0000
@@ -43,6 +43,43 @@ DROP TABLE t1;
 SET DEBUG_SYNC='RESET';
 
 
+--echo #
+--echo # Bug#47459 Assertion in Diagnostics_area::set_eof_status on
+--echo #           OPTIMIZE TABLE
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+connect (con1, localhost, root);
+connection default;
+
+CREATE TABLE t1(a INT) ENGINE= InnoDB;
+
+--echo # Connection con1
+connection con1;
+SET DEBUG_SYNC= "ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped";
+--echo # Sending:
+--send OPTIMIZE TABLE t1
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= "now WAIT_FOR opening";
+DROP TABLE t1;
+SET DEBUG_SYNC= "now SIGNAL dropped";
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: OPTIMIZE TABLE t1
+--reap
+
+--echo # Connection default
+connection default;
+disconnect con1;
+SET DEBUG_SYNC= "RESET";
+
+
 # Check that all connections opened by test cases in this file are really
 # gone so execution of other tests won't be affected by their presence.
 --source include/wait_until_count_sessions.inc

=== modified file 'mysql-test/t/lock_sync.test'
--- a/mysql-test/t/lock_sync.test	2010-02-11 16:10:34 +0000
+++ b/mysql-test/t/lock_sync.test	2010-04-15 12:14:28 +0000
@@ -178,6 +178,39 @@ DROP TABLE t1, t2;
 disconnect con2;
 
 
+--echo #
+--echo # Bug#51391 Deadlock involving events during rqg_info_schema test
+--echo #
+
+CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
+CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
+
+--echo # Connection con1
+connect(con1, localhost, root);
+SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
+--echo # Sending:
+--send DROP EVENT e1;
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC="now WAIT_FOR drop";
+SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
+  WHERE definer = VARIABLE_VALUE;
+SET DEBUG_SYNC="now SIGNAL query";
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: DROP EVENT t1
+--reap
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+--echo # Connection default
+connection default;
+DROP EVENT e2;
+SET DEBUG_SYNC="RESET";
+
+
 # Check that all connections opened by test cases in this file are really
 # gone so execution of other tests won't be affected by their presence.
 --source include/wait_until_count_sessions.inc

=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test	2010-03-24 15:03:44 +0000
+++ b/mysql-test/t/myisam.test	2010-04-20 08:51:50 +0000
@@ -1648,3 +1648,35 @@ SET myisam_sort_buffer_size=@@global.myi
 SET myisam_repair_threads=@@global.myisam_repair_threads;
 
 --echo End of 5.1 tests
+
+
+--echo #
+--echo # Bug#51327 MyISAM table is automatically repaired on ALTER
+--echo #           even if myisam-recover is OFF
+--echo #
+
+call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
+call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+call mtr.add_suppression(" '\..test.t1'");
+
+let $MYSQLD_DATADIR = `SELECT @@datadir`;
+--echo # Test that we can exchange a crashed partition with a table
+SELECT @@global.myisam_recover_options;
+CREATE TABLE t1 (a INT, KEY (a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2);
+FLUSH TABLES;
+
+--echo # replacing t.MYI with a corrupt + unclosed one created by doing:
+--echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI 
+--remove_file $MYSQLD_DATADIR/test/t1.MYI
+--copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1.MYI
+
+CHECK TABLE t1;
+--echo # Alter table should report error and not auto-repair the table.
+# Remove the path to t1 to prevent platform differences
+--replace_regex /'[^']+'/'t1'/
+--error 145
+ALTER TABLE t1 ENGINE = MyISAM;
+CHECK TABLE t1;
+
+DROP TABLE t1;

=== modified file 'mysql-test/t/show_check.test'
--- a/mysql-test/t/show_check.test	2010-02-14 00:59:39 +0000
+++ b/mysql-test/t/show_check.test	2010-04-21 07:35:37 +0000
@@ -1212,6 +1212,32 @@ DISCONNECT con1;
 
 --echo End of 5.1 tests
 
+
+--echo #
+--echo # Bug#52593 SHOW CREATE TABLE is blocked if table is locked
+--echo #           for write by another connection
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+connect(con1, localhost,root);
+connection default;
+
+CREATE TABLE t1 (i INT PRIMARY KEY);
+LOCK TABLE t1 WRITE;
+--echo # Switching to connection 'con1'.
+connection con1;
+--echo # This statement used to be blocked.
+SHOW CREATE TABLE t1;
+
+--echo # Switching to connection 'default'.
+connection default;
+disconnect con1;
+UNLOCK TABLES;
+DROP TABLE t1;
+
+
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 

=== modified file 'mysql-test/t/sp-lock.test'
--- a/mysql-test/t/sp-lock.test	2009-12-30 17:53:30 +0000
+++ b/mysql-test/t/sp-lock.test	2010-04-19 13:35:13 +0000
@@ -893,6 +893,68 @@ disconnect con3;
 --source include/wait_until_disconnected.inc
 --echo # --> connection default
 connection default;
+
+
+--echo #
+--echo # SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
+--echo #
+--echo # We are just covering the existing behaviour with tests. The
+--echo # results are not necessarily correct."
+--echo #
+
+delimiter |;
+CREATE PROCEDURE p1()
+BEGIN
+  SELECT get_lock("test", 10);
+  SHOW CREATE PROCEDURE p1;
+END|
+delimiter ;|
+
+connect (con2, localhost, root);
+connect (con3, localhost, root);
+
+--echo # Connection default
+connection default;
+SELECT get_lock("test", 10);
+
+--echo # Connection 2
+connection con2;
+--echo # Will halt before executing SHOW CREATE PROCEDURE p1
+--echo # Sending:
+--send CALL p1()
+
+--echo # Connection 3
+connection con3;
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist 
+  WHERE state='User lock' and info='SELECT get_lock("test", 10)';
+--source include/wait_condition.inc
+--echo # Alter p1
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() BEGIN END;
+
+--echo # Connection default
+connection default;
+--echo # Resume CALL p1, now with new p1
+SELECT release_lock("test");
+
+--echo # Connection 2
+connection con2;
+--echo # Reaping: CALL p1()
+--reap
+
+--echo # Connection 3
+connection con3;
+disconnect con3;
+--source include/wait_until_disconnected.inc
+--echo # Connection 2
+connection con2;
+disconnect con2;
+--source include/wait_until_disconnected.inc
+--echo # Connection default;
+connection default;
+DROP PROCEDURE p1;
+
+
 --echo #
 --echo # End of 5.5 tests
 --echo #

=== modified file 'mysql-test/t/sp_sync.test'
--- a/mysql-test/t/sp_sync.test	2010-02-06 10:28:06 +0000
+++ b/mysql-test/t/sp_sync.test	2010-04-19 13:35:13 +0000
@@ -5,54 +5,156 @@
 
 --source include/have_debug_sync.inc
 
+# Save the initial number of concurrent sessions.
+--source include/count_sessions.inc
+
+# Clean up resources used in this test case.
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+--enable_warnings
+
+--echo #
+--echo # Bug #30977 Concurrent statement using stored function and
+--echo #            DROP FUNCTION breaks SBR
 --echo #
---echo # Bug#48157: crash in Item_field::used_tables
+--echo # A stored routine could change after dispatch_command()
+--echo # but before a MDL lock is taken. This must be noticed and the
+--echo # sp cache flushed so the correct version can be loaded.
 --echo #
 
-CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
-CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
+connect (con2, localhost, root);
 
-DELIMITER |;
+--echo # Connection default
+connection default;
+CREATE FUNCTION f1() RETURNS INT RETURN 1;
+--echo # Get f1 cached
+SELECT f1();
+--echo # Then start executing it again...
+SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL before WAIT_FOR changed';
+--echo # Sending:
+--send SELECT f1()
 
-CREATE PROCEDURE p1()
-BEGIN
-   UPDATE t1 JOIN t2 USING( a, b ) SET t1.b = 1, t2.b = 1;
-END|
+--echo # Connection 2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR before';
+--echo # ... but before f1 is locked, change it.
+DROP FUNCTION f1;
+CREATE FUNCTION f1() RETURNS INT RETURN 2;
+SET DEBUG_SYNC= 'now SIGNAL changed';
 
-DELIMITER ;|
+--echo # Connection default
+--echo # We should now get '2' and not '1'.
+connection default;
+--echo # Reaping: SELECT f1()
+--reap
 
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
+disconnect con2;
+DROP FUNCTION f1;
+SET DEBUG_SYNC= 'RESET';
 
-connection con1;
-LOCK TABLES t1 WRITE, t2 WRITE;
+--echo #
+--echo # Field translation items must be cleared in case of back-offs
+--echo # for queries that use Information Schema tables. Otherwise 
+--echo # memory allocated in fix_fields() for views may end up referring
+--echo # to freed memory.
+--echo #
 
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+connect (con2, localhost, root);
+connect (con3, localhost, root);
+
+--echo # Connection default
+connection default;
+CREATE FUNCTION f1() RETURNS INT RETURN 0;
+
+--echo # Connection con2
 connection con2;
-LET $ID= `select connection_id()`;
-SET DEBUG_SYNC = 'multi_update_reopen_tables SIGNAL parked WAIT_FOR go';
---send CALL p1()
+SET DEBUG_SYNC= 'after_wait_locked_pname SIGNAL locked WAIT_FOR issued';
+--echo # con2 will now have an x-lock on f1
+--echo # Sending:
+--send ALTER FUNCTION f1 COMMENT 'comment'
 
-connection con1;
-let $wait_condition= SELECT 1 FROM information_schema.processlist WHERE ID = $ID AND
-state = "Waiting for table";
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+--disable_result_log
+--echo # This query will block due to the x-lock on f1 and back-off
+--send SHOW OPEN TABLES WHERE f1()=0
+
+--echo # Connection con3
+connection con3;
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+  WHERE state= 'Waiting for table' 
+  AND info='SHOW OPEN TABLES WHERE f1()=0';
 --source include/wait_condition.inc
-DROP TABLE t1, t2;
-SET DEBUG_SYNC = 'now WAIT_FOR parked';
-CREATE TABLE t1 AS SELECT 1 AS a, 1 AS b;
-CREATE TABLE t2 AS SELECT 1 AS a, 1 AS b;
-SET DEBUG_SYNC = 'now SIGNAL go';
+--echo # Check that the IS query is blocked before releasing the x-lock
+SET DEBUG_SYNC= 'now SIGNAL issued';
 
-connection con2;
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER FUNCTION f1 COMMENT 'comment'
 --reap
-
-disconnect con1;
+--enable_result_log
+DROP FUNCTION f1;
+SET DEBUG_SYNC= 'RESET';
 disconnect con2;
+disconnect con3;
+
+
+--echo #
+--echo # Bug #48246 assert in close_thread_table
+--echo #
+
+CREATE TABLE t1 (a INTEGER);
+CREATE FUNCTION f1(b INTEGER) RETURNS INTEGER RETURN 1;
+CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1;
+
+INSERT INTO t1 VALUES(1), (2);
+
+--echo # Connection 2
+connect (con2, localhost, root);
+CALL p1();
+
+--echo # Connection default
+connection default;
+SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR called';
+--echo # Sending:
+--send CREATE TABLE t1 (a INTEGER)
+
+--echo # Connection 2
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR locked';
+SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL called WAIT_FOR created';
+--echo # This call used to cause an assertion. MDL locking conflict will
+--echo # cause back-off and retry. A variable indicating if a prelocking list
+--echo # exists, used to be not reset properly causing an eventual assert.
+--echo # Sending:
+--send CALL p1()
+
+--echo # Connection default
 connection default;
+--echo # Reaping: CREATE TABLE t1 (a INTEGER)
+--error ER_TABLE_EXISTS_ERROR
+--reap
+SET DEBUG_SYNC= 'now SIGNAL created';
 
---echo # Without the DEBUG_SYNC supplied in the same patch as this test in the 
---echo # code, this test statement will hang.
-DROP TABLE t1, t2;
+--echo # Connection 2
+connection con2;
+--echo # Reaping: CALL p1()
+--reap;
+
+--echo # Connection default
+connection default;
+disconnect con2;
 DROP PROCEDURE p1;
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
 
-SET DEBUG_SYNC = 'RESET';
 
+# Check that all connections opened by test cases in this file are really
+# gone so execution of other tests won't be affected by their presence.
+--source include/wait_until_count_sessions.inc

=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc	2010-03-31 14:05:33 +0000
+++ b/sql/event_scheduler.cc	2010-04-20 08:51:50 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2006 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (C) 2004, 2010 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 #include "sql_priv.h"
 #include "unireg.h"
@@ -500,8 +500,8 @@ Event_scheduler::run(THD *thd)
   deinit_event_thread(thd);
   scheduler_thd= NULL;
   state= INITIALIZED;
-  DBUG_PRINT("info", ("Signalling back to the stopper COND_state"));
-  mysql_cond_signal(&COND_state);
+  DBUG_PRINT("info", ("Broadcasting COND_state back to the stoppers"));
+  mysql_cond_broadcast(&COND_state);
   UNLOCK_DATA();
 
   DBUG_RETURN(res);

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2010-03-31 14:05:33 +0000
+++ b/sql/handler.cc	2010-04-20 08:51:50 +0000
@@ -57,7 +57,8 @@ static handlerton *installed_htons[128];
 
 #define BITMAP_STACKBUF_SIZE (128/8)
 
-KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NullS,0} };
+KEY_CREATE_INFO default_key_create_info=
+  { HA_KEY_ALG_UNDEF, 0, {NullS, 0}, {NullS, 0} };
 
 /* number of entries in handlertons[] */
 ulong total_ha= 0;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-04-07 12:02:19 +0000
+++ b/sql/sql_base.cc	2010-04-21 07:35:37 +0000
@@ -752,6 +752,7 @@ TABLE_SHARE *get_cached_table_share(cons
 }  
 
 
+#ifdef DISABLED_UNTIL_GRL_IS_MADE_PART_OF_MDL
 /**
    @brief Mark table share as having one more user (increase its reference
           count).
@@ -769,6 +770,7 @@ static void reference_table_share(TABLE_
                      (ulong) share, share->ref_count));
   DBUG_VOID_RETURN;
 }
+#endif
 
 
 /*

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-04-07 12:02:19 +0000
+++ b/sql/sql_parse.cc	2010-04-21 07:35:37 +0000
@@ -92,6 +92,7 @@
 #include "transaction.h"
 #include "sql_audit.h"
 #include "sql_prepare.h"
+#include "debug_sync.h"
 #include "probes_mysql.h"
 #include "set_var.h"
 
@@ -2178,6 +2179,11 @@ mysql_execute_command(THD *thd)
     if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
       goto error;
 
+#ifndef DBUG_OFF
+  if (lex->sql_command != SQLCOM_SET_OPTION)
+    DEBUG_SYNC(thd,"before_execute_sql_command");
+#endif
+
   switch (lex->sql_command) {
 
   case SQLCOM_SHOW_EVENTS:

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-04-20 09:41:41 +0000
+++ b/sql/sql_show.cc	2010-04-21 07:35:37 +0000
@@ -1,4 +1,4 @@
-/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+/* Copyright 2000, 2010 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 
 /* Function with list databases, tables or fields */
@@ -658,7 +658,9 @@ mysqld_show_create(THD *thd, TABLE_LIST
   {
     Show_create_error_handler view_error_suppressor(thd, table_list);
     thd->push_internal_handler(&view_error_suppressor);
-    bool error= open_normal_and_derived_tables(thd, table_list, 0);
+    bool error=
+      open_normal_and_derived_tables(thd, table_list,
+                                     MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL);
     thd->pop_internal_handler();
     if (error && (thd->killed || thd->is_error()))
       DBUG_RETURN(TRUE);
@@ -832,7 +834,8 @@ mysqld_list_fields(THD *thd, TABLE_LIST
   DBUG_ENTER("mysqld_list_fields");
   DBUG_PRINT("enter",("table: %s",table_list->table_name));
 
-  if (open_normal_and_derived_tables(thd, table_list, 0))
+  if (open_normal_and_derived_tables(thd, table_list,
+                                     MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL))
     DBUG_VOID_RETURN;
   table= table_list->table;
 

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-04-20 11:58:28 +0000
+++ b/sql/sql_table.cc	2010-04-21 07:35:37 +0000
@@ -5017,11 +5017,17 @@ send_result_message:
       {
         /* Clear the ticket released in close_thread_tables(). */
         table->mdl_request.ticket= NULL;
-        if ((table->table= open_ltable(thd, table, lock_type, 0)) &&
-            ((result_code= table->table->file->ha_analyze(thd, check_opt)) > 0))
-          result_code= 0; // analyze went ok
-        if (result_code)  // analyze failed
-          table->table->file->print_error(result_code, MYF(0));
+        DEBUG_SYNC(thd, "ha_admin_open_ltable");
+        if (table->table= open_ltable(thd, table, lock_type, 0))
+        {
+          result_code= table->table->file->ha_analyze(thd, check_opt);
+          if (result_code == HA_ADMIN_ALREADY_DONE)
+            result_code= HA_ADMIN_OK;
+          else if (result_code)  // analyze failed
+            table->table->file->print_error(result_code, MYF(0));
+        }
+        else
+          result_code= -1; // open failed
       }
       /* Start a new row for the final status row */
       protocol->prepare_for_resend();

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2010-04-07 12:02:19 +0000
+++ b/sql/sql_update.cc	2010-04-21 07:35:37 +0000
@@ -222,7 +222,6 @@ int mysql_update(THD *thd,
   ulonglong     id;
   List<Item> all_fields;
   THD::killed_state killed_status= THD::NOT_KILLED;
-  MDL_ticket *start_of_statement_svp= thd->mdl_context.mdl_savepoint();
   DBUG_ENTER("mysql_update");
 
   if (open_tables(thd, &table_list, &table_count, 0))
@@ -972,7 +971,6 @@ int mysql_multi_update_prepare(THD *thd)
   uint  table_count= lex->table_count;
   const bool using_lock_tables= thd->locked_tables_mode != LTM_NONE;
   bool original_multiupdate= (thd->lex->sql_command == SQLCOM_UPDATE_MULTI);
-  MDL_ticket *start_of_statement_svp= thd->mdl_context.mdl_savepoint();
   DBUG_ENTER("mysql_multi_update_prepare");
 
   /* following need for prepared statements, to run next time multi-update */

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-04-19 15:12:28 +0000
+++ b/sql/sys_vars.cc	2010-04-21 07:35:37 +0000
@@ -2819,7 +2819,7 @@ static Sys_var_charptr Sys_slave_load_tm
 static bool fix_slave_net_timeout(sys_var *self, THD *thd, enum_var_type type)
 {
   mysql_mutex_lock(&LOCK_active_mi);
-  DBUG_PRINT("info", ("slave_net_timeout=%lu mi->heartbeat_period=%.3f",
+  DBUG_PRINT("info", ("slave_net_timeout=%u mi->heartbeat_period=%.3f",
                      slave_net_timeout,
                      (active_mi? active_mi->heartbeat_period : 0.0)));
   if (active_mi && slave_net_timeout < active_mi->heartbeat_period)

=== modified file 'storage/myisam/ha_myisam.h'
--- a/storage/myisam/ha_myisam.h	2010-03-31 14:05:33 +0000
+++ b/storage/myisam/ha_myisam.h	2010-04-20 08:51:50 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2006 MySQL AB
+/* Copyright (C) 2000, 2010 Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11,7 +11,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 
 #ifdef USE_PRAGMA_INTERFACE
@@ -129,7 +129,7 @@ class ha_myisam: public handler
   int repair(THD* thd, HA_CHECK_OPT* check_opt);
   bool check_and_repair(THD *thd);
   bool is_crashed() const;
-  bool auto_repair() const { return myisam_recover_options != 0; }
+  bool auto_repair() const { return myisam_recover_options != HA_RECOVER_OFF; }
   int optimize(THD* thd, HA_CHECK_OPT* check_opt);
   int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt);
   int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2010-04-20 09:41:41 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2010-04-21 06:31:36 +0000
@@ -11,7 +11,8 @@
 
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
 
 /**
   @file storage/perfschema/pfs_engine_table.cc
@@ -471,7 +472,22 @@ PFS_unknown_acl pfs_unknown_acl;
 ACL_internal_access_result
 PFS_unknown_acl::check(ulong want_access, ulong *save_priv) const
 {
-  return ACL_INTERNAL_ACCESS_DENIED;
+  const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL
+    | CREATE_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL
+    | CREATE_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL;
+
+  if (unlikely(want_access & always_forbidden))
+    return ACL_INTERNAL_ACCESS_DENIED;
+
+  /*
+    There is no point in hidding (by enforcing ACCESS_DENIED for SELECT_ACL
+    on performance_schema.*) tables that do not exist anyway.
+    When SELECT_ACL is granted on performance_schema.* or *.*,
+    SELECT * from performance_schema.wrong_table
+    will fail with a more understandable ER_NO_SUCH_TABLE error,
+    instead of ER_TABLEACCESS_DENIED_ERROR.
+  */
+  return ACL_INTERNAL_ACCESS_CHECK_GRANT;
 }
 
 /**


Attachment: [text/bzr-bundle] bzr/horst.hunger@sun.com-20100421091649-fz231hvlx4jxe3pr.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (horst.hunger:3144) Horst.Hunger21 Apr