List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:June 1 2010 11:10am
Subject:bzr commit into mysql-trunk-runtime branch (kostja:3026)
View as plain text  
#At file:///opt/local/work/trunk-runtime-stage/ based on revid:dlenev@stripped

 3026 Konstantin Osipov	2010-06-01 [merge]
      Merge trunk-runtime -> trunk-runtime-stage.

    modified:
      include/thr_lock.h
      mysql-test/include/check_concurrent_insert.inc
      mysql-test/include/check_no_concurrent_insert.inc
      mysql-test/include/check_no_row_lock.inc
      mysql-test/r/archive.result
      mysql-test/r/innodb_mysql_lock2.result
      mysql-test/r/lock_sync.result
      mysql-test/r/mdl_sync.result
      mysql-test/r/rename.result
      mysql-test/r/view.result
      mysql-test/suite/funcs_1/r/innodb_views.result
      mysql-test/suite/funcs_1/r/memory_views.result
      mysql-test/suite/funcs_1/r/myisam_views.result
      mysql-test/suite/funcs_1/r/ndb_views.result
      mysql-test/suite/funcs_1/views/views_master.inc
      mysql-test/t/archive.test
      mysql-test/t/innodb_mysql_lock2.test
      mysql-test/t/lock_sync.test
      mysql-test/t/mdl_sync.test
      mysql-test/t/rename.test
      mysql-test/t/view.test
      mysys/CMakeLists.txt
      mysys/thr_lock.c
      sql/ha_ndbcluster.cc
      sql/log.cc
      sql/log.h
      sql/sql_base.cc
      sql/sql_base.h
      sql/sql_class.h
      sql/sql_insert.cc
      sql/sql_table.cc
      sql/sql_test.cc
      sql/sql_truncate.cc
      sql/sql_truncate.h
      sql/table.cc
      sql/table.h
=== modified file 'include/thr_lock.h'
--- a/include/thr_lock.h	2010-02-15 12:11:20 +0000
+++ b/include/thr_lock.h	2010-06-01 10:13:56 +0000
@@ -54,12 +54,6 @@ enum thr_lock_type { TL_IGNORE=-1,
 		      */
 		     TL_WRITE_ALLOW_WRITE,
 		     /*
-			Write lock, but allow other threads to read.
-			Used by ALTER TABLE in MySQL to allow readers
-			to use the table until ALTER TABLE is finished.
-		     */
-		     TL_WRITE_ALLOW_READ,
-		     /*
 		       WRITE lock used by concurrent insert. Will allow
 		       READ, if one could use concurrent insert on table.
 		     */

=== modified file 'mysql-test/include/check_concurrent_insert.inc'
--- a/mysql-test/include/check_concurrent_insert.inc	2010-05-21 12:41:24 +0000
+++ b/mysql-test/include/check_concurrent_insert.inc	2010-05-30 09:27:44 +0000
@@ -10,9 +10,9 @@
 #   $con_aux2      Name of the second auxiliary connection to be used by this
 #                  script.
 #   $statement     Statement to be checked.
-#   $restore_table Table which might be modified affected by statement to be
-#                  checked and thus needs backing up before its execution
-#                  and restoring after it (can be empty).
+#   $restore_table Table which might be modified by statement to be checked
+#                  and thus needs backing up before its execution and
+#                  restoring after it (can be empty).
 #
 # EXAMPLE
 #    lock_sync.test
@@ -25,7 +25,7 @@ set debug_sync= "RESET";
 
 if (`SELECT '$restore_table' <> ''`)
 {
---eval create table t_backup select * from $restore_table;
+--eval create temporary table t_backup select * from $restore_table;
 }
 
 connection $con_aux1;
@@ -34,19 +34,19 @@ set debug_sync='after_lock_tables_takes_
 
 connection $con_aux2;
 set debug_sync='now WAIT_FOR parked';
---send_eval insert into $table values (0);
+--send_eval insert into $table (i) values (0);
 
 --enable_result_log
 --enable_query_log
 connection default;
 # Wait until concurrent insert is successfully executed while
 # statement being checked has its tables locked.
-# We use wait_condition.inc instead of simply executing
+# We use wait_condition.inc instead of simply reaping 
 # concurrent insert here in order to avoid deadlocks if test
-# fails and timing out instead.
+# fails and to time out gracefully instead.
 let $wait_condition=
   select count(*) = 0 from information_schema.processlist
-  where info = "insert into $table values (0)";
+  where info = "insert into $table (i) values (0)";
 --source include/wait_condition.inc
 
 --disable_result_log
@@ -86,7 +86,7 @@ if (`SELECT '$restore_table' <> ''`)
 {
 --eval truncate table $restore_table;
 --eval insert into $restore_table select * from t_backup;
-drop table t_backup;
+drop temporary table t_backup;
 }
 
 # Clean-up. Reset DEBUG_SYNC facility after use.

=== modified file 'mysql-test/include/check_no_concurrent_insert.inc'
--- a/mysql-test/include/check_no_concurrent_insert.inc	2010-05-21 12:41:24 +0000
+++ b/mysql-test/include/check_no_concurrent_insert.inc	2010-05-30 09:27:44 +0000
@@ -10,9 +10,9 @@
 #   $con_aux2      Name of the second auxiliary connection to be used by this
 #                  script.
 #   $statement     Statement to be checked.
-#   $restore_table Table which might be modified affected by statement to be
-#                  checked and thus needs backing up before its execution
-#                  and restoring after it (can be empty).
+#   $restore_table Table which might be modified by statement to be checked
+#                  and thus needs backing up before its execution and
+#                  restoring after it (can be empty).
 #
 # EXAMPLE
 #    lock_sync.test
@@ -25,7 +25,7 @@ set debug_sync= "RESET";
 
 if (`SELECT '$restore_table' <> ''`)
 {
---eval create table t_backup select * from $restore_table;
+--eval create temporary table t_backup select * from $restore_table;
 }
 
 connection $con_aux1;
@@ -34,7 +34,7 @@ set debug_sync='after_lock_tables_takes_
 
 connection $con_aux2;
 set debug_sync='now WAIT_FOR parked';
---send_eval insert into $table values (0);
+--send_eval insert into $table (i) values (0);
 
 --enable_result_log
 --enable_query_log
@@ -43,7 +43,7 @@ connection default;
 # of our statement.
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Table lock" and info = "insert into $table values (0)";
+  where state = "Table lock" and info = "insert into $table (i) values (0)";
 --source include/wait_condition.inc
 
 --disable_result_log
@@ -71,7 +71,7 @@ if (`SELECT '$restore_table' <> ''`)
 {
 --eval truncate table $restore_table;
 --eval insert into $restore_table select * from t_backup;
-drop table t_backup;
+drop temporary table t_backup;
 }
 
 # Clean-up. Reset DEBUG_SYNC facility after use.

=== modified file 'mysql-test/include/check_no_row_lock.inc'
--- a/mysql-test/include/check_no_row_lock.inc	2010-04-28 10:04:11 +0000
+++ b/mysql-test/include/check_no_row_lock.inc	2010-05-30 09:27:44 +0000
@@ -29,9 +29,9 @@ connection default;
 # Wait until statement is successfully executed while
 # all rows in table are X-locked. This means that it
 # does not acquire any row locks.
-# We use wait_condition.inc instead of simply executing
+# We use wait_condition.inc instead of simply reaping 
 # statement here in order to avoid deadlocks if test
-# fails and timing out instead.
+# fails and to time out gracefully instead.
 let $wait_condition=
   select count(*) = 0 from information_schema.processlist
   where info = "$statement";

=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result	2010-04-28 12:47:49 +0000
+++ b/mysql-test/r/archive.result	2010-05-27 20:40:54 +0000
@@ -12748,3 +12748,11 @@ SELECT * FROM t1;
 ERROR HY000: Can't find file: 't1' (errno: 2)
 DROP TABLE t1;
 ERROR 42S02: Unknown table 't1'
+#
+# Ensure that TRUNCATE fails for non-empty archive tables.
+#
+CREATE TABLE t1 (a INT) ENGINE=ARCHIVE;
+INSERT INTO t1 VALUES (1);
+TRUNCATE TABLE t1;
+ERROR HY000: Table storage engine for 't1' doesn't have this option
+DROP TABLE t1;

=== modified file 'mysql-test/r/innodb_mysql_lock2.result'
--- a/mysql-test/r/innodb_mysql_lock2.result	2010-05-26 12:18:08 +0000
+++ b/mysql-test/r/innodb_mysql_lock2.result	2010-05-30 09:27:44 +0000
@@ -178,8 +178,7 @@ end|
 # 1.1 Simple SELECT statement.
 #
 # No locks are necessary as this statement won't be written
-# to the binary log and thanks to how MyISAM works SELECT
-# will see version of the table prior to concurrent insert.
+# to the binary log and InnoDB supports snapshots.
 Success: 'select * from t1' doesn't take row locks on 't1'.
 #
 # 1.2 Multi-UPDATE statement.
@@ -484,7 +483,7 @@ Success: 'insert into t2 values (f13((se
 # row locks on the data it reads.
 Success: 'call p2(@a)' doesn't take row locks on 't1'.
 #
-# 5.2 Function that modifes data and uses CALL, 
+# 5.2 Function that modifies data and uses CALL, 
 #     which reads a table through SELECT.
 #
 # Since a call to such function is written to the binary

=== modified file 'mysql-test/r/lock_sync.result'
--- a/mysql-test/r/lock_sync.result	2010-04-28 13:43:25 +0000
+++ b/mysql-test/r/lock_sync.result	2010-05-30 09:27:44 +0000
@@ -511,7 +511,7 @@ Success: 'insert into t2 values (f13((se
 # strong locks on the data it reads.
 Success: 'call p2(@a)' allows concurrent inserts into 't1'.
 #
-# 5.2 Function that modifes data and uses CALL, 
+# 5.2 Function that modifies data and uses CALL, 
 #     which reads a table through SELECT.
 #
 # Since a call to such function is written to the binary

=== modified file 'mysql-test/r/mdl_sync.result'
--- a/mysql-test/r/mdl_sync.result	2010-05-26 13:15:59 +0000
+++ b/mysql-test/r/mdl_sync.result	2010-06-01 11:10:34 +0000
@@ -330,9 +330,9 @@ select column_name from information_sche
 table_schema='test' and table_name='t1';
 column_name
 c1
-select count(*) from t1;
-count(*)
-4
+# Disable result log to make test robust against
+# effects of concurrent insert.
+select * from t1;
 insert into t1 values (1);
 # Check that SNW lock is not compatible with SW lock.
 # Again we use ALTER TABLE which fails after opening

=== modified file 'mysql-test/r/rename.result'
--- a/mysql-test/r/rename.result	2006-11-11 11:59:14 +0000
+++ b/mysql-test/r/rename.result	2010-05-28 05:25:11 +0000
@@ -55,14 +55,15 @@ t2
 t4
 drop table t2, t4;
 End of 4.1 tests
+#
+# Bug#14959: "ALTER TABLE isn't able to rename a view"
+# Bug#53976: "ALTER TABLE RENAME is allowed on views
+#             (not documented, broken)"
+#
 create table t1(f1 int);
 create view v1 as select * from t1;
 alter table v1 rename to v2;
-alter table v1 rename to v2;
-ERROR 42S02: Table 'test.v1' doesn't exist
-rename table v2 to v1;
-rename table v2 to v1;
-ERROR 42S01: Table 'v1' already exists
+ERROR HY000: 'test.v1' is not BASE TABLE
 drop view v1;
 drop table t1;
 End of 5.0 tests

=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result	2010-04-11 06:52:42 +0000
+++ b/mysql-test/r/view.result	2010-05-28 05:25:11 +0000
@@ -3954,6 +3954,7 @@ drop procedure p;
 CREATE TABLE t1 (a INT);
 CREATE VIEW v1 AS SELECT a FROM t1;
 ALTER TABLE v1;
+ERROR HY000: 'test.v1' is not BASE TABLE
 DROP VIEW v1;
 DROP TABLE t1;
 #

=== modified file 'mysql-test/suite/funcs_1/r/innodb_views.result'
--- a/mysql-test/suite/funcs_1/r/innodb_views.result	2009-12-22 20:55:56 +0000
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result	2010-05-30 07:48:22 +0000
@@ -3521,6 +3521,7 @@ RENAME TABLE v1 TO v2;
 RENAME VIEW  v2 TO v1;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VIEW  v2 TO v1' at line 1
 ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
 ALTER VIEW  v1 RENAME AS v2;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RENAME AS v2' at line 1
 DROP TABLE IF EXISTS t1, t2 ;

=== modified file 'mysql-test/suite/funcs_1/r/memory_views.result'
--- a/mysql-test/suite/funcs_1/r/memory_views.result	2009-12-22 20:55:56 +0000
+++ b/mysql-test/suite/funcs_1/r/memory_views.result	2010-05-30 07:48:22 +0000
@@ -3522,6 +3522,7 @@ RENAME TABLE v1 TO v2;
 RENAME VIEW  v2 TO v1;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VIEW  v2 TO v1' at line 1
 ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
 ALTER VIEW  v1 RENAME AS v2;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RENAME AS v2' at line 1
 DROP TABLE IF EXISTS t1, t2 ;

=== modified file 'mysql-test/suite/funcs_1/r/myisam_views.result'
--- a/mysql-test/suite/funcs_1/r/myisam_views.result	2009-12-22 20:55:56 +0000
+++ b/mysql-test/suite/funcs_1/r/myisam_views.result	2010-05-30 07:48:22 +0000
@@ -4024,6 +4024,7 @@ RENAME TABLE v1 TO v2;
 RENAME VIEW  v2 TO v1;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VIEW  v2 TO v1' at line 1
 ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
 ALTER VIEW  v1 RENAME AS v2;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RENAME AS v2' at line 1
 DROP TABLE IF EXISTS t1, t2 ;

=== modified file 'mysql-test/suite/funcs_1/r/ndb_views.result'
--- a/mysql-test/suite/funcs_1/r/ndb_views.result	2009-12-22 20:55:56 +0000
+++ b/mysql-test/suite/funcs_1/r/ndb_views.result	2010-05-30 07:48:22 +0000
@@ -3521,6 +3521,7 @@ RENAME TABLE v1 TO v2;
 RENAME VIEW  v2 TO v1;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VIEW  v2 TO v1' at line 1
 ALTER TABLE v2 RENAME AS v1;
+ERROR HY000: 'test.v2' is not BASE TABLE
 ALTER VIEW  v1 RENAME AS v2;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RENAME AS v2' at line 1
 DROP TABLE IF EXISTS t1, t2 ;

=== modified file 'mysql-test/suite/funcs_1/views/views_master.inc'
--- a/mysql-test/suite/funcs_1/views/views_master.inc	2008-06-18 17:23:55 +0000
+++ b/mysql-test/suite/funcs_1/views/views_master.inc	2010-05-30 07:48:22 +0000
@@ -298,7 +298,7 @@ RENAME TABLE v1 TO v2;
 # RENAME VIEW is not available even when we try it via rename table.
 --error ER_PARSE_ERROR
 RENAME VIEW  v2 TO v1;
-#--error ER_WRONG_OBJECT
+--error ER_WRONG_OBJECT
 ALTER TABLE v2 RENAME AS v1;
 --error ER_PARSE_ERROR
 ALTER VIEW  v1 RENAME AS v2;

=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test	2010-04-28 12:47:49 +0000
+++ b/mysql-test/t/archive.test	2010-05-27 20:40:54 +0000
@@ -1669,3 +1669,13 @@ FLUSH TABLE t1;
 SELECT * FROM t1;
 --error ER_BAD_TABLE_ERROR
 DROP TABLE t1;
+
+--echo #
+--echo # Ensure that TRUNCATE fails for non-empty archive tables.
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=ARCHIVE;
+INSERT INTO t1 VALUES (1);
+--error ER_ILLEGAL_HA
+TRUNCATE TABLE t1;
+DROP TABLE t1;

=== modified file 'mysql-test/t/innodb_mysql_lock2.test'
--- a/mysql-test/t/innodb_mysql_lock2.test	2010-05-26 12:18:08 +0000
+++ b/mysql-test/t/innodb_mysql_lock2.test	2010-05-30 09:27:44 +0000
@@ -204,8 +204,7 @@ let $table= t1;
 --echo # 1.1 Simple SELECT statement.
 --echo #
 --echo # No locks are necessary as this statement won't be written
---echo # to the binary log and thanks to how MyISAM works SELECT
---echo # will see version of the table prior to concurrent insert.
+--echo # to the binary log and InnoDB supports snapshots.
 let $statement= select * from t1;
 --source include/check_no_row_lock.inc
 
@@ -659,7 +658,7 @@ let $statement= call p2(@a);
 --source include/check_no_row_lock.inc
 
 --echo #
---echo # 5.2 Function that modifes data and uses CALL, 
+--echo # 5.2 Function that modifies data and uses CALL, 
 --echo #     which reads a table through SELECT.
 --echo #
 --echo # Since a call to such function is written to the binary

=== modified file 'mysql-test/t/lock_sync.test'
--- a/mysql-test/t/lock_sync.test	2010-05-05 07:25:04 +0000
+++ b/mysql-test/t/lock_sync.test	2010-05-30 09:27:44 +0000
@@ -716,7 +716,7 @@ let $restore_table= ;
 --source include/check_concurrent_insert.inc
 
 --echo #
---echo # 5.2 Function that modifes data and uses CALL, 
+--echo # 5.2 Function that modifies data and uses CALL, 
 --echo #     which reads a table through SELECT.
 --echo #
 --echo # Since a call to such function is written to the binary

=== modified file 'mysql-test/t/mdl_sync.test'
--- a/mysql-test/t/mdl_sync.test	2010-05-26 13:15:59 +0000
+++ b/mysql-test/t/mdl_sync.test	2010-06-01 11:10:34 +0000
@@ -462,7 +462,11 @@ handler t1 open;
 handler t1 close;
 select column_name from information_schema.columns where
   table_schema='test' and table_name='t1';
-select count(*) from t1;
+--echo # Disable result log to make test robust against
+--echo # effects of concurrent insert.
+--disable_result_log
+select * from t1;
+--enable_result_log
 insert into t1 values (1);
 --echo # Check that SNW lock is not compatible with SW lock.
 --echo # Again we use ALTER TABLE which fails after opening

=== modified file 'mysql-test/t/rename.test'
--- a/mysql-test/t/rename.test	2009-02-11 09:27:52 +0000
+++ b/mysql-test/t/rename.test	2010-05-28 05:25:11 +0000
@@ -79,17 +79,15 @@ connection default;
 --echo End of 4.1 tests
 
 
-#
-# Bug#14959: ALTER TABLE isn't able to rename a view
-#
+--echo #
+--echo # Bug#14959: "ALTER TABLE isn't able to rename a view"
+--echo # Bug#53976: "ALTER TABLE RENAME is allowed on views
+--echo #             (not documented, broken)"
+--echo #
 create table t1(f1 int);
 create view v1 as select * from t1;
+--error ER_WRONG_OBJECT
 alter table v1 rename to v2;
---error ER_NO_SUCH_TABLE
-alter table v1 rename to v2;
-rename table v2 to v1;
---error ER_TABLE_EXISTS_ERROR
-rename table v2 to v1;
 drop view v1;
 drop table t1;
 

=== modified file 'mysql-test/t/view.test'
--- a/mysql-test/t/view.test	2010-02-24 13:52:27 +0000
+++ b/mysql-test/t/view.test	2010-05-28 05:25:11 +0000
@@ -3902,6 +3902,7 @@ drop procedure p;
 --echo #
 CREATE TABLE t1 (a INT);
 CREATE VIEW v1 AS SELECT a FROM t1;
+--error ER_WRONG_OBJECT
 ALTER TABLE v1;
 DROP VIEW v1;
 DROP TABLE t1;

=== modified file 'mysys/CMakeLists.txt'
--- a/mysys/CMakeLists.txt	2010-02-22 19:55:27 +0000
+++ b/mysys/CMakeLists.txt	2010-06-01 10:13:56 +0000
@@ -66,3 +66,7 @@ ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SO
 TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY} 
  ${LIBNSL} ${LIBM} ${LIBRT})
 DTRACE_INSTRUMENT(mysys)
+
+ADD_EXECUTABLE(thr_lock thr_lock.c)
+TARGET_LINK_LIBRARIES(thr_lock mysys)
+SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")

=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c	2010-02-15 12:11:20 +0000
+++ b/mysys/thr_lock.c	2010-06-01 10:13:56 +0000
@@ -29,7 +29,6 @@ TL_READ_WITH_SHARED_LOCKS
 TL_READ_HIGH_PRIORITY	# High priority read
 TL_READ_NO_INSERT	# Read without concurrent inserts
 TL_WRITE_ALLOW_WRITE	# Write lock that allows other writers
-TL_WRITE_ALLOW_READ	# Write lock, but allow reading
 TL_WRITE_CONCURRENT_INSERT
 			# Insert that can be mixed when selects
 TL_WRITE_DELAYED	# Used by delayed insert
@@ -41,7 +40,7 @@ TL_WRITE_ONLY		# High priority write
 
 Locks are prioritized according to:
 
-WRITE_ALLOW_WRITE, WRITE_ALLOW_READ, WRITE_CONCURRENT_INSERT, WRITE_DELAYED,
+WRITE_ALLOW_WRITE, WRITE_CONCURRENT_INSERT, WRITE_DELAYED,
 WRITE_LOW_PRIORITY, READ, WRITE, READ_HIGH_PRIORITY and WRITE_ONLY
 
 Locks in the same privilege level are scheduled in first-in-first-out order.
@@ -64,9 +63,8 @@ get_status:
 	In MyISAM this stores the number of rows and size of the datafile
 	for concurrent reads.
 
-The lock algorithm allows one to have one TL_WRITE_ALLOW_READ,
-TL_WRITE_CONCURRENT_INSERT or one TL_WRITE_DELAYED lock at the same time as
-multiple read locks.
+The lock algorithm allows one to have one TL_WRITE_CONCURRENT_INSERT or
+one TL_WRITE_DELAYED lock at the same time as multiple read locks.
 
 */
 
@@ -238,7 +236,6 @@ static void check_locks(THR_LOCK *lock, 
 	      (((lock->write_wait.data->type == TL_WRITE_CONCURRENT_INSERT ||
 		 lock->write_wait.data->type == TL_WRITE_ALLOW_WRITE) &&
 		!lock->read_no_write_count) ||
-	       lock->write_wait.data->type == TL_WRITE_ALLOW_READ ||
 	       (lock->write_wait.data->type == TL_WRITE_DELAYED &&
 		!lock->read.data)))
 	  {
@@ -543,14 +540,14 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_O
            Request
           /-------
          H|++++  WRITE_ALLOW_WRITE
-         e|++++  WRITE_ALLOW_READ
-         l|+++-  WRITE_CONCURRENT_INSERT
-         d|++++  WRITE_DELAYED
-           ||||
+         e|+++-  WRITE_CONCURRENT_INSERT
+         l|++++  WRITE_DELAYED
+         d ||||
            |||\= READ_NO_INSERT
            ||\ = READ_HIGH_PRIORITY
            |\  = READ_WITH_SHARED_LOCKS
            \   = READ
+          
 
         + = Request can be satisified.
         - = Request cannot be satisified.
@@ -620,14 +617,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_O
         result= THR_LOCK_ABORTED;               /* Can't wait for this one */
 	goto end;
       }
-      /*
-	if there is a TL_WRITE_ALLOW_READ lock, we have to wait for a lock
-	(TL_WRITE_ALLOW_READ is used for ALTER TABLE in MySQL)
-      */
-      if ((!lock->write.data ||
-	   lock->write.data->type != TL_WRITE_ALLOW_READ) &&
-	  !have_specific_lock(lock->write_wait.data,TL_WRITE_ALLOW_READ) &&
-	  (lock->write.data || lock->read.data))
+      if (lock->write.data || lock->read.data)
       {
 	/* Add delayed write lock to write_wait queue, and return at once */
 	(*lock->write_wait.last)=data;
@@ -680,8 +670,6 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_O
             it is OK to grant new lock without additional checks in such
             situation.
         **) The exceptions are situations when:
-            - old lock type is TL_WRITE_ALLOW_READ and new lock type is
-              TL_WRITE_ALLOW_WRITE
             - when old lock type is TL_WRITE_DELAYED
             But these should never happen within MySQL.
         Therefore it is OK to allow acquiring write lock on the table if
@@ -695,9 +683,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_O
                   ((lock_type <= lock->write.data->type ||
                     (lock_type == TL_WRITE &&
                      lock->write.data->type == TL_WRITE_LOW_PRIORITY)) &&
-                   ! ((lock_type < TL_WRITE_ALLOW_READ &&
-                       lock->write.data->type == TL_WRITE_ALLOW_READ) ||
-                     lock->write.data->type == TL_WRITE_DELAYED)));
+                   lock->write.data->type != TL_WRITE_DELAYED));
 
       if ((lock_type == TL_WRITE_ALLOW_WRITE &&
            ! lock->write_wait.data &&
@@ -1265,10 +1251,7 @@ my_bool thr_abort_locks_for_thread(THR_L
     occurs also other waiters, both readers and writers can be allowed to
     start.
     The previous lock is often TL_WRITE_ONLY but can also be
-    TL_WRITE and TL_WRITE_ALLOW_READ. The normal downgrade variants are
-    TL_WRITE_ONLY => TL_WRITE_ALLOW_READ After a short exclusive lock
-    TL_WRITE_ALLOW_READ => TL_WRITE_ALLOW_WRITE After discovering that the
-    operation didn't need such a high lock.
+    TL_WRITE. The normal downgrade variants are:
     TL_WRITE_ONLY => TL_WRITE after a short exclusive lock while holding a
     write table lock
     TL_WRITE_ONLY => TL_WRITE_ALLOW_WRITE After a short exclusive lock after
@@ -1289,11 +1272,6 @@ void thr_downgrade_write_lock(THR_LOCK_D
 #ifndef DBUG_OFF
   enum thr_lock_type old_lock_type= in_data->type;
 #endif
-#ifdef TO_BE_REMOVED
-  THR_LOCK_DATA *data, *next;
-  bool start_writers= FALSE;
-  bool start_readers= FALSE;
-#endif
   DBUG_ENTER("thr_downgrade_write_only_lock");
 
   mysql_mutex_lock(&lock->mutex);
@@ -1302,165 +1280,6 @@ void thr_downgrade_write_lock(THR_LOCK_D
   in_data->type= new_lock_type;
   check_locks(lock,"after downgrading lock",0);
 
-#if TO_BE_REMOVED
-  switch (old_lock_type)
-  {
-    case TL_WRITE_ONLY:
-    case TL_WRITE:
-    case TL_WRITE_LOW_PRIORITY:
-    /*
-      Previous lock was exclusive we are now ready to start up most waiting
-      threads.
-    */
-      switch (new_lock_type)
-      {
-        case TL_WRITE_ALLOW_READ:
-        /* Still cannot start WRITE operations. Can only start readers.  */
-          start_readers= TRUE;
-          break;
-        case TL_WRITE:
-        case TL_WRITE_LOW_PRIORITY:
-        /*
-           Still cannot start anything, but new requests are no longer
-           aborted.
-        */
-          break;
-        case TL_WRITE_ALLOW_WRITE:
-        /*
-          We can start both writers and readers.
-        */
-          start_writers= TRUE;
-          start_readers= TRUE;
-          break;
-        case TL_WRITE_CONCURRENT_INSERT:
-        case TL_WRITE_DELAYED:
-        /*
-          This routine is not designed for those. Lock will be downgraded
-          but no start of waiters will occur. This is not the optimal but
-          should be a correct behaviour.
-        */
-          break;
-        default:
-          DBUG_ASSERT(0);
-      }
-      break;
-    case TL_WRITE_DELAYED:
-    case TL_WRITE_CONCURRENT_INSERT:
-    /*
-      This routine is not designed for those. Lock will be downgraded
-      but no start of waiters will occur. This is not the optimal but
-      should be a correct behaviour.
-    */
-      break;
-    case TL_WRITE_ALLOW_READ:
-      DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE);
-      /*
-        Previously writers were not allowed to start, now it is ok to
-        start them again. Readers are already allowed so no reason to
-        handle them.
-      */
-      start_writers= TRUE;
-      break;
-    default:
-      DBUG_ASSERT(0);
-      break;
-  }
-  if (start_writers)
-  {
-    /*
-      At this time the only active writer can be ourselves. Thus we need
-      not worry about that there are other concurrent write operations
-      active on the table. Thus we only need to worry about starting
-      waiting operations.
-      We also only come here with TL_WRITE_ALLOW_WRITE as the new
-      lock type, thus we can start other writers also of the same type.
-      If we find a lock at exclusive level >= TL_WRITE_LOW_PRIORITY we
-      don't start any more operations that would be mean those operations
-      will have to wait for things started afterwards.
-    */
-    DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE);
-    for (data=lock->write_wait.data; data ; data= next)
-    {
-      /*
-        All WRITE requests compatible with new lock type are also
-        started
-      */
-      next= data->next;
-      if (start_writers && data->type == new_lock_type)
-      {
-        mysql_cond_t *cond= data->cond;
-        /*
-          It is ok to start this waiter.
-          Move from being first in wait queue to be last in write queue.
-        */
-        if (((*data->prev)= data->next))
-          data->next->prev= data->prev;
-        else
-          lock->write_wait.last= data->prev;
-        data->prev= lock->write.last;
-        lock->write.last= &data->next;
-        data->next= 0;
-        check_locks(lock, "Started write lock after downgrade",0);
-        data->cond= 0;
-        mysql_cond_signal(cond);
-      }
-      else
-      {
-        /*
-          We found an incompatible lock, we won't start any more write
-          requests to avoid letting writers pass other writers in the
-          queue.
-        */
-        start_writers= FALSE;
-        if (data->type >= TL_WRITE_LOW_PRIORITY)
-        {
-          /*
-            We have an exclusive writer in the queue so we won't start
-            readers either.
-          */
-          start_readers= FALSE;
-        }
-      }
-    }
-  }
-  if (start_readers)
-  {
-    DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE ||
-                new_lock_type == TL_WRITE_ALLOW_READ);
-    /*
-      When we come here we know that the write locks are
-      TL_WRITE_ALLOW_WRITE or TL_WRITE_ALLOW_READ. This means that reads
-      are ok
-    */
-    for (data=lock->read_wait.data; data ; data=next)
-    {
-      next= data->next;
-      /*
-        All reads are ok to start now except TL_READ_NO_INSERT when
-        write lock is TL_WRITE_ALLOW_READ.
-      */
-      if (new_lock_type != TL_WRITE_ALLOW_READ ||
-          data->type != TL_READ_NO_INSERT)
-      {
-        mysql_cond_t *cond= data->cond;
-        if (((*data->prev)= data->next))
-          data->next->prev= data->prev;
-        else
-          lock->read_wait.last= data->prev;
-        data->prev= lock->read.last;
-        lock->read.last= &data->next;
-        data->next= 0;
-
-        if (data->type == TL_READ_NO_INSERT)
-          lock->read_no_write_count++;
-        check_locks(lock, "Started read lock after downgrade",0);
-        data->cond= 0;
-        mysql_cond_signal(cond);
-      }
-    }
-  }
-  check_locks(lock,"after starting waiters after downgrading lock",0);
-#endif
   mysql_mutex_unlock(&lock->mutex);
   DBUG_VOID_RETURN;
 }
@@ -1646,15 +1465,14 @@ struct st_test test_8[] = {{1,TL_READ_NO
 struct st_test test_9[] = {{4,TL_READ_HIGH_PRIORITY}};
 struct st_test test_10[] ={{4,TL_WRITE}};
 struct st_test test_11[] = {{0,TL_WRITE_LOW_PRIORITY},{1,TL_WRITE_LOW_PRIORITY},{2,TL_WRITE_LOW_PRIORITY},{3,TL_WRITE_LOW_PRIORITY}}; /* Many writes */
-struct st_test test_12[] = {{0,TL_WRITE_ALLOW_READ},{1,TL_WRITE_ALLOW_READ},{2,TL_WRITE_ALLOW_READ},{3,TL_WRITE_ALLOW_READ}}; /* Many writes */
-struct st_test test_13[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_WRITE_CONCURRENT_INSERT},{2,TL_WRITE_CONCURRENT_INSERT},{3,TL_WRITE_CONCURRENT_INSERT}};
-struct st_test test_14[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_READ}};
-struct st_test test_15[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_READ}};
-struct st_test test_16[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_WRITE_ALLOW_WRITE}};
+struct st_test test_12[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_WRITE_CONCURRENT_INSERT},{2,TL_WRITE_CONCURRENT_INSERT},{3,TL_WRITE_CONCURRENT_INSERT}};
+struct st_test test_13[] = {{0,TL_WRITE_CONCURRENT_INSERT},{1,TL_READ}};
+struct st_test test_14[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_READ}};
+struct st_test test_15[] = {{0,TL_WRITE_ALLOW_WRITE},{1,TL_WRITE_ALLOW_WRITE}};
 
 struct st_test *tests[] = {test_0,test_1,test_2,test_3,test_4,test_5,test_6,
 			   test_7,test_8,test_9,test_10,test_11,test_12,
-			   test_13,test_14,test_15,test_16};
+			   test_13,test_14,test_15};
 int lock_counts[]= {sizeof(test_0)/sizeof(struct st_test),
 		    sizeof(test_1)/sizeof(struct st_test),
 		    sizeof(test_2)/sizeof(struct st_test),
@@ -1670,8 +1488,7 @@ int lock_counts[]= {sizeof(test_0)/sizeo
 		    sizeof(test_12)/sizeof(struct st_test),
 		    sizeof(test_13)/sizeof(struct st_test),
 		    sizeof(test_14)/sizeof(struct st_test),
-		    sizeof(test_15)/sizeof(struct st_test),
-		    sizeof(test_16)/sizeof(struct st_test)
+		    sizeof(test_15)/sizeof(struct st_test)
 };
 
 
@@ -1681,6 +1498,7 @@ static uint thread_count;
 static ulong sum=0;
 
 #define MAX_LOCK_COUNT 8
+#define TEST_TIMEOUT 100000
 
 /* The following functions is for WRITE_CONCURRENT_INSERT */
 
@@ -1727,7 +1545,7 @@ static void *test_thread(void *arg)
       multi_locks[i]= &data[i];
       data[i].type= tests[param][i].lock_type;
     }
-    thr_multi_lock(multi_locks, lock_counts[param], &owner);
+    thr_multi_lock(multi_locks, lock_counts[param], &owner, TEST_TIMEOUT);
     mysql_mutex_lock(&LOCK_thread_count);
     {
       int tmp=rand() & 7;			/* Do something from 0-2 sec */

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2010-05-25 12:35:01 +0000
+++ b/sql/ha_ndbcluster.cc	2010-05-30 07:43:19 +0000
@@ -7411,7 +7411,7 @@ int ndbcluster_find_files(handlerton *ht
       table_list.init_one_table(db, strlen(db), file_name_str,
                                 strlen(file_name_str), file_name_str,
                                 TL_WRITE);
-      table_list.mdl_request.set_tpye(MDL_EXCLUSIVE);
+      table_list.mdl_request.set_type(MDL_EXCLUSIVE);
       (void)mysql_rm_table_part2(thd, &table_list,
                                  FALSE,   /* if_exists */
                                  FALSE,   /* drop_temporary */ 

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-05-05 22:02:08 +0000
+++ b/sql/log.cc	2010-05-27 21:28:24 +0000
@@ -370,8 +370,8 @@ bool LOGGER::is_log_table_enabled(uint l
 
 
 /* Check if a given table is opened log table */
-int check_if_log_table(uint db_len, const char *db, uint table_name_len,
-                       const char *table_name, uint check_if_opened)
+int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
+                       const char *table_name, bool check_if_opened)
 {
   if (db_len == 5 &&
       !(lower_case_table_names ?

=== modified file 'sql/log.h'
--- a/sql/log.h	2010-04-20 09:10:43 +0000
+++ b/sql/log.h	2010-05-27 21:28:24 +0000
@@ -499,8 +499,8 @@ public:
 };
 
 
-int check_if_log_table(uint db_len, const char *db, uint table_name_len,
-                       const char *table_name, uint check_if_opened);
+int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
+                       const char *table_name, bool check_if_opened);
 
 class Log_to_csv_event_handler: public Log_event_handler
 {

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-05-26 13:15:59 +0000
+++ b/sql/sql_base.cc	2010-06-01 11:10:34 +0000
@@ -16,11 +16,11 @@
 
 /* Basic functions needed by many modules */
 
+#include "sql_base.h"                           // setup_table_map
 #include "my_global.h"                          /* NO_EMBEDDED_ACCESS_CHECKS */
 #include "sql_priv.h"
 #include "unireg.h"
 #include "debug_sync.h"
-#include "sql_base.h"                           // setup_table_map
 #include "lock.h"        // broadcast_refresh, mysql_lock_remove,
                          // mysql_unlock_tables,
                          // mysql_lock_have_duplicate
@@ -2545,12 +2545,13 @@ open_table_get_mdl_lock(THD *thd, Open_t
 
 
 bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
-                Open_table_context *ot_ctx, uint flags)
+                Open_table_context *ot_ctx)
 {
   reg1	TABLE *table;
   char	key[MAX_DBKEY_LENGTH];
   uint	key_length;
   char	*alias= table_list->alias;
+  uint flags= ot_ctx->get_flags();
   MDL_ticket *mdl_ticket;
   int error;
   TABLE_SHARE *share;
@@ -2860,26 +2861,15 @@ bool open_table(THD *thd, TABLE_LIST *ta
       if (open_new_frm(thd, share, alias,
                        (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
                                HA_GET_INDEX | HA_TRY_READ_ONLY),
-                       READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD |
-                       (flags & OPEN_VIEW_NO_PARSE), thd->open_options,
+                       READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
+                       thd->open_options,
                        0, table_list, mem_root))
         goto err_unlock;
 
       /* TODO: Don't free this */
       release_table_share(share);
 
-      if (flags & OPEN_VIEW_NO_PARSE)
-      {
-        /*
-          VIEW not really opened, only frm were read.
-          Set 1 as a flag here
-        */
-        table_list->view= (LEX*)1;
-      }
-      else
-      {
-        DBUG_ASSERT(table_list->view);
-      }
+      DBUG_ASSERT(table_list->view);
 
       mysql_mutex_unlock(&LOCK_open);
       DBUG_RETURN(FALSE);
@@ -3412,7 +3402,7 @@ unlink_all_closed_tables(THD *thd, MYSQL
 bool
 Locked_tables_list::reopen_tables(THD *thd)
 {
-  Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+  Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
   size_t reopen_count= 0;
   MYSQL_LOCK *lock;
   MYSQL_LOCK *merged_lock;
@@ -3424,8 +3414,7 @@ Locked_tables_list::reopen_tables(THD *t
       continue;
 
     /* Links into thd->open_tables upon success */
-    if (open_table(thd, table_list, thd->mem_root, &ot_ctx_unused,
-                   MYSQL_OPEN_REOPEN))
+    if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
     {
       unlink_all_closed_tables(thd, 0, reopen_count);
       return TRUE;
@@ -3847,15 +3836,17 @@ end_with_lock_open:
 
 /** Open_table_context */
 
-Open_table_context::Open_table_context(THD *thd, ulong timeout)
-  :m_action(OT_NO_ACTION),
-   m_failed_table(NULL),
+Open_table_context::Open_table_context(THD *thd, uint flags)
+  :m_failed_table(NULL),
    m_start_of_statement_svp(thd->mdl_context.mdl_savepoint()),
+   m_global_mdl_request(NULL),
+   m_timeout(flags & MYSQL_LOCK_IGNORE_TIMEOUT ?
+             LONG_TIMEOUT : thd->variables.lock_wait_timeout),
+   m_flags(flags),
+   m_action(OT_NO_ACTION),
    m_has_locks((thd->in_multi_stmt_transaction_mode() &&
                 thd->mdl_context.has_locks()) ||
-                thd->mdl_context.trans_sentinel()),
-   m_global_mdl_request(NULL),
-   m_timeout(timeout)
+                thd->mdl_context.trans_sentinel())
 {}
 
 
@@ -4360,12 +4351,12 @@ open_and_process_table(THD *thd, LEX *le
     */
     Prelock_error_handler prelock_handler;
     thd->push_internal_handler(& prelock_handler);
-    error= open_table(thd, tables, new_frm_mem, ot_ctx, flags);
+    error= open_table(thd, tables, new_frm_mem, ot_ctx);
     thd->pop_internal_handler();
     safe_to_ignore_table= prelock_handler.safely_trapped_errors();
   }
   else
-    error= open_table(thd, tables, new_frm_mem, ot_ctx, flags);
+    error= open_table(thd, tables, new_frm_mem, ot_ctx);
 
   free_root(new_frm_mem, MYF(MY_KEEP_PREALLOC));
 
@@ -4680,8 +4671,7 @@ bool open_tables(THD *thd, TABLE_LIST **
   TABLE_LIST **table_to_open;
   Sroutine_hash_entry **sroutine_to_open;
   TABLE_LIST *tables;
-  Open_table_context ot_ctx(thd, (flags & MYSQL_LOCK_IGNORE_TIMEOUT) ?
-                            LONG_TIMEOUT : thd->variables.lock_wait_timeout);
+  Open_table_context ot_ctx(thd, flags);
   bool error= FALSE;
   MEM_ROOT new_frm_mem;
   bool has_prelocking_list;
@@ -5252,8 +5242,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST 
                    uint lock_flags)
 {
   TABLE *table;
-  Open_table_context ot_ctx(thd, (lock_flags & MYSQL_LOCK_IGNORE_TIMEOUT) ?
-                            LONG_TIMEOUT : thd->variables.lock_wait_timeout);
+  Open_table_context ot_ctx(thd, lock_flags);
   bool error;
   DBUG_ENTER("open_ltable");
 
@@ -5268,7 +5257,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST 
   /* This function can't properly handle requests for such metadata locks. */
   DBUG_ASSERT(table_list->mdl_request.type < MDL_SHARED_NO_WRITE);
 
-  while ((error= open_table(thd, table_list, thd->mem_root, &ot_ctx, lock_flags)) &&
+  while ((error= open_table(thd, table_list, thd->mem_root, &ot_ctx)) &&
          ot_ctx.can_recover_from_failed_open())
   {
     /*

=== modified file 'sql/sql_base.h'
--- a/sql/sql_base.h	2010-05-13 09:36:49 +0000
+++ b/sql/sql_base.h	2010-06-01 11:10:34 +0000
@@ -89,7 +89,7 @@ TABLE_SHARE *get_cached_table_share(cons
 TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
                    uint lock_flags);
 bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
-                Open_table_context *ot_ctx, uint flags);
+                Open_table_context *ot_ctx);
 bool name_lock_locked_table(THD *thd, TABLE_LIST *tables);
 bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list, bool link_in);
 TABLE *table_cache_insert_placeholder(THD *thd, const char *key,
@@ -322,6 +322,7 @@ inline TABLE_LIST *find_table_in_local_l
                             db_name, table_name);
 }
 
+
 inline bool setup_fields_with_no_wrap(THD *thd, Item **ref_pointer_array,
                                       List<Item> &item,
                                       enum_mark_columns mark_used_columns,
@@ -336,6 +337,89 @@ inline bool setup_fields_with_no_wrap(TH
   return res;
 }
 
+/**
+  An abstract class for a strategy specifying how the prelocking
+  algorithm should extend the prelocking set while processing
+  already existing elements in the set.
+*/
+
+class Prelocking_strategy
+{
+public:
+  virtual ~Prelocking_strategy() { }
+
+  virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
+                              Sroutine_hash_entry *rt, sp_head *sp,
+                              bool *need_prelocking) = 0;
+  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+                            TABLE_LIST *table_list, bool *need_prelocking) = 0;
+  virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
+                           TABLE_LIST *table_list, bool *need_prelocking)= 0;
+};
+
+
+/**
+  A Strategy for prelocking algorithm suitable for DML statements.
+
+  Ensures that all tables used by all statement's SF/SP/triggers and
+  required for foreign key checks are prelocked and SF/SPs used are
+  cached.
+*/
+
+class DML_prelocking_strategy : public Prelocking_strategy
+{
+public:
+  virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
+                              Sroutine_hash_entry *rt, sp_head *sp,
+                              bool *need_prelocking);
+  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+                            TABLE_LIST *table_list, bool *need_prelocking);
+  virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
+                           TABLE_LIST *table_list, bool *need_prelocking);
+};
+
+
+/**
+  A strategy for prelocking algorithm to be used for LOCK TABLES
+  statement.
+*/
+
+class Lock_tables_prelocking_strategy : public DML_prelocking_strategy
+{
+  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+                            TABLE_LIST *table_list, bool *need_prelocking);
+};
+
+
+/**
+  Strategy for prelocking algorithm to be used for ALTER TABLE statements.
+
+  Unlike DML or LOCK TABLES strategy, it doesn't
+  prelock triggers, views or stored routines, since they are not
+  used during ALTER.
+*/
+
+class Alter_table_prelocking_strategy : public Prelocking_strategy
+{
+public:
+
+  Alter_table_prelocking_strategy(Alter_info *alter_info)
+    : m_alter_info(alter_info)
+  {}
+
+  virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
+                              Sroutine_hash_entry *rt, sp_head *sp,
+                              bool *need_prelocking);
+  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
+                            TABLE_LIST *table_list, bool *need_prelocking);
+  virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
+                           TABLE_LIST *table_list, bool *need_prelocking);
+
+private:
+  Alter_info *m_alter_info;
+};
+
+
 inline bool
 open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags)
 {
@@ -355,4 +439,85 @@ inline bool open_and_lock_tables(THD *th
                               &prelocking_strategy);
 }
 
+
+/**
+  A context of open_tables() function, used to recover
+  from a failed open_table() or open_routine() attempt.
+*/
+
+class Open_table_context
+{
+public:
+  enum enum_open_table_action
+  {
+    OT_NO_ACTION= 0,
+    OT_MDL_CONFLICT,
+    OT_WAIT_TDC,
+    OT_DISCOVER,
+    OT_REPAIR
+  };
+  Open_table_context(THD *thd, uint flags);
+
+  bool recover_from_failed_open(THD *thd);
+  bool request_backoff_action(enum_open_table_action action_arg,
+                              TABLE_LIST *table);
+
+  void add_request(MDL_request *request)
+  { m_mdl_requests.push_front(request); }
+
+  bool can_recover_from_failed_open() const
+  { return m_action != OT_NO_ACTION; }
+
+  /**
+    When doing a back-off, we close all tables acquired by this
+    statement.  Return an MDL savepoint taken at the beginning of
+    the statement, so that we can rollback to it before waiting on
+    locks.
+  */
+  MDL_ticket *start_of_statement_svp() const
+  {
+    return m_start_of_statement_svp;
+  }
+
+  MDL_request *get_global_mdl_request(THD *thd);
+
+  inline ulong get_timeout() const
+  {
+    return m_timeout;
+  }
+
+  uint get_flags() const { return m_flags; }
+private:
+  /** List of requests for all locks taken so far. Used for waiting on locks. */
+  MDL_request_list m_mdl_requests;
+  /**
+    For OT_DISCOVER and OT_REPAIR actions, the table list element for
+    the table which definition should be re-discovered or which
+    should be repaired.
+  */
+  TABLE_LIST *m_failed_table;
+  MDL_ticket *m_start_of_statement_svp;
+  /**
+    Request object for global intention exclusive lock which is acquired during
+    opening tables for statements which take upgradable shared metadata locks.
+  */
+  MDL_request *m_global_mdl_request;
+  /**
+    Lock timeout in seconds. Initialized to LONG_TIMEOUT when opening system
+    tables or to the "lock_wait_timeout" system variable for regular tables.
+  */
+  ulong m_timeout;
+  /* open_table() flags. */
+  uint m_flags;
+  /** Back off action. */
+  enum enum_open_table_action m_action;
+  /**
+    Whether we had any locks when this context was created.
+    If we did, they are from the previous statement of a transaction,
+    and we can't safely do back-off (and release them).
+  */
+  bool m_has_locks;
+};
+
+
 #endif /* SQL_BASE_INCLUDED */

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-05-26 13:15:59 +0000
+++ b/sql/sql_class.h	2010-06-01 11:10:34 +0000
@@ -1227,168 +1227,6 @@ private:
 
 
 /**
-  An abstract class for a strategy specifying how the prelocking
-  algorithm should extend the prelocking set while processing
-  already existing elements in the set.
-*/
-
-class Prelocking_strategy
-{
-public:
-  virtual ~Prelocking_strategy() { }
-
-  virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
-                              Sroutine_hash_entry *rt, sp_head *sp,
-                              bool *need_prelocking) = 0;
-  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
-                            TABLE_LIST *table_list, bool *need_prelocking) = 0;
-  virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
-                           TABLE_LIST *table_list, bool *need_prelocking)= 0;
-};
-
-
-/**
-  A Strategy for prelocking algorithm suitable for DML statements.
-
-  Ensures that all tables used by all statement's SF/SP/triggers and
-  required for foreign key checks are prelocked and SF/SPs used are
-  cached.
-*/
-
-class DML_prelocking_strategy : public Prelocking_strategy
-{
-public:
-  virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
-                              Sroutine_hash_entry *rt, sp_head *sp,
-                              bool *need_prelocking);
-  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
-                            TABLE_LIST *table_list, bool *need_prelocking);
-  virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
-                           TABLE_LIST *table_list, bool *need_prelocking);
-};
-
-
-/**
-  A strategy for prelocking algorithm to be used for LOCK TABLES
-  statement.
-*/
-
-class Lock_tables_prelocking_strategy : public DML_prelocking_strategy
-{
-  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
-                            TABLE_LIST *table_list, bool *need_prelocking);
-};
-
-
-/**
-  Strategy for prelocking algorithm to be used for ALTER TABLE statements.
-
-  Unlike DML or LOCK TABLES strategy, it doesn't
-  prelock triggers, views or stored routines, since they are not
-  used during ALTER.
-*/
-
-class Alter_table_prelocking_strategy : public Prelocking_strategy
-{
-public:
-
-  Alter_table_prelocking_strategy(Alter_info *alter_info)
-    : m_alter_info(alter_info)
-  {}
-
-  virtual bool handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
-                              Sroutine_hash_entry *rt, sp_head *sp,
-                              bool *need_prelocking);
-  virtual bool handle_table(THD *thd, Query_tables_list *prelocking_ctx,
-                            TABLE_LIST *table_list, bool *need_prelocking);
-  virtual bool handle_view(THD *thd, Query_tables_list *prelocking_ctx,
-                           TABLE_LIST *table_list, bool *need_prelocking);
-
-private:
-  Alter_info *m_alter_info;
-};
-
-
-/**
-  A context of open_tables() function, used to recover
-  from a failed open_table() or open_routine() attempt.
-
-  Implemented in sql_base.cc.
-*/
-
-class Open_table_context
-{
-public:
-  enum enum_open_table_action
-  {
-    OT_NO_ACTION= 0,
-    OT_MDL_CONFLICT,
-    OT_WAIT_TDC,
-    OT_DISCOVER,
-    OT_REPAIR
-  };
-  Open_table_context(THD *thd, ulong timeout);
-
-  bool recover_from_failed_open(THD *thd);
-  bool request_backoff_action(enum_open_table_action action_arg,
-                              TABLE_LIST *table);
-
-  void add_request(MDL_request *request)
-  { m_mdl_requests.push_front(request); }
-
-  bool can_recover_from_failed_open() const
-  { return m_action != OT_NO_ACTION; }
-
-  /**
-    When doing a back-off, we close all tables acquired by this
-    statement.  Return an MDL savepoint taken at the beginning of
-    the statement, so that we can rollback to it before waiting on
-    locks.
-  */
-  MDL_ticket *start_of_statement_svp() const
-  {
-    return m_start_of_statement_svp;
-  }
-
-  MDL_request *get_global_mdl_request(THD *thd);
-
-  inline ulong get_timeout() const
-  {
-    return m_timeout;
-  }
-
-private:
-  /** List of requests for all locks taken so far. Used for waiting on locks. */
-  MDL_request_list m_mdl_requests;
-  /** Back off action. */
-  enum enum_open_table_action m_action;
-  /**
-    For OT_DISCOVER and OT_REPAIR actions, the table list element for
-    the table which definition should be re-discovered or which
-    should be repaired.
-  */
-  TABLE_LIST *m_failed_table;
-  MDL_ticket *m_start_of_statement_svp;
-  /**
-    Whether we had any locks when this context was created.
-    If we did, they are from the previous statement of a transaction,
-    and we can't safely do back-off (and release them).
-  */
-  bool m_has_locks;
-  /**
-    Request object for global intention exclusive lock which is acquired during
-    opening tables for statements which take upgradable shared metadata locks.
-  */
-  MDL_request *m_global_mdl_request;
-  /**
-    Lock timeout in seconds. Initialized to LONG_TIMEOUT when opening system
-    tables or to the "lock_wait_timeout" system variable for regular tables.
-  */
-  uint m_timeout;
-};
-
-
-/**
   Tables that were locked with LOCK TABLES statement.
 
   Encapsulates a list of TABLE_LIST instances for tables

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2010-05-14 05:28:51 +0000
+++ b/sql/sql_insert.cc	2010-06-01 10:49:35 +0000
@@ -3608,13 +3608,12 @@ static TABLE *create_table_from_items(TH
 
       if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
       {
-        Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+        Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
         /*
           Here we open the destination table, on which we already have
           an exclusive metadata lock.
         */
-        if (open_table(thd, create_table, thd->mem_root,
-                       &ot_ctx_unused, MYSQL_OPEN_REOPEN))
+        if (open_table(thd, create_table, thd->mem_root, &ot_ctx))
         {
           mysql_mutex_lock(&LOCK_open);
           quick_rm_table(create_info->db_type, create_table->db,
@@ -3627,9 +3626,8 @@ static TABLE *create_table_from_items(TH
       }
       else
       {
-        Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
-        if (open_table(thd, create_table, thd->mem_root, &ot_ctx_unused,
-                       MYSQL_OPEN_TEMPORARY_ONLY))
+        Open_table_context ot_ctx(thd, MYSQL_OPEN_TEMPORARY_ONLY);
+        if (open_table(thd, create_table, thd->mem_root, &ot_ctx))
         {
           /*
             This shouldn't happen as creation of temporary table should make

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-05-26 12:18:08 +0000
+++ b/sql/sql_table.cc	2010-06-01 10:49:35 +0000
@@ -4426,10 +4426,10 @@ static int prepare_for_repair(THD *thd, 
   char from[FN_REFLEN],tmp[FN_REFLEN+32];
   const char **ext;
   MY_STAT stat_info;
-  Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+  Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
+                                  MYSQL_OPEN_HAS_MDL_LOCK |
+                                  MYSQL_LOCK_IGNORE_TIMEOUT));
   DBUG_ENTER("prepare_for_repair");
-  uint reopen_for_repair_flags= (MYSQL_OPEN_IGNORE_FLUSH |
-                                 MYSQL_OPEN_HAS_MDL_LOCK);
 
   if (!(check_opt->sql_flags & TT_USEFRM))
     DBUG_RETURN(0);
@@ -4584,8 +4584,7 @@ static int prepare_for_repair(THD *thd, 
     Now we should be able to open the partially repaired table
     to finish the repair in the handler later on.
   */
-  if (open_table(thd, table_list, thd->mem_root,
-                 &ot_ctx_unused, reopen_for_repair_flags))
+  if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
   {
     error= send_check_errmsg(thd, table_list, "repair",
                              "Failed to open partially repaired table");
@@ -5374,7 +5373,7 @@ bool mysql_create_like_table(THD* thd, T
         char buf[2048];
         String query(buf, sizeof(buf), system_charset_info);
         query.length(0);  // Have to zero it since constructor doesn't
-        Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+        Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
 
         /*
           The condition avoids a crash as described in BUG#48506. Other
@@ -5389,8 +5388,7 @@ bool mysql_create_like_table(THD* thd, T
             to work. The table will be closed by close_thread_table() at
             the end of this branch.
           */
-          if (open_table(thd, table, thd->mem_root, &ot_ctx_unused,
-                         MYSQL_OPEN_REOPEN))
+          if (open_table(thd, table, thd->mem_root, &ot_ctx))
             goto err;
 
           int result __attribute__((unused))=
@@ -6454,8 +6452,6 @@ bool mysql_alter_table(THD *thd,char *ne
   char reg_path[FN_REFLEN+1];
   ha_rows copied,deleted;
   handlerton *old_db_type, *new_db_type, *save_old_db_type;
-  legacy_db_type table_type;
-  frm_type_enum frm_type;
   enum_alter_table_change_level need_copy_table= ALTER_TABLE_METADATA_ONLY;
 #ifdef WITH_PARTITION_STORAGE_ENGINE
   uint fast_alter_partition= 0;
@@ -6535,91 +6531,6 @@ bool mysql_alter_table(THD *thd,char *ne
     /* Conditionally writes to binlog. */
     DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
 						   alter_info->tablespace_op));
-  strxnmov(new_name_buff, sizeof (new_name_buff) - 1, mysql_data_home, "/", db, 
-           "/", table_name, reg_ext, NullS);
-  (void) unpack_filename(new_name_buff, new_name_buff);
-  /*
-    If this is just a rename of a view, short cut to the
-    following scenario: 1) lock LOCK_open 2) do a RENAME
-    2) unlock LOCK_open.
-    This is a copy-paste added to make sure
-    ALTER (sic:) TABLE .. RENAME works for views. ALTER VIEW is handled
-    as an independent branch in mysql_execute_command. The need
-    for a copy-paste arose because the main code flow of ALTER TABLE
-    ... RENAME tries to use open_ltable, which does not work for views
-    (open_ltable was never modified to merge table lists of child tables
-    into the main table list, like open_tables does).
-    This code is wrong and will be removed, please do not copy.
-  */
-  frm_type= dd_frm_type(thd, new_name_buff, &table_type);
-  /* Rename a view */
-  /* Sic: there is a race here */
-  if (frm_type == FRMTYPE_VIEW && !(alter_info->flags & ~ALTER_RENAME))
-  {
-    /*
-      The following branch handles "ALTER VIEW v1 /no arguments/;"
-      This feature is not documented one. 
-      However, before "OPTIMIZE TABLE t1;" was implemented, 
-      ALTER TABLE with no alter_specifications was used to force-rebuild
-      the table. That's why this grammar is allowed. That's why we ignore
-      it for views. So just do nothing in such a case.
-    */
-    if (!new_name)
-    {
-      my_ok(thd);
-      DBUG_RETURN(FALSE);
-    }
-
-    /*
-      Avoid problems with a rename on a table that we have locked or
-      if the user is trying to to do this in a transcation context
-    */
-
-    if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction())
-    {
-      my_message(ER_LOCK_OR_ACTIVE_TRANSACTION,
-                 ER(ER_LOCK_OR_ACTIVE_TRANSACTION), MYF(0));
-      DBUG_RETURN(TRUE);
-    }
-
-    if (thd->global_read_lock.wait_if_global_read_lock(thd, FALSE, TRUE))
-      DBUG_RETURN(TRUE);
-
-    /*
-      TODO/FIXME: Get rid of this code branch if possible. To add insult
-                  to injury it breaks locking protocol.
-    */
-    table_list->mdl_request.set_type(MDL_EXCLUSIVE);
-    if (lock_table_names(thd, table_list))
-    {
-      error= 1;
-      goto view_err;
-    }
-
-    mysql_mutex_lock(&LOCK_open);
-
-    if (!do_rename(thd, table_list, new_db, new_name, new_name, 1))
-    {
-      if (mysql_bin_log.is_open())
-      {
-        thd->clear_error();
-        Query_log_event qinfo(thd, thd->query(), thd->query_length(),
-                              FALSE, TRUE, FALSE, 0);
-        if ((error= mysql_bin_log.write(&qinfo)))
-          goto view_err_unlock;
-      }
-      my_ok(thd);
-    }
-
-view_err_unlock:
-    mysql_mutex_unlock(&LOCK_open);
-    unlock_table_names(thd);
-
-view_err:
-    thd->global_read_lock.start_waiting_global_read_lock(thd);
-    DBUG_RETURN(error);
-  }
-
 
   /*
     Code below can handle only base tables so ensure that we won't open a view.
@@ -7226,14 +7137,14 @@ view_err:
   {
     if (table->s->tmp_table)
     {
-      Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+      Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
+                                      MYSQL_LOCK_IGNORE_TIMEOUT));
       TABLE_LIST tbl;
       bzero((void*) &tbl, sizeof(tbl));
       tbl.db= new_db;
       tbl.table_name= tbl.alias= tmp_name;
       /* Table is in thd->temporary_tables */
-      (void) open_table(thd, &tbl, thd->mem_root, &ot_ctx_unused,
-                        MYSQL_OPEN_IGNORE_FLUSH);
+      (void) open_table(thd, &tbl, thd->mem_root, &ot_ctx);
       new_table= tbl.table;
     }
     else
@@ -7512,7 +7423,7 @@ view_err:
       To do this we need to obtain a handler object for it.
       NO need to tamper with MERGE tables. The real open is done later.
     */
-    Open_table_context ot_ctx_unused(thd, LONG_TIMEOUT);
+    Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
     TABLE *t_table;
     if (new_name != table_name || new_db != db)
     {
@@ -7532,8 +7443,7 @@ view_err:
       */
       table_list->mdl_request.ticket= mdl_ticket;
     }
-    if (open_table(thd, table_list, thd->mem_root,
-                   &ot_ctx_unused, MYSQL_OPEN_REOPEN))
+    if (open_table(thd, table_list, thd->mem_root, &ot_ctx))
     {
       goto err_with_mdl;
     }

=== modified file 'sql/sql_test.cc'
--- a/sql/sql_test.cc	2010-03-31 14:05:33 +0000
+++ b/sql/sql_test.cc	2010-06-01 10:13:56 +0000
@@ -45,7 +45,6 @@ static const char *lock_descriptions[] =
   /* TL_READ_HIGH_PRIORITY      */  "High priority read lock",
   /* TL_READ_NO_INSERT          */  "Read lock without concurrent inserts",
   /* TL_WRITE_ALLOW_WRITE       */  "Write lock that allows other writers",
-  /* TL_WRITE_ALLOW_READ        */  "Write lock, but allow reading",
   /* TL_WRITE_CONCURRENT_INSERT */  "Concurrent insert lock",
   /* TL_WRITE_DELAYED           */  "Lock used by delayed insert",
   /* TL_WRITE_DEFAULT           */  NULL,

=== modified file 'sql/sql_truncate.cc'
--- a/sql/sql_truncate.cc	2010-05-25 20:01:38 +0000
+++ b/sql/sql_truncate.cc	2010-05-27 21:11:55 +0000
@@ -52,6 +52,22 @@ delete_all_rows(THD *thd, TABLE *table)
   thd->clear_current_stmt_binlog_format_row();
 
   /*
+    Update handler statistics (e.g. table->file->stats.records).
+    Might be used by the storage engine to aggregate information
+    necessary to allow deletion. Currently, this seems to be
+    meaningful only to the archive storage engine, which uses
+    the info method to set the number of records. Although
+    archive does not support deletion, it becomes necessary in
+    order to return a error if the table is not empty.
+  */
+  error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
+  if (error && error != HA_ERR_WRONG_COMMAND)
+  {
+    table->file->print_error(error, MYF(0));
+    goto end;
+  }
+
+  /*
     Attempt to delete all rows in the table.
     If it is unsupported, switch to row by row deletion.
   */
@@ -335,7 +351,7 @@ static bool open_and_lock_table_for_trun
       the MDL lock taken above and otherwise there is no way to
       wait for FLUSH TABLES in deadlock-free fashion.
     */
-    if (open_and_lock_tables(thd, table_ref, TL_WRITE,
+    if (open_and_lock_tables(thd, table_ref, FALSE,
                              MYSQL_OPEN_IGNORE_FLUSH |
                              MYSQL_OPEN_SKIP_TEMPORARY))
       DBUG_RETURN(TRUE);
@@ -390,7 +406,7 @@ bool mysql_truncate_table(THD *thd, TABL
         table and delete all rows. In such a manner this can in fact
         open several tables if it's a temporary MyISAMMRG table.
       */
-      if (open_and_lock_tables(thd, table_ref, TL_WRITE,
+      if (open_and_lock_tables(thd, table_ref, FALSE,
                                MYSQL_OPEN_TEMPORARY_ONLY))
         DBUG_RETURN(TRUE);
 
@@ -455,6 +471,11 @@ bool mysql_truncate_table(THD *thd, TABL
     trans_rollback(thd);
   }
 
+  /*
+    A locked table ticket was upgraded to a exclusive lock. After the
+    the query has been written to the binary log, downgrade the lock
+    to a shared one.
+  */
   if (mdl_ticket)
     mdl_ticket->downgrade_exclusive_lock(MDL_SHARED_NO_READ_WRITE);
 

=== modified file 'sql/sql_truncate.h'
--- a/sql/sql_truncate.h	2010-05-25 20:01:38 +0000
+++ b/sql/sql_truncate.h	2010-05-27 21:11:55 +0000
@@ -16,7 +16,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 class THD;
-class TABLE_LIST;
+struct TABLE_LIST;
 
 bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref);
 

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2010-05-25 12:35:01 +0000
+++ b/sql/table.cc	2010-05-27 21:28:24 +0000
@@ -2777,9 +2777,10 @@ bool check_db_name(LEX_STRING *org_name)
 */
 
 
-bool check_table_name(const char *name, uint length)
+bool check_table_name(const char *name, size_t length)
 {
-  uint name_length= 0;  // name length in symbols
+  // name length in symbols
+  size_t name_length= 0;
   const char *end= name+length;
   if (!length || length > NAME_LEN)
     return 1;
@@ -2809,18 +2810,19 @@ bool check_table_name(const char *name, 
     name_length++;
   }
 #if defined(USE_MB) && defined(USE_MB_IDENT)
-  return (last_char_is_space || name_length > NAME_CHAR_LEN) ;
+  return last_char_is_space || (name_length > NAME_CHAR_LEN);
 #else
-  return 0;
+  return FALSE;
 #endif
 }
 
 
 bool check_column_name(const char *name)
 {
-  uint name_length= 0;  // name length in symbols
+  // name length in symbols
+  size_t name_length= 0;
   bool last_char_is_space= TRUE;
-  
+
   while (*name)
   {
 #if defined(USE_MB) && defined(USE_MB_IDENT)
@@ -2845,7 +2847,7 @@ bool check_column_name(const char *name)
     name_length++;
   }
   /* Error if empty or too long column name */
-  return last_char_is_space || (uint) name_length > NAME_CHAR_LEN;
+  return last_char_is_space || (name_length > NAME_CHAR_LEN);
 }
 
 

=== modified file 'sql/table.h'
--- a/sql/table.h	2010-05-25 20:01:38 +0000
+++ b/sql/table.h	2010-05-27 21:28:24 +0000
@@ -2001,7 +2001,7 @@ void update_create_info_from_table(HA_CR
 bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase);
 bool check_db_name(LEX_STRING *db);
 bool check_column_name(const char *name);
-bool check_table_name(const char *name, uint length);
+bool check_table_name(const char *name, size_t length);
 int rename_file_ext(const char * from,const char * to,const char * ext);
 char *get_field(MEM_ROOT *mem, Field *field);
 bool get_field(MEM_ROOT *mem, Field *field, class String *res);


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100601111034-7be7jf5xs2sg0ika.bundle
Thread
bzr commit into mysql-trunk-runtime branch (kostja:3026)Konstantin Osipov1 Jun