List:Commits« Previous MessageNext Message »
From:dlenev Date:May 5 2008 1:27pm
Subject:bk commit into 6.1 tree (dlenev:1.2615) WL#3726
View as plain text  
Below is the list of changes that have just been committed into a local
6.1 repository of dlenev.  When dlenev does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-05-05 15:27:18+04:00, dlenev@stripped +4 -0
  Post-merge fixes after merging patches for WL#3726 "DDL locking for all
  metadata objects" with latest mysql-6.1-fk tree.

  mysql-test/r/view_multi.result@stripped, 2008-05-05 15:27:11+04:00, dlenev@stripped
+1 -1
    Adjusted test case after merging with 6.1 tree.

  mysql-test/t/view_multi.test@stripped, 2008-05-05 15:27:11+04:00, dlenev@stripped +1
-1
    Adjusted test case after merging with 6.1 tree.

  sql/sql_base.cc@stripped, 2008-05-05 15:27:12+04:00, dlenev@stripped +1 -1
    Fixed incorrect error message.

  sql/sql_view.cc@stripped, 2008-05-05 15:27:12+04:00, dlenev@stripped +14 -79
    Fixed results of bad automatic and manual merges.

diff -Nrup a/mysql-test/r/view_multi.result b/mysql-test/r/view_multi.result
--- a/mysql-test/r/view_multi.result	2007-09-04 13:31:59 +04:00
+++ b/mysql-test/r/view_multi.result	2008-05-05 15:27:11 +04:00
@@ -34,7 +34,7 @@ i
 1
 select * from t2;
 i
-show binlog events in 'master-bin.000001' from 106;
+show binlog events in 'master-bin.000001' from 107;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (i int)
 master-bin.000001	#	Query	1	#	use `test`; create table t2 (i int)
diff -Nrup a/mysql-test/t/view_multi.test b/mysql-test/t/view_multi.test
--- a/mysql-test/t/view_multi.test	2008-03-04 18:21:05 +03:00
+++ b/mysql-test/t/view_multi.test	2008-05-05 15:27:11 +04:00
@@ -104,7 +104,7 @@ select * from t2;
 
 # Now let us check that statements were logged in proper order
 --replace_column 2 # 5 #
-show binlog events in 'master-bin.000001' from 106;
+show binlog events in 'master-bin.000001' from 107;
 
 drop table t1, t2;
 drop view v1;
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc	2008-04-30 14:18:29 +04:00
+++ b/sql/sql_base.cc	2008-05-05 15:27:12 +04:00
@@ -3814,7 +3814,7 @@ bool open_view_entry(THD *thd, TABLE_LIS
     return FALSE;
   }
 
-  my_error(ER_WRONG_OBJECT, MYF(0), share->db.str, share->table_name.str, "BASE
TABLE");
+  my_error(ER_WRONG_OBJECT, MYF(0), share->db.str, share->table_name.str, "VIEW");
   release_table_share(share, RELEASE_NORMAL);
 err:
   VOID(pthread_mutex_unlock(&LOCK_open));
diff -Nrup a/sql/sql_view.cc b/sql/sql_view.cc
--- a/sql/sql_view.cc	2008-04-30 14:18:29 +04:00
+++ b/sql/sql_view.cc	2008-05-05 15:27:12 +04:00
@@ -230,24 +230,6 @@ bool create_view_precheck(THD *thd, TABL
   DBUG_ENTER("create_view_precheck");
 
   /*
-    We can't allow taking exclusive meta-data locks of unlocked view under
-    LOCK TABLES since this might lead to deadlock. Since at the moment we
-    can't really lock view with LOCK TABLES we simply prohibit creation/
-    alteration of views under LOCK TABLES.
-
-    QQ: Theoretically this breaks backward compatibility. So may be it is
-        better to use some alternative approach (e.g. similar to CREATE
-        TABLE which uses trylock?).
-  */
-
-  if (thd->locked_tables)
-  {
-    my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
-    res= TRUE;
-    goto err;
-  }
-
-  /*
     Privilege check for view creation:
     - user has CREATE VIEW privilege on view table
     - user has DROP privilege in case of ALTER VIEW or CREATE OR REPLACE
@@ -394,70 +376,23 @@ bool mysql_create_view(THD *thd, TABLE_L
   DBUG_ASSERT(!lex->proc_list.first && !lex->result &&
               !lex->param_list.elements);
 
-  if (mode != VIEW_CREATE_NEW)
-  {
-    if (mode == VIEW_ALTER &&
-        fill_defined_view_parts(thd, view))
-    {
-      res= TRUE;
-      goto err;
-    }
-    sp_cache_invalidate();
-  }
-
-  if (!lex->definer)
-  {
-    /*
-      DEFINER-clause is missing; we have to create default definer in
-      persistent arena to be PS/SP friendly.
-      If this is an ALTER VIEW then the current user should be set as
-      the definer.
-    */
-    Query_arena original_arena;
-    Query_arena *ps_arena = thd->activate_stmt_arena_if_needed(&original_arena);
-
-    if (!(lex->definer= create_default_definer(thd)))
-      res= TRUE;
-
-    if (ps_arena)
-      thd->restore_active_arena(ps_arena, &original_arena);
-
-    if (res)
-      goto err;
-  }
-
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
   /*
-    check definer of view:
-      - same as current user
-      - current user has SUPER_ACL
+    We can't allow taking exclusive meta-data locks of unlocked view under
+    LOCK TABLES since this might lead to deadlock. Since at the moment we
+    can't really lock view with LOCK TABLES we simply prohibit creation/
+    alteration of views under LOCK TABLES.
+
+    QQ: Theoretically this breaks backward compatibility. So may be it is
+        better to use some alternative approach (e.g. similar to CREATE
+        TABLE which uses trylock?).
   */
-  if (lex->definer &&
-      (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) != 0 ||
-       my_strcasecmp(system_charset_info,
-                     lex->definer->host.str,
-                     thd->security_ctx->priv_host) != 0))
+
+  if (thd->locked_tables)
   {
-    if (!(thd->security_ctx->master_access & SUPER_ACL))
-    {
-      my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
-      res= TRUE;
-      goto err;
-    }
-    else
-    {
-      if (!is_acl_user(lex->definer->host.str,
-                       lex->definer->user.str))
-      {
-        push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
-                            ER_NO_SUCH_USER,
-                            ER(ER_NO_SUCH_USER),
-                            lex->definer->user.str,
-                            lex->definer->host.str);
-      }
-    }
+    my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
+    res= TRUE;
+    goto err;
   }
-#endif
 
   if ((res= create_view_precheck(thd, tables, view, mode)))
     goto err;
@@ -465,7 +400,7 @@ bool mysql_create_view(THD *thd, TABLE_L
   lex->link_first_table_back(view, link_to_local);
   view->open_table_type= TABLE_LIST::TAKE_EXCLUSIVE_MDL;
 
-  if (open_and_lock_tables(thd, tables))
+  if (open_and_lock_tables(thd, lex->query_tables))
   {
     view= lex->unlink_first_table(&link_to_local);
     res= TRUE;
Thread
bk commit into 6.1 tree (dlenev:1.2615) WL#3726dlenev5 May