List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:March 9 2010 10:26pm
Subject:bzr commit into mysql-next-mr-bugfixing branch (kostja:3122) Bug#51710
View as plain text  
#At file:///opt/local/work/next-4284/ based on revid:alik@stripped

 3122 Konstantin Osipov	2010-03-10
      A fix and a test case for Bug#Bug#51710 FLUSH TABLES <view> WITH READ LOCK 
      kills the server.
      
      Prohibit FLUSH TABLES WITH READ LOCK application to views.
      Test that temporary tables work.

    modified:
      mysql-test/r/flush.result
      mysql-test/t/flush.test
      sql/sql_parse.cc
=== modified file 'mysql-test/r/flush.result'
--- a/mysql-test/r/flush.result	2010-02-27 17:05:14 +0000
+++ b/mysql-test/r/flush.result	2010-03-09 22:26:37 +0000
@@ -207,3 +207,19 @@ insert into t2 (a) values (3);
 unlock tables;
 # --> connection con1
 drop table t1, t2, t3;
+#
+# Bug#51710 FLUSH TABLES <view> WITH READ LOCK kills the server
+#
+drop view if exists v1, v2, v3;
+drop table if exists t1, v1;
+create table t1 (a int);
+create view v1 as select 1;
+create view v2 as select * from t1;
+create view v3 as select * from v2;
+flush table v1, v2, f3 with read lock;
+ERROR HY000: 'test.v1' is not BASE TABLE
+create temporary table v1 (a int);
+flush table v1 with read lock;
+unlock tables;
+drop view v1, v2, v3;
+drop table t1, v1;

=== modified file 'mysql-test/t/flush.test'
--- a/mysql-test/t/flush.test	2010-02-27 17:05:14 +0000
+++ b/mysql-test/t/flush.test	2010-03-09 22:26:37 +0000
@@ -324,3 +324,23 @@ disconnect con1;
 --source include/wait_until_disconnected.inc
 connection default;
 drop table t1, t2, t3;
+
+--echo #
+--echo # Bug#51710 FLUSH TABLES <view> WITH READ LOCK kills the server
+--echo #
+--disable_warnings
+drop view if exists v1, v2, v3;
+drop table if exists t1, v1;
+--enable_warnings
+create table t1 (a int);
+create view v1 as select 1;
+create view v2 as select * from t1;
+create view v3 as select * from v2;
+
+--error ER_WRONG_OBJECT
+flush table v1, v2, f3 with read lock;
+create temporary table v1 (a int);
+flush table v1 with read lock;
+unlock tables;
+drop view v1, v2, v3;
+drop table t1, v1;

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-03-04 15:34:29 +0000
+++ b/sql/sql_parse.cc	2010-03-09 22:26:37 +0000
@@ -1665,6 +1665,14 @@ static bool flush_tables_with_read_lock(
   if (lock_table_names(thd, all_tables))
     goto error;
 
+  /* Skip views and temporary tables. */
+  for (table_list= all_tables; table_list;
+       table_list= table_list->next_global)
+  {
+    table_list->required_type= FRMTYPE_TABLE;
+//    table_list->open_type= OT_BASE_ONLY;
+  }
+
   if  (open_and_lock_tables(thd, all_tables, FALSE,
                             MYSQL_OPEN_HAS_MDL_LOCK,
                             &lock_tables_prelocking_strategy) ||


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100309222637-es3dsnvd2o6ke6q3.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (kostja:3122) Bug#51710Konstantin Osipov9 Mar